Adrian Bunk | 1 Jan 02:34 2006
Picon

Re: documentation

On Thu, Dec 29, 2005 at 07:51:53PM -0500, Ms Jimena N. wrote:

> Hi all,

Hi,

> I new in linux, and Im trying to gain time. I have read some of the
> documentation on the site, but what im looking for is "Understanding Linux
> Kernel". Does anyone have it in pdf?

"Linux Device Drivers" is available online:
  http://lwn.net/Kernel/LDD3/

> TIA, and sorry about my english.
> 
> thanks Ms. Jim

HTH
Adrian

--

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
(Continue reading)

Abhishek Gupta | 1 Jan 04:39 2006
Picon

Re: __bread freezes for physical device.

Hi Thomas and everyone else,

So here is a little lesson I learnt while solving this problem. If you are relying on buffer caches for input/output or in other words you are in love with the __bread(bdev, block, size) function then be sure to set the value of bdev->bd_inode->i_blkbits to  log (size)  before calling __bread(). Obviously, the log I am talking about here is log to the base 2. If you do not do so, then the kernel may enter an infinite loop.

wish you happy hacking and a splendid new year!

- Abhishek

On 12/30/05, Thomas Petazzoni <thomas.petazzoni <at> enix.org> wrote:
Hi,

Abhishek Gupta wrote:

> I am having trouble in using the block cache apis at the driver level. I am
> writing a new radix tree target for LVM and for that I need to cache metadata
> blocks at the LVM layer. For these purposes I am using the __bread() function.
> The problem is that it works perfectly with loopback devices but the moment I
> try to use __bread() on an actual physical device, the whole machine freezes.
> Has anyone had this trouble before. I would really appreciate any help in this
> regard.

Is the code available somewhere ? Did you check the output of Sysrq-t ?

Sincerly,

Thomas
--
Thomas Petazzoni
thomas.petazzoni <at> enix.org

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


Mulyadi Santosa | 1 Jan 08:49 2006
Picon

Re: Re: kprobes & task_struct

Hi Frank...

> bash-> do_fork-> bash(available the environment for ls) -> execve ->
> ls
>
> #strace -aef ls
> execve("/bin/ls", ["ls"], [/* 22 vars */]) = 0
>
> I set the Return Probes  with do_execve as trigger
>
> Dec 31 22:39:11 fedorasys kernel: fc_pid = 3151 fc_command = rmmod 
> parent_pid = 3040  parent_command = bash Dec 31 22:39:11 fedorasys
> kernel:

Ahh...:) Maybe something during do_fork() hasn't set the 
task_struct->comm properly according the new ELF binary loaded.

But anyway, as you know, putting kprobe's hook on do_execve only catch 
new binary invocation, is it really what you want? Previously I thought 
you wanted to catch general fork scenario...CMIIW

Maybe what you need is putting the probe into multiple place e.g 
sys_fork and sys_execve and so on.

> Now i search a way to export the data into the user pace. over the
> standard syslog it goes account of system performance.
> My module runs under 2.6.15-rc7 in older kernel versions my module
> freeze the system

Try relayfs? Anyway, you said "freeze", during which event?

regards

Mulyadi

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

pradeep singh | 1 Jan 10:22 2006
Picon

USB device query

hi all

whenever i put a USB pen drive in the USB slots it gets recognized in Linux and i can mount it using simple mount /dev/sda1 command.

Problem is whenever i put the device in the slot before booting the Linux it doesnt recognize it.At this point even if i plug it out and insert it again , it still doesnot detects it.Can anybody explain why this is so?

This is what i can make out.

When the Linux machine is up, the initialization task is ok but whenever the slot is occupied and the machine is say rebooted, the SCSI subsystem when initialized does a simple bus reset which makes the device usually unaccessible by the SCSI midlayer.And thus though no matter how hard we try we cannot access the off node, untill i remove and reinsert the scsi module again.

Am i right??

Please explain and correct me if i am wrong.

thanks

pradeep
--
play the game

Md.Zaheeruddin Khan | 2 Jan 15:45 2006
Picon

what is a wrapper function?

HI ,
I want 2 know what is a wrapper function and where is it used?
Thanks in anticipation,
Zaheer

Thomas Petazzoni | 2 Jan 16:00 2006

Re: what is a wrapper function?

Md.Zaheeruddin Khan a écrit :
> HI ,
> I want 2 know what is a wrapper function and where is it used?

As this question is very general, it is quite hard to answer, but
Wikipédia [1] has a definition for « wrapper » :

 « A wrapper (such as a driver wrapper) is a piece of code which is
combined with another piece of code to determine how the latter code is
executed.

    The wrapper acts as an interface between its caller and the wrapped
code. This may be done for compatibility, e.g. if the wrapped code is in
a different programming language or uses different calling conventions,
for security, e.g. to prevent the calling program from executing certain
functions, to provide a level of emulation, e.g. a DirectX API which
hides the functions of the video card driver. The implication is that
the wrapped code can only be accessed via the wrapper. »

Sincerly,

Thomas

[1] http://en.wikipedia.org/wiki/Wrapper
--

-- 
Thomas Petazzoni
thomas.petazzoni <at> enix.org

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

Jesper Juhl | 2 Jan 16:13 2006
Picon

Re: what is a wrapper function?

On 1/2/06, Md.Zaheeruddin Khan <zaheer031 <at> gmail.com> wrote:
> HI ,
>  I want 2 know what is a wrapper function and where is it used?

A wrapper function is simply a function that "wraps" around a call to
another function.
They are used for different purposes, one use is to preserve backwards
compatibility until all users of an old function can be updated to
call a new function. An example would be when verify_area() was
replaced with access_ok(), verify_area was turned into a wrapper
around a call to access_ok() - new code would just call access_ok()
directly and old code could continue to call verify_area() as it
always had until someone had the time to change the call. Once all
calls of verify_area() were replaced with calls to access_ok() we
removed the wrapper.
Another use of wrapper functions can be to ensure correctness. For
example, if some lock should always be taken before a call to some
function and released immidiately after the function returns you would
often create a small wrapper around the taking of the lock, call of
function and release of the lock and then call the wrapper instead of
doing all 3 steps everywhere (and possibly getting it wrong)

  void foo_wrapper_with_locking()
  {
    spin_lock(&some_lock);
    foo();
    spin_unlock(&some_lock);
  }

Another use of wrapper functions would be if you need to call some
function where one or more of the arguments are always fixed for your
use, then to ensure that you always get it right you could create a
small wrapper :

  int wrap_function_call_with_fixed_args(int arg1)
  {
    return func(arg1, NULL, SOME_CONSTANT);
  }

--
Jesper Juhl <jesper.juhl <at> gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

Avishay Traeger | 2 Jan 16:18 2006
Picon

Re: what is a wrapper function?

A wrapper function is a function whose primary purpose is to call
another function.  A simple (and useless) wrapper function would be:

int A (int x, int y, int z)
{
    return B(x,y,z);
}

One use for wrapper functions is that you can modify the arguments:

int add_three_nums (int x, int y, int z)
{
    return add_two_nums(x+y, z);
}

Or you can modify the return value:

char *allocate_memory (int size)
{
    char *mem = my_alloc(size);
    if (!mem)
        return ERR_PTR(-ENOMEM);
    else
        return mem;
}

You can also use it if:
- you want to only export the wrapper functions but not the internal
ones.  
- you want to do something simple before and/or after the function call
(such as checking arguments)

I probably also missed several uses for them, but I hope you get the
idea.

Avishay

On Mon, 2006-01-02 at 20:15 +0530, Md.Zaheeruddin Khan wrote:
> HI ,
> I want 2 know what is a wrapper function and where is it used?
> Thanks in anticipation,
> Zaheer

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

Jesper Juhl | 2 Jan 16:25 2006
Picon

Re: what is a wrapper function?

On 1/2/06, Avishay Traeger <atraeger <at> cs.sunysb.edu> wrote:
> A wrapper function is a function whose primary purpose is to call
> another function.
[snip]
> - you want to do something simple before and/or after the function call
> (such as checking arguments)
>
The way copy_to_user() (and copy_from_user() of course) wraps
__copy_to_user() is a nice example of this :
http://sosdg.org/~coywolf/lxr/source/arch/i386/lib/usercopy.c#L726

--
Jesper Juhl <jesper.juhl <at> gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

pradeep singh | 2 Jan 18:32 2006
Picon

Re: USB device query



On 1/2/06, Ms Jimena N. <phenomenes <at> gmail.com> wrote:
Hi, I think this could help you to understand.

http://lwn.net/images/pdf/LDD3/ch13.pdf

1st of all please avoid  top  posting .

secondly i have a hard copy.. thanks anyway :-)

i guess you didnot get what i m asking?

thanks



:)


On 1/1/06, pradeep singh < 2500.pradeep <at> gmail.com> wrote:
hi all

whenever i put a USB pen drive in the USB slots it gets recognized in Linux and i can mount it using simple mount /dev/sda1 command.

Problem is whenever i put the device in the slot before booting the Linux it doesnt recognize it.At this point even if i plug it out and insert it again , it still doesnot detects it.Can anybody explain why this is so?

This is what i can make out.

When the Linux machine is up, the initialization task is ok but whenever the slot is occupied and the machine is say rebooted, the SCSI subsystem when initialized does a simple bus reset which makes the device usually unaccessible by the SCSI midlayer.And thus though no matter how hard we try we cannot access the off node, untill i remove and reinsert the scsi module again.

Am i right??

Please explain and correct me if i am wrong.

thanks

pradeep
--
play the game




--
play the game

Gmane