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: <20110302203823.GA18879@kroah.com>
Date:	Wed, 2 Mar 2011 15:38:23 -0500
From:	Greg KH <greg@...ah.com>
To:	Kumba <kumba@...too.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Can I nest kobjects to create directories under parent
 directories for my driver?

On Mon, Feb 28, 2011 at 10:31:48PM -0500, Kumba wrote:
> So I'm attempting to write my first kernel driver for an RTC chip
> (Dallas/Maxim DS1685/DS1687), and running into a problem with using
> sysfs properly.  First off, a patch for this specific RTC was sent
> int to rtc-linux about two years ago, but never made it anywhere.  I
> based off of that and have pretty much re-written the thing since
> then.  It's undergoing a second re-write after some initial feedback
> from the rtc-linux folks.
> 
> What I'm trying to do, is, in sysfs, create individual attributes
> for the bits in each control register.  DS1685 defines 6 control
> registers (4 are the standard DS1286-style, and 2 are "extended" in
> another address bank).
> 
> I want to organize it such that:
> 
> # ls /sys/devices/platform/rtc-ds1685/
> driver@  misc/  modalias  nvram  regs/  rtc/  subsystem@  uevent
> 
> And in regs/:
> ctrla/  ctrlb/  ctrlc/  ctrld/  ctrl4a/  ctrl4b/

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.

good luck,

greg k-h
--
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