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]
Date:	Wed, 02 Mar 2011 16:49:14 -0500
From:	Kumba <kumba@...too.org>
To:	Greg KH <greg@...ah.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: Can I nest kobjects to create directories under parent directories
 for my driver?

On 03/02/2011 15:38, Greg KH wrote:
>
> That's nice, but it really isn't a good idea to do things this deep.
> Userspace tools will not be able to find things properly (like libudev)
> and your kernel code will get very messy (as you have found out.)
>
> Why not look at how the other rtc drivers work, they don't nest things
> this deep and you need to sick with the standard userspace api and not
> invent a new one if at all possible.
>
> But to answer your question, you can do this, but I strongly discourage
> it.

 From the way sysfs seems to work, I can see that it encourages as little 
nesting as possible.  So this is probably the way I will go and just call the 
entries "regs_ctrla" through "regs_ctrl4b".  It still conveys the relevant 
information and is easily doable through the existing userspace framework.

How does one nest kobjects, though?  Are ksets the only real way?  Or is it 
doable through linking kobjects to each other?  If the latter is possible, how 
does one keep the reference to the device structure intact?  I figure the right 
use of backcasting (through container_of) is one way, but it definitely seems 
like I am treading new territory with such an approach.

I did learn one useful thing through this -- the use of a common show/store 
function for each register (using strncmp to look up which bit was accessed).  I 
was originally doing a single show/store pair for each, which added major code 
bloat and resulted in a ~80kb+ module.

Thanks for the feedback!  Thought my message had gotten lost!

-- 
Joshua Kinard
Gentoo/MIPS
kumba@...too.org

"The past tempts us, the present confuses us, the future frightens us.  And our 
lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic
--
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