[PATCH] patch for libsysfs sysfs directory handling
Here's a quick patch to:
1) Add an environment variable "SYSFS_PATH" that libsysfs will check
for when getting mount point before searching system's sysfs mount
point.
2) A quick fix to sysfs_get_link where the bug was.
I have tested this out with libsysfs and with udev. I couldn't test
with klibc because I haven't got the tree to build with klibc without
my changes either. I made the link but get an error finding
linux/linits.h. I will figure that out.
Please have a look at the patch. If it's agreeable, please test it. I
really want to add some generic path manipulation functions for the
sysfs_get_link error, rather than my patch's hack. But, I haven't had
time yet to do that. You really sounded like you needed this for
testing, so I'm sending it out to you. I should probably add a
function to set the env variable(?).
support subdirectory creation/removal for NAME="/devfs/is/crazy/video0"
create parent subdirs for device node if needed
remove subdirs when last node is removed
set uid/gid of node specified in udev.permissions
only numeric id's are supported cause we can't resolve with
klibc or libc before real /etc is mounted
rml@tech9.net [Thu, 30 Oct 2003 06:14:24 +0000 (22:14 -0800)]
[PATCH] udev init script
I integrated udev with Fedora Core. The main piece is simply building
/udev on boot, since we don't have an initramfs yet. We should also
clear out /udev on shutdown, for /udev directories mounted on persistent
media.
The attached script goes in /etc/init.d
Then do "chkconfig --add udev"
And the rest is handled automatically. I made it for Fedora but it will
probably work, with little change, on any Linux system.
Right now it only does sysfs-based discovery of block and tty devices,
since those are the only types of devices I have on my system. There is
a TODO in the script where we would add the other device types.
[PATCH] Fixup path for kernel includes when building with klibc.
Fixup path for kernel includes when building with klibc.
klibc expects the symlink klibc/linux to point to a relatively up
to date tree, use -Iklibc/linux/include to make linux/ and asm/
includes resolve properly, as these won't exist in the regular
klibc/klibc/include location.
kay@vrfy.org [Wed, 22 Oct 2003 04:46:00 +0000 (21:46 -0700)]
[PATCH] man page update
here a new patch for the man page:
o namdev.permissions added
o corrected a few typos
o corrected text for config line format.
owner, group mode are only in namedev.permissions
(don't know what i was dreaming, while i wrote this :))
Here's the patch applying the latest libsysfs.
- adds the latest libsysfs code to udev
* new code includes dlist implementation, a generic linked list
implementation. Needed our own because LGPL
* rearranged structures
* provided more functions for accessing directory and attributes
- gets rid of ->directory->path references in namedev.c
- replaces sysfs_get_value_from_attributes with sysfs_get_classdev_attr
rml@tech9.net [Sat, 18 Oct 2003 07:12:16 +0000 (00:12 -0700)]
[PATCH] udev spec file symlink support
> Hm, I would also like to add the /etc/hotplug.d/default/udev.hotplug
> symlink, but rpm doesn't seem to like symlinks in the %files section.
> Anyone know how to do this properly?
The problem is that the symlink is left dangling to an absolute location
in the build root, which won't exist on the installer's system. RPM 4.0
and on catches this.
rml@mvista.com [Sat, 18 Oct 2003 06:54:14 +0000 (23:54 -0700)]
[PATCH] udev: cool test scripts
This patch changes test.tty and test.block to add/remove each tty and
block device, respectively, on the system. Great way to
populate/unpopulate udev rapidly.
Its just a simple for loop over the sysfs entries.
rml@tech9.net [Sat, 18 Oct 2003 06:34:19 +0000 (23:34 -0700)]
[PATCH] udev spec file bits
Some spec file changes. Primarily, this makes the thing build without a
build root if so desired (i.e. build right out of /usr/src/redhat and
the standard file system). It should still build from a build root,
too.
Also:
- Add some Prereqs
- Pass RPM_OPT_FLAGS to make so we build with the RPM build
policy (i.e., optimizations, architecture, etc.)
- Specify the exact files in %files to make sure we install
everything properly and avoid a warning
This patch adds a callout config type to udev, so external programs can be
called to get serial numbers or id's that are not available as a sysfs
attribute.
1) removes the three database files for just one udevdb.tdb file.
2) adds udevdb_init() and udevdb_exit() functions
3) initializes database now in main() in udev.c.
The merge of tdb ended up breaking the ability to cross compile again, here's
a bk patch that yanks CC out of the tdb Makefile, and in turn falls back on
the exported CC value from the top-level Makefile which correctly sets it
based off of the CROSS value.
Here's an "idea" of what I had in mind for udevdb. Let me preface the
code with a few remarks:
1) I was expecting to write this udevdb for udev to keep track of
devices. I was planning an external package that depends upon udev
to provide an external API to the udevdb database. The calls for the
interface would be read only access. Not sure how you want to do
packaging, if having a separate package is ok or having it included
in udev.
2) I created it as it is because udev isn't a daemon. So, the open
database call doesn't take any parameters. My plan was to create a
udevdb_init function that took arguments for initializing the db
to start, where you could specify in memory only or a file location.
This can all be filled in.
3) I hacked the Makefile to get it to work. Not sure how you'd want
that in the future.
4) This assumes TDB has been installed elsewhere, you would need to
edit your Makefile and point it to the header and library locations.
How do you want to do TDB in udev? Do you want to just reference it
and make udev dependent on that package being installed. Or should
we do what samba does and include a limited tdb version in udev?
5) Again, I hacked udev into your existing code. In the future, I'd
probably make a function around the filling out the udevice before
calling the store command. Didn't know if you wanted to change
your add device function to use struct udevice rather than having
everything separate.
6) Not sure what we should include in the udevice structure that's stored
by udev. I made a stab at a first shot - we can add and remove of course,
this was a first pass. I've come to realize - with you including libsysfs
in udev, the "external" interface that references udevdb could make
use of getting information from through libsysfs from sysfs and doesn't
need to be in udevdb.
7) I could write a namedevdb for namedev's device management if you
wanted.
Here's a relatively rudimentary patch that addes udev.spec. With this, you can
rpm -ta the tarball and generate rpms. I've also attached the ones I build on
my RH 7.3 host incase they are of interest to you.
I noticed that libsysfs doesn't inherently grab cross compilation arguments
that are set in the top-level Makefile, so I've come up with the following
patch to fix this. With the patch, I can succesfully cross compile for other
architectures (such as sh) by doing 'make ARCH=sh CROSS=sh-linux-' in the
top-level directory.