Age | Commit message (Collapse) | Author |
|
Use the new location of libsysfs header files.
|
|
happy.
Actually, I'm happy to, startup time is much smaller...
|
|
Here we change the magic callout part number selector to the new
atribute syntax. The syntax to select the second part of the callout string:
'%2c' is now '%c{2}'
I think it's more clear and we no longer misuse the length argument.
The old syntax is still supported, but we should remove it some
time in the future.
|
|
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?
|
|
On Thu, Feb 12, 2004 at 05:34:57PM -0800, Greg KH wrote:
> On Tue, Feb 10, 2004 at 09:14:20AM +0100, Hannes Reinecke wrote:
> > Hi all,
> >
> > this patch makes the format for NAME and SYMLINK a bit more flexible:
> > I've added a new format specifier '%s{<SYSFS_var>}', which allows for
> > the value of any sysfs entry found for this device to be inserted.
> > Example (for our S/390 fcp adapter):
> >
> > BUS="ccw", SYSFS_devtype="1732/03", NAME="%k" \
> > SYMLINK="zfcp-%s{hba_id}-%s{wwpn}:%s{fcp_lun}"
> >
> > I know this could also be done with an external program, but having this
> > incorporated into udev makes life easier, especially if run from
> > initramfs. Plus it makes the rules easier to follow, as the result is
> > directly visible and need not to be looked up in some external program.
> >
> > Comments etc. welcome.
>
> Oops, sorry I missed this for the 017 release. I'll look at it tomorrow
> and get back to you. At first glance it looks like a good thing.
>
> Oh, you forgot to update the documentation, that's important to do if
> you want this change to make it in :)
I took a part of the code and made a version that uses already implemented
attribute finding logic.
The parsing of the format length '%3x' and the '%x{attribute}' is a fuction now,
maybe there are more possible users in the future.
I've also added the test to udev-test.pl.
|
|
no rule.
This fixes the bug with names that have a ! in them and no rule to match.
|
|
|
|
interface
This fixes the bug of a long delay for mouse devices
|
|
Allow wild card comparison of the ID.
Using strcmp_pattern here also means we on longer match partial values,
for example, a scsi rule like this won't match anymore:
BUS="scsi", ID=":0", NAME="sdfoo-short-bus_id-1"
But this now works:
BUS="scsi", ID="*:0", NAME="sdfoo-bus_id-wild-card-1"
|
|
Kill the extra bus_id check in match_id. This is wrong, especially since
we check for rule matches with the parent devices on a given devices path.
For example, given a device path of:
/sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0
With this patch, the following rule will no longer match:
BUS="scsi", ID="host5", NAME="sd-bus_id-host5"
|
|
|
|
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().
|
|
On Tue, Jan 27, 2004 at 11:02:25AM -0800, Greg KH wrote:
> On Mon, Jan 26, 2004 at 07:28:03PM -0500, Adrian Drzewiecki wrote:
> > Looking over the code, I noticed something odd in
> > namedev.c:strcmp_pattern() --
> >
> > while (*p && (*p != ']'))
> > p ++;
> > return strcmp_pattern(p+1, s+1);
> >
> > If the pattern string is invalid, and is not terminated by a ']', then 'p'
> > will point at \0 and p+1 will be beyond the string.
>
> Yes, I think you are correct.
>
> Hm, Kay, any idea of the proper way to fix this? I've attached a patch
> below, but I don't think it is correct.
>
> while (*p && (*p != ']'))
> p++;
> - return strcmp_pattern(p+1, s+1);
> + if (*p)
> + return strcmp_pattern(p+1, s+1);
> + else
> + return 1;
> }
> }
Sure, it's perfectly correct. I'm wondering how Adrian found this.
We can use the return 1 at the end of the whole function, and asking
for the closing ']' is more descriptive, but it does the same.
- return strcmp_pattern(p+1, s+1);
+ if (*p == ']')
+ return strcmp_pattern(p+1, s+1);
Patch is attached, that also replaces all the *s with s[0].
|
|
Trivial style cleanup, to be consistent.
And add chdir("/") to the daemon so one can umout its filesystem,
while we are running :)
|
|
rule applies to.
This should fix one of the more annoying things to me about udev, and
gets rid of a TODO item.
|
|
|
|
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'
|
|
This patch fixes a bug where the udev database stored empty strings
for Owner and Group if they were default. This patch stores the default
value into the database if not set otherwise. See example output:
crw------- 1 root root 4, 65 Jan 16 11:13 ttyS1
P: /class/tty/ttyS1
N: ttyS1
S:
O: root
G: root
This is a bit of a hack. However, until udev supports setting the
o/g values they will be root/root anyway so the database might as
well reflect the truth instead of empty strings.
|
|
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
|
|
|
|
Please find inlined a patch which contains updates to libsysfs
(pre-release) for refresh and also changes to namedev.c to take
advantage of it.
|
|
This patch adds a '%' to the format char list, so that a external
program may called with a non expanded '%' like:
PROGRAM="/bin/date +%%s"
Olaf Hering asked for the feature.
A tricky test is also added :)
|
|
replace CALLOUT by PROGRAM and fix old rule format
|
|
change the empty debug string:
Jan 13 00:55:42 pim udev[2849]: namedev_name_device: found matching rule, 'video*' becomes ''
to something useful:
Jan 13 01:00:23 pim udev[3234]: namedev_name_device: found matching rule, 'video*' becomes 'video/webcam%n'
|
|
|
|
|
|
> 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
|
|
Here is a patch that switches exec_callout() to be reusable.
I want it to be callable in a different context.
|
|
Here is a patch to remove the ifdef's and fix klibc instead.
|
|
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.
|
|
of code.
|
|
Two liner to get gcc-2.95.4 to compile udev.
|
|
fix possible NULL pointer in '%c' callout substitution
and cleanup '%D' debug text
|
|
my syslog want's to contact you :)
Dec 25 20:37:48 pim udev[2274]: wait_for_device_to_initialize: Did not find bus type 'ide' on list of bus_id_files, contact greg@kroah.com
We need to put 'ide' to the bus_files array,
don't know which file to use...
|
|
device is on a bus.
|
|
device is on a bus.
Thanks to Martin Schlemmer <azarah@nosferatu.za.org> for pointing this out.
|
|
|
|
Now we only sleep if we can't find the device file, and we have
a hack to sleep for 1 second if we are on a partition. This will be
removed when the libsysfs change gets made...
|
|
|
|
|
|
|
|
Attached is a patch that introduces the format char 'k' to be replaced with
the kernel name. I like to have it in a callout script.
I've moved the build_kernel_name() back to namedev_name_device() since
we don't expect it growing cause of 'sdaj' :)
|
|
|
|
this still isn't working correctly for partitions, so don't
think this is the final version...
|
|
Thanks to Kay for pointing it out to me.
|
|
Try this patch if you like, to get special parts of the callout output.
This beast works now:
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
The callout returned string is separated by spaces and is
addressed by the "len" value of the 'c' format char.
Since we support symlinks, this my be useful for other uses of callout too.
introduce 'len number' for format chars
the first use is 'c'-the callout return to select a part of the output string like:
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
(note: first part is requested by len=1, len=0 will return the whole string)
add a test to udev-test.pl
|
|
remove possible newline at end of callout output,
for easier matching with ID=
|
|
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.
|
|
|
|
> > 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)
|