summaryrefslogtreecommitdiff
path: root/namedev.h
AgeCommit message (Collapse)Author
2005-04-26[PATCH] move kernel name/number evaluation into udev_init_device()kay.sievers@vrfy.org
2005-04-26[PATCH] trivial namedev cleanupkay.sievers@vrfy.org
2005-04-26[PATCH] introduce OPTIONS=ignore_device, ignore_remove, all_partitions" keykay.sievers@vrfy.org
Here we move all possible options into a own key to make it possible to have options-only rules. The options on the NAME key are removed from the man page and will be removed from a future version of udev. For ignore rules, OPTIONS="ignore" should be used. The rule: SUBSYSTEM="block", SYSFS{removable}="1", OPTIONS="all_partitions" will create all partitions for a block device which is known to have removable media (a check for cdrom drives would be needed too).
2005-04-26[PATCH] create /block/*/range count of partitons for all_partitionskay.sievers@vrfy.org
2005-04-26[PATCH] complete removal of explicit udev permissions config filekay.sievers@vrfy.org
2005-04-26[PATCH] simplify permission handlingkay.sievers@vrfy.org
Initialize the defaults in udev_config.c instead of namedev.c. Replace macro by expanded code. Switch to mode_t instead of string value. Add and clarify some comments.
2005-04-26[PATCH] add NAME{ignore_remove} attributekay.sievers@vrfy.org
Some broken ide drivers are generating high event traffic, with add/remove events. With this attribute, it can be specified, that the node is always available. It may be used in conjunction with the new DRIVER= match to catch specific kernel device drivers.
2005-04-26[PATCH] support DRIVER as a rule keykay.sievers@vrfy.org
Match with a rule against a device with a specific kernel driver.
2005-04-26[PATCH] support SUBSYSTEM as a rule keykay.sievers@vrfy.org
This should make it easier to catch e.g all block or net devices with a single rule.
2005-04-26[PATCH] big cleanup of internal udev apikay.sievers@vrfy.org
Here is the first patch to cleanup the internal processing of the various stages of an udev event. It should not change any behavior, but if your system depends on udev, please always test it before reboot :) We pass only one generic structure around between add, remove, namedev, db and dev_d handling and make all relevant data available to all internal stages. All udev structures are renamed to "udev". We replace the fake parameter by a flag in the udev structure. We open the class device in the main binaries and not in udev_add, to make it possible to use libsysfs for udevstart directory crawling. The last sleep parameters are removed.
2005-04-26[PATCH] dev_d.c file sorting and cleanupkay.sievers@vrfy.org
On Thu, Mar 25, 2004 at 02:52:13AM +0100, Kay Sievers wrote: > Please have look if it still works for you, I only did a very quick > test. Here is a unified version, with all the functions moved to udev_lib.c. We have a generic function now, to call a given fnct(char *) for every file ending with a specific suffix, sorted in lexical order. We use it to execute the dev.d/ files and read our rules.d/ files. The binary should be a bit smaller now. I've also changed it, to not do the dev.d/ exec for net devices.
2005-04-26[PATCH] cleanup callout forkkay.sievers@vrfy.org
Here I change the callout fork logic. The current cersion is unable to read a pipe which is not flushed at once, Now we read until it's closed. The maximum argument count is calculated by the strlen now. We have 100 chars for our result buffer so we can't have more than 50 parameters. So it's much more clear what will happen now and not some magic boundary where we use shell behind it. Parameter can be combined to one by using apostrophes. this on works now: BUS="scsi", PROGRAM="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL="sda3", NAME="%c{7}" Two new test are also added.
2005-04-26[PATCH] allow to specify node permissions in the rulekay.sievers@vrfy.org
This allows to set the permissions along with the rule. This is not a general replacement for the permissions config, but it may be easier sometimes for the user to specify the permissions along with the rule, cause the permissions config file wants the final node name to match, which seems sometimes a bit difficult to guess, if format % chars are used in the NAME field. Any value not given in the rule is still be read from the permissions file or set to the default. This one will also work: BUS="usb", KERNEL="video*", NAME="my-%k", OWNER="$local" A few words to man page are also added and add_perm_dev() is moved into namedev_parse.c where it belongs to.
2005-04-26[PATCH] udev - fix debug info for multiple rule file configkay.sievers@vrfy.org
On Sat, Feb 28, 2004 at 09:56:32PM +0100, Kay Sievers wrote: > Andrey pointed out that we don't print the right filename in the debug > output. Here is a fix for that. It applies on top of Andrey's symlink > patch, cause we are touching the same part of the code. The copy/paste devil catched me :) Here is a fixed one.
2005-04-26[PATCH] udev - allow all files in a directory as the configkay.sievers@vrfy.org
I was on the train for 5 hours today and the TODO is almost empty :) So, at least four people wanted this feature, then here is a actual working patch. We may specify now in udev.conf: udev_rules="/etc/udev/" and udev will scan the whole directory for files ending with *.rules, sort it in lexical order and create our rule list from all of the files. A plain given file will still work and the same applies to the *.permissions. I sort the files in our usual linked list, cause klibc has no scandir().
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] allow SYSFS{file}kay.sievers@vrfy.org
On Sun, Feb 15, 2004 at 03:36:00AM +0100, Kay Sievers wrote: > > Since we have %s{file} it may be nice to allow SYSFS{file}. > This patch allows: > > BUS="usb", SYSFS{idProduct}="a511", NAME="video%n" > > compared to the current: > > BUS="usb", SYSFS_idProduct="a511", NAME="video%n" > > The curent syntax is still supported. > Looks a bit nicer and less hackish, I think. Better patch with infrastructure to easily implement KEY{attribute} for every other key. The first user is the SYSFS{file} key. Both versions, brackets or underscore is supported for the attribute.
2005-04-26[PATCH] stop using mode_t as different libcs define it in different ways :(greg@kroah.com
2005-04-26[PATCH] move get_pair to udev_config.c because udevinfo doesn't need all of ↵greg@kroah.com
namedev.o
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] udev - CALLOUT is PROGRAM nowkay.sievers@vrfy.org
replace CALLOUT by PROGRAM and fix old rule format
2005-04-26[PATCH] udev - drop all methods :)kay.sievers@vrfy.org
> Hi, > as promised yesterday, here is a patch that drops the explicit methods > given in the udev config and implement only one type of rule. > > A rule now consists only of a number of keys to match. All known keys > are valid in any combination. The former configs should work with a few > changes: > > o the "<METHOD>, " at the beginning of the line should be removed > > o the result of the externel program is matched with RESULT= instead if ID= > the PROGRAM= key is only valid if the program exits with zero > (just exit with nozero in a script if the rule should not match) > > o rules are processed in order they appear in the file, no priority > > o if NAME="" is given, udev is instructed to ignore this device, > no node will be created > > > EXAMPLE: > > # combined BUS, SYSFS and KERNEL > BUS="usb", KERNEL="video*", SYSFS_model="Creative Labs WebCam*", NAME="test/webcam%n" > > # exec script only for the first ide drive (hda), all other will be skipped > BUS="ide", KERNEL="hda*", PROGRAM="/home/kay/src/udev.kay/extras/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" > > > The udev-test.pl and test.block works fine here. > Please adapt your config and give it a try. > Here is a slightly better version of the patch. After a conversation with Patrick, we are now able to execute the PROGRAM and also match in all following rules with the RESULT value from this exec. EXAMPLE: We have 7 rules with RESULT and 2 with PROGRAM. Only the 5th rule matches with the callout result from the exec in the 4th rule. RULES: PROGRAM="/bin/echo abc", RESULT="no_match", NAME="web-no-2" KERNEL="video*", RESULT="123", NAME="web-no-3" KERNEL="video*", RESULT="123", NAME="web-no-4" PROGRAM="/bin/echo 123", RESULT="no_match", NAME="web-no-5" KERNEL="video*", RESULT="123", NAME="web-yes" RESULT: Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo abc' Jan 11 23:36:52 pim udev[26050]: execute_program: result is 'abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo 123' Jan 11 23:36:52 pim udev[26050]: execute_program: result is '123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: found matching rule, 'video*' becomes '' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: name, 'web-yes' is going to have owner='', group='', mode = 0600
2005-04-26[PATCH] add IGNORE rule typechristophe@saout.de
On Wed, Dec 31, 2003 at 11:24:53AM -0800, Greg KH wrote: > > There should be a possibility to tell udev not to create a device node. > > > > device-mapper: Usually set up by libdevmapper (or EVMS tools) which > > creates the device node on its own under /dev/mapper/<name>. > > > > With udev a second device is created named /dev/dm-<minor> which is not > > really needed. > > Good point. Ok, I'll agree with you. Care to make up a patch for this > kind of feature? Yes, I can try. There was no way to tell not to do anything so I created one. Errors are signalled via negative return values, so I thought that a positive, non-zero one could mean to ignore the device. I don't like it but perhaps you have a better solution.
2005-04-26[PATCH] extend exec_program[]kay.sievers@vrfy.org
extend exec_program size to 100 chars cause: PROGRAM="/home/kay/src/udev.kay/extras/ide-devfs.sh %k %b %n" is too long :)
2005-04-26[PATCH] add ability to have up to 5 SYSFS_ file/value pairs for the LABEL rule.greg@kroah.com
2005-04-26[PATCH] don't rely on field order in namedev_parsekay.sievers@vrfy.org
o change the parsing to get a key from the rule and sort it into our list of known keys instead of expecting a special order o the key to match a sysfs file must be prependend by 'SYSFS_' now to match with the new parsing. (The config must be changed, but it's a bit more descriptive too.) o put names of fields in define's, like the name of the methods o update all tests and the man page
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] fix permission handling logicgreg@kroah.com
Now we can handle wildcards properly within the permission file.
2005-04-26[PATCH] add support for a main udev config file, udev.conf.greg@kroah.com
the older udev.config file is now called udev.rules. This allows us to better control configuration values, and move away from the environment variables.
2005-04-26[PATCH] split out the namedev config parsing logic to namedev_parse.cgreg@kroah.com
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] got rid of struct device_attrgreg@kroah.com
namedev.c is still a mess, that's up next after testing...
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] put config files and database in /etc/udev by defaultgreg@kroah.com
Can be overridden on the makefile line.
2005-04-26[PATCH] add callout config type to udevpatmans@us.ibm.com
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.
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] make struct config_device contain a struct device_attr instead of ↵greg@kroah.com
duplicating the mess.
2005-04-26[PATCH] Clean up the namedev interface a bit, making the code smaller...greg@kroah.com
2005-04-26[PATCH] add initial libsysfs support...greg@kroah.com
needs lots more cleanup, but is much nicer than doing this by hand...
2005-04-26[PATCH] Initial namedev parsing of config filesgreg@kroah.com
.permission parsing works, .config needs more work.