summaryrefslogtreecommitdiff
path: root/udev-remove.c
AgeCommit message (Collapse)Author
2005-04-26[PATCH] remove dbus code from core udev code as it's no longer needed to be ↵greg@kroah.com
there.
2005-04-26[PATCH] add /etc/dev.d/ support for udev add and remove events.greg@kroah.com
2005-04-26[PATCH] replace fgets() with mmap() and introduce udev_lib.[hc]kay.sievers@vrfy.org
Here we replace the various fgets() with a mmap() call for the config file reading, due to the reported performance problems with klibc. Thanks to Patrick's testing, it makes a very small, close to nothing speed gain for libc users, but a 6 times speed increase for klibc users with a 1000 line config file. I've created a udev_lib.[hc] for this and also moved all the generic stuff from udev.h in there and uninlined the functions.
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] 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] no error on enoentmd@Linux.IT
no_error_on_enoent: do not exit with an error and delete all files when a device or directory does not exist.
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 - 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] 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] udevd - kill the lockfilekay.sievers@vrfy.org
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] small cleanup udev-remove.ckay.sievers@vrfy.org
Here is a small cleanup. It replaces the malloc in udev-remove.c with a struct, like we do in udev-add.c
2005-04-26[PATCH] udev-remove.c cleanupskay.sievers@vrfy.org
I've moved the malloc out of the udevdb into udev-remove to free the struct after use and not to allocate a different struct in the case the device is not in the data base. I seems a bit easier to read.
2005-04-26[PATCH] bug in udev-remove.ckay.sievers@vrfy.org
Uups, we have a bug in udev-remove.c. udev segfaults with NULL-pointer, if the device is not in the database: ./test.block: line 29: 4844 Segmentation fault $BIN block Dec 17 22:47:42 pim udev[4882]: udev_remove_device: '/block/sdy' not found in database, falling back on default name Dec 17 22:47:42 pim udev[4882]: udev_remove_device: name is '(null)'
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] 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] 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] 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] more database work. Now we only store the info we really need right now.greg@kroah.com
Also delete the record after the device is gone, and fix up a memory leak.
2005-04-26[PATCH] got "remove of named devices" working.greg@kroah.com
database code still needs some major cleanup.
2005-04-26[PATCH] udevdb prototypedsteklof@us.ibm.com
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.
2005-04-26[PATCH] split udev main logic into udev-add and udev-remove.greg@kroah.com