lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201105022144.31612.arnd@arndb.de>
Date:	Mon, 2 May 2011 21:44:31 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Jan Kara <jack@...e.cz>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Allow setting of number of raw devices as a module parameter

On Monday 02 May 2011, Jan Kara wrote:
> On Sat 30-04-11 14:15:02, Arnd Bergmann wrote:
> > On Friday 29 April 2011 00:24:29 Jan Kara wrote:
> > > Allow setting of maximal number of raw devices as a module parameter. This
> > > requires changing of static array into a vmalloced one (the array is going to
> > > be too large for kmalloc).
> > > 
> > > Signed-off-by: Jan Kara <jack@...e.cz>
> > 
> > Why don't you get rid of the global raw_devices array instead?
> > 
> > I suppose if you embed the struct cdev in raw_device_data and
> > register it during RAW_SETBIND separately for each raw device
> > instead of globally at raw_init time, you can support any number
> > of devices while making the code smaller and simpler. I suppose
> > you can even remove the raw_mutex then.
>   OK, I see. This might be a reasonable option. I'd then use kobj_lookup()
> to find my structure where I need it instead of array indexing, right? 
> I have really zero experience with writing device drivers so I'm asking
> simple questions :).

The character device layer uses kobj_lookup internally when opening
the device. When you are inside the driver, you can access it through
file->f_path.dentry->d_inode->i_cdev, from where you go to your own data
structure using container_of.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ