Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Matthias Kaehlcke
Hi Robert, El Tue, Apr 01, 2008 at 08:28:23AM -0400 Robert P. J. Day ha dit: > On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > > > they can't arrive at the second test simultaneously cause cdev_lock > > is used for synchronization. > > > > yes, they would set it to the same value, but two calls t

Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Robert P. J. Day
On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > they can't arrive at the second test simultaneously cause cdev_lock > is used for synchronization. > > yes, they would set it to the same value, but two calls to > list_add(&inode->i_devices, &p->list) would result in > inode->i_devices being added tw

Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Matthias Kaehlcke
El Tue, Apr 01, 2008 at 07:38:05AM -0400 Robert P. J. Day ha dit: > > regarding the routine "chrdev_open()" in fs/char_dev.c: > > On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > > > El Mon, Mar 31, 2008 at 10:10:41PM -0400 Robert P. J. Day ha dit: > > > > p.s. i am a bit confused as to why the

Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Robert P. J. Day
On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > El Tue, Apr 01, 2008 at 07:38:05AM -0400 Robert P. J. Day ha dit: > > > > > regarding the routine "chrdev_open()" in fs/char_dev.c: > > > > On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > > > > > El Mon, Mar 31, 2008 at 10:10:41PM -0400 Robert P. J. Da

Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Matthias Kaehlcke
El Mon, Mar 31, 2008 at 10:10:41PM -0400 Robert P. J. Day ha dit: > > (a bit involved so bear with me, i really want to figure out how > this works.) > > i'm following the sample code in the LDD3 book for the "scull" > driver, and i *think* i know the answer to this but i just want to > make

Re: how does opening a char device set the cdev pointer in the inode?

2008-04-01 Thread Robert P. J. Day
regarding the routine "chrdev_open()" in fs/char_dev.c: On Tue, 1 Apr 2008, Matthias Kaehlcke wrote: > El Mon, Mar 31, 2008 at 10:10:41PM -0400 Robert P. J. Day ha dit: > > p.s. i am a bit confused as to why there are two tests for whether > > inode->i_cdev is non-NULL: > > > > p = ino

how does opening a char device set the cdev pointer in the inode?

2008-03-31 Thread Robert P. J. Day
(a bit involved so bear with me, i really want to figure out how this works.) i'm following the sample code in the LDD3 book for the "scull" driver, and i *think* i know the answer to this but i just want to make sure. it has to do with how defining a new character device and opening it mana