summaryrefslogtreecommitdiff
path: root/udev-add.c
AgeCommit message (Collapse)Author
2005-04-26[PATCH] rename strn*() macros to strmaxkay.sievers@vrfy.org
Hey, I wrote the strn*() macros just 10 days ago and yesterday this trap caught me with the %c{x} bug. The names are misleading cause we all expect that the from field is limited by the size argument, but we actually limit the overall size of the destination string to prevent a overflow. Here we rename all strn*() macros to str*max(). That should be more self-explanatory.
2005-04-26[PATCH] better fix for NAME="foo-%c{N}" gets a truncated namekay.sievers@vrfy.org
On Wed, Mar 03, 2004 at 04:56:34PM -0800, Greg KH wrote: > On Wed, Mar 03, 2004 at 03:57:04PM -0800, Patrick Mansfield wrote: > > > > Here is a patch for some new tests. > > Applied, thanks. Here is a small improvement, which looks much better. Hey Pat, thanks a lot for finding the recent bug, hope this one will not break it again :)
2005-04-26[PATCH] fix the build for older versions of gccgreg@kroah.com
2005-04-26[PATCH] cleanup mult field string handlingkay.sievers@vrfy.org
Here I try to cleanup our various multifield iteration over the strings. Inspired by our nice list.h we now have a macro to iterate over the string and process the parts of it: It makes the code more readable and we don't change the string while we process it like the former strsep() does. Example: foreach_strpart(dev->symlink, " ", pos, len) { if (strncmp(&dev->symlink[pos], find_name, len) != 0) continue; ... } For the callout part selector %c{2} we separate now not only by space but also newline and return characters, cause some programs may give multiline values back. A possible RESULT match must contain wildcards for these characters. Also a bug in the recent udevinfo symlink query feature is fixed.
2005-04-26[PATCH] bugfix for local userkay.sievers@vrfy.org
While moving the local user logic in it's own function I missed to change the "secure" string macro. We copy only the first 3 bytes of the username. Guess why I didn't notice it :)
2005-04-26[PATCH] - unlink bugfixkay.sievers@vrfy.org
Fix for recent unlink patch.
2005-04-26[PATCH] unlink the file before we try to create it.greg@kroah.com
Based on the patch in the Gentoo repo.
2005-04-26[PATCH] add $local user spport for permissionskay.sievers@vrfy.org
2005-04-26[PATCH] udev - safer sprintf() usekay.sievers@vrfy.org
Here is for now my last patch to the string handling for a rather theorethical case, where the node is very very very long. :) We have accordant to strfieldcat(to, from) now a strintcat(to, i) macro, which appends the ascii representation of a integer to a string in a safe way.
2005-04-26[PATCH] udev - correct relative symlinkkay.sievers@vrfy.org
Here we remove the useless leading "./" of the linktargets. Thanks to Olaf Hering <olh@suse.de>, who asked why we do this :) We have now: /udev |-- camera0 -> video0 |-- kamera0 -> video0 `-- video0
2005-04-26[PATCH] Add initial SELinux support for udevgreg@kroah.com
Based on a patch from Daniel J Walsh <dwalsh@redhat.com>
2005-04-26[PATCH] udev - safer string handling all over the placekay.sievers@vrfy.org
On Tue, Feb 24, 2004 at 11:50:52PM +0100, Kay Sievers wrote: > Here is the first step towards a safer string handling. > More will follow, but for now only the easy ones :) > > Thanks to all who pointed this out. strncat() isn't a nice function. We > all should remember that the destination string is not terminated if the > given lenght is shorter than the strlen of the source string. > > And shame on the various implementers of strfieldcat() I found in the > unapplied patches on this list, it's not really better than strncpy() > and hides the real problem. Hmm, bk didn't checked in one file, maybe I edited it again as root. Nevermind, here is the more complete version.
2005-04-26[PATCH] force udev to include the internal version of libsysfs and never the ↵greg@kroah.com
external one. Should fix some more build bugs...
2005-04-26[PATCH] udev use new libsysfs header file locationpatmans@us.ibm.com
Use the new location of libsysfs header files.
2005-04-26[PATCH] fix up bug created for udevtest in previous partition creation patch.greg@kroah.com
2005-04-26[PATCH] udev - create all partitions of blockdevicekay.sievers@vrfy.org
Here is the first try to create all partitons of a blockdevice, since removable media devices may need to acces the expected partition to revalidate the media. It uses the attribute syntax introduced with the last %s{file} patch. I'm using this with my multi-slot-flash-card-reader: SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia" SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash" SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick" SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia" and I get: tree /udev/ /udev/ |-- memorystick |-- memorystick1 |-- memorystick10 |-- memorystick11 |-- memorystick12 |-- memorystick13 |-- memorystick14 |-- memorystick15 |-- memorystick2 |-- memorystick3 |-- memorystick4 |-- memorystick5 |-- memorystick6 |-- memorystick7 |-- memorystick8 |-- memorystick9 |-- multimedia |-- multimedia1 |-- multimedia10 |-- multimedia11 |-- multimedia12 |-- multimedia13 |-- multimedia14 |-- multimedia15 |-- multimedia2 |-- multimedia3 |-- multimedia4 |-- multimedia5 |-- multimedia6 |-- multimedia7 |-- multimedia8 |-- multimedia9 ... If needed, we can make the number of partions to create adjustable with the attribute?
2005-04-26[PATCH] add udevtest program to buildgreg@kroah.com
Also fix up some other dependancy issues in the Makefile. Thanks to Olaf Hering <olh@suse.de> for pointing them out.
2005-04-26[PATCH] remove some more KLIBC fixups that are no longer needed.greg@kroah.com
2005-04-26[PATCH] udev - fix "ignore method"kay.sievers@vrfy.org
On Sun, Feb 08, 2004 at 04:36:01PM +0100, Kay Sievers wrote: > We don't handle NAME="" the right way. Thanks to Emil None <emil71se@yahoo.com> > for pointing this out. Here is a fix for it and a trivial style cleanup. Changed the ignore dbg() to info().
2005-04-26[PATCH] set default owner/group in db - updatekay.sievers@vrfy.org
I've edited the man page today, so this is alreay included :) Also a few more trivials: o added the defaults to udev.conf.in o removed class_dev from get_default_mode(), to match with Hanna's o changed size of mode_str to MODE_SIZE o changed a few char compares from from 0x00 to '\0'
2005-04-26[PATCH] add udev logging to info logkay.sievers@vrfy.org
On Thu, Jan 15, 2004 at 05:14:16AM +0100, Kay Sievers wrote: > On Wed, Jan 14, 2004 at 01:10:43PM -0800, Greg KH wrote: > > On Wed, Jan 14, 2004 at 02:34:26PM -0600, Clay Haapala wrote: > > > On Wed, 14 Jan 2004, Chris Friesen spake thusly: > > > > > > > > Maybe for ones with a matching rule, you could print something like: > > > > > > > > > > > Is the act of printing/syslogging a rule in an of itself? > > > > No, as currently the only way stuff ends up in the syslog is if > > DEBUG=true is used on the build line. > > > > But it's sounding like we might want to change that... :) > > How about this in the syslog after connect/disconnect? > > Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n' > Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0' > Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0' Here is a slightly better version. I've created a logging.h file and moved the debug macros from udev.h in there. If you type: 'make' - you will get a binary that prints one or two lines to syslog if a device node is created or deleted 'make LOG=false' - you get a binary that prints asolutely nothing 'make DEBUG=true' - the same as today, it will print all debug lines
2005-04-26[PATCH] make symlink work properly if there is already a file in its placeazarah@nosferatu.za.org
If a file that is not a symlink (node, socket, fifo, etc) already exist where udev need to create a symlink, symlink() fails. This patch basically test for an existing file, and unlink it.
2005-04-26[PATCH] check for empty symlink stringkay.sievers@vrfy.org
Attached is a patch for udev-add.c to ignore empty symlink string parts. Issue was brought up by ide-devfs.sh with only one symlink returned, while two are expected.
2005-04-26[PATCH] libsysfs 0.4.0 patchdsteklof@us.ibm.com
Ananth released sysfsutils 0.4.0 last night, I'm sure you saw the email. Here's a patch with the latest changes from the pre-patch I already gave you. It includes sysfs_get_device_parent(), which you said you needed. I've run your test scripts and I've built scsi_id. Please play around with this and check it out. There are quite a few changes. Please do not access structure pointers, like sysfs_device's parent, directly like dev->parent. Please use the "get" function to retrieve. The functions load things on demand and refresh views under the covers.
2005-04-26[PATCH] pre-libsysfs-0.4.0 patchdsteklof@us.ibm.com
I am sending you a pre-release patch. It's everything that's in our current CVS tree. It adds the functionality you've been looking for. Please play with this before checking it into your tree, I'd like to know if it's ok with you or if you find problems. I have tested this out with test.all and the perl regression test. Let me know what you think. Still need to do more testing for our work and add some more functions related to the changes. I've gone into namedev.c and udev-add.c to make the necessary changes in line with the library. I have not gone and edited any of the "extras". Changes: 1) Libsysfs object structures work more as handles now, their included directories or devices are labeled private. If you need attributes from a sysfs_class_device, call the available function and don't access the directory directly. Same holds true for a sysfs_class_device sysfs_device. Do not access the link directly but call the function sysfs_get_classdev_device() instead. We only populate entries upon request, makes things faster and uses less memory. 2) Added sysfs_get_classdev_parent() as requested. 3) Changed getpagesize to sysconf. 4) Added sysfs_refresh_attributes function for refreshing views of attribute lists. We still need to add refresh for links and subdirs. All udev needs to do is keep calling sysfs_get_classdev_attr() and that will internally call the refresh routine.
2005-04-26[PATCH] allow multiple symlinkskay.sievers@vrfy.org
Here is a patch to allow the creation of multiple symlinks. The names must be separated by a space character. REPLACE, KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n" results in: Dec 9 05:28:51 pim udev[12019]: create_node: mknod(udev-root/visor, 020666, 188, 0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/first-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/first-0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/second-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/second-0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/third-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/third-0)
2005-04-26[PATCH] cleanup man & remove symlink commentkay.sievers@vrfy.org
remove "want symlinks" text from udev-add.c mention SYMLINK in man page man page format cleanup man page example for SYMLINK
2005-04-26[PATCH] move all of the DBUS logic into one file and remove all of the ↵greg@kroah.com
#ifdef crud from the main code.
2005-04-26[PATCH] D-BUS patch for udev-008david@fubar.dk
Attached is a patch against udev-008 to send out a D-BUS message when a device node is added or removed. Using D-BUS lingo, udev acquires the org.kernel.udev service and sends out a NodeCreated or NodeDeleted signal on the org.kernel.udev.NodeMonitor interface. Each signal carries two parameters: the node in question and the corresponding sysfs path. [Note: the D-BUS concepts of service, interface, object can be a bit confusing at first glance] An example program listening for these messages looks like this #!/usr/bin/python import dbus import gtk def udev_signal_received(dbus_iface, member, service, object_path, message): [filename, sysfs_path] = message.get_args_list() if member=='NodeCreated': print 'Node %s created for %s'%(filename, sysfs_path) elif member=='NodeDeleted': print 'Node %s deleted for %s'%(filename, sysfs_path) def main(): bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) bus.add_signal_receiver(udev_signal_received, 'org.kernel.udev.NodeMonitor', # interface 'org.kernel.udev', # service '/org/kernel/udev/NodeMonitor') # object gtk.mainloop() if __name__ == '__main__': main() and this is the output when hot-plugging some usb-storage. [david@laptop udev-008]$ ~/node_monitor.py Node /udev/sda created for /block/sda Node /udev/sda1 created for /block/sda/sda1 Node /udev/sda1 deleted for /block/sda/sda1 Node /udev/sda deleted for /block/sda The patch requires D-BUS 0.20 or later while the python example program requires D-BUS from CVS as I only recently applied a patch against the python bindings.
2005-04-26[PATCH] experimental (very simple) SYMLINK creationkay.sievers@vrfy.org
> > here is a experimental symlink creation patch - for discussion, > > in which direction we should go. > > It is possible now to define SYMLINK= after the NAME= in udev.rules. > > The link is relative to the node, but the path is not optimized now > > if the node and the link are in the same nested directory. > > Only one link is supported, cause i need to sleep now :) > > > > 06-simple-symlink-creation.diff > > simple symlink creation > > reorganized udev-remove to have access to the symlink field > > subdir creation/removal are functions now > > udev-test.pl tests for link creation/removal Here is a new version with relative link target path optimization an better tests in udev-test.pl: LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink" Dec 7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c' Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d' Dec 7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink)
2005-04-26[PATCH] overall whitespace + debug text conditioningkay.sievers@vrfy.org
01-overall-whitespace+debug-text-conditioning.diff o cleanup whitespace o clarify a few comments o enclose all printed debug string values in ''
2005-04-26[PATCH] added ability to put format specifiers in the CALLOUT program string.greg@kroah.com
2005-04-26[PATCH] add support for string group and string user names in udev.permissions.greg@kroah.com
This only works if you are using glibc. Patch based on patch from Marco d'Itri <md@Linux.IT>
2005-04-26[PATCH] fix permissions to work properly now.greg@kroah.com
Forgot about umask in mknod...
2005-04-26[PATCH] get the major/minor number before we name the device.greg@kroah.com
Will come in handy later...
2005-04-26[PATCH] fix udev-add.c to build properly with older versions of gcc.greg@kroah.com
2005-04-26[PATCH] add support for subdirskay.sievers@vrfy.org
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
2005-04-26[PATCH] add uid/gid to nodeskay.sievers@vrfy.org
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
2005-04-26[PATCH] udev: sleep_for_dev() bitsrml@tech9.net
OK, I fixed that bug you hinted at earlier in my previous sleep_for_dev() patch. I am sure you fixed it, but here we go nonetheless, just in case. I actually changed it up a bit. It is probably faster to count down from SECONDS_TO_WAIT_FOR_DEV than count up. I also made the lone 'path' argument const, since it can be. Some other misc. bits, too.
2005-04-26[PATCH] klibc specific tweaksgreg@kroah.com
2005-04-26[PATCH] udev-add build cleanups for other libc versions.greg@kroah.com
2005-04-26[PATCH] got rid of struct device_attrgreg@kroah.com
namedev.c is still a mess, that's up next after testing...
2005-04-26[PATCH] udev: another canidate for staticrml@tech9.net
Another one of those "trivial patches so everything must be good" sleep_for_dev() isn't exported or defined in a header, so it can be marked 'static'
2005-04-26[PATCH] Fix bug causing udev to sleep forever waiting for dev file to show up.greg@kroah.com
Now we will timeout properly.
2005-04-26[PATCH] make config files, sysfs root, and udev root configurable from ↵greg@kroah.com
config variables This will make running tests a lot simpler.
2005-04-26[PATCH] major database cleanupsgreg@kroah.com
Now we standardise on a struct udevice to pass around, and store in the database. This cleaned up the database code a lot.
2005-04-26[PATCH] don't sleep if 'dev' file is already present on device add.greg@kroah.com
instead sleep for up to 10 seconds waiting for it to show up.
2005-04-26[PATCH] fix comment about how the "dev" file is made up.greg@kroah.com
2005-04-26[PATCH] udev: mode should be mode_trml@tech9.net
Unix file modes should be stored in a mode_t, not a standard type. At the moment it is actually unsigned, in fact, not a signed integer. Attached patch does an s/int mode/mode_t mode/ and cleans up the results.
2005-04-26[PATCH] udev: trivial trivialitiesrml@tech9.net
Yah yah, really trivial stuff... - get_class_device() doesn't need to be exported; it should be static - white space cleanup