1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
Commit Graph

44 Commits

Author SHA1 Message Date
Kay Sievers
7fd0de4984 update SUSE rules
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 17:19:05 +02:00
Kay Sievers
bfd1294892 add flag for reading of precompiled rules
Rules can be precompiled and stored on disk for initramfs, to avoid
parsing the rules with every event again and again. Also the OWNER and
GROUP names are already resolved to numerical values in the compiled
rules. This flag is used for the upcoming move of the rules parsing
into udevd:
  If the real root is mounted udevd is started and parses the rules
  only once. The event processes will inherit the already parsed rules
  from the daemon, so we want to ignore any precompiled rules and
  use the real rules files and watch the filesystem for changes to
  reload the rules automatically.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08 17:43:42 +02:00
Kay Sievers
d455b0085d allow RUN to send the environment to a local socket
RUN="socket:<name>" will send the environment in the kernel uevent
format to the named destination. Using the socket instead of the program
to pass the hotplug events to the HAL daemon, cuts down the running
time of udevstart from 0.8 to 0.4 seconds on my box.

  env -i ACTION=add DEVPATH=/block/hda/hda1 strace -s10000 ./udev block
  sendto(3, "add@/block/hda/hda1\0
    ACTION=add\0DEVPATH=/block/hda/hda1\0UDEV_LOG=3\0
    ID_TYPE=disk\0ID_MODEL=HTS726060M9AT00\0ID_SERIAL=MRH401M4G6UM9B\0
    ID_REVISION=MH4OA6BA\0ID_BUS=ata\0ID_PATH=pci-0000:00:1f.1-ide-0:0\0
    ID_FS_USAGE=other\0ID_FS_TYPE=swap\0ID_FS_VERSION=2\0
    ID_FS_UUID=9352cfef-7687-47bc-a2a3-34cf136f72e1\0
    ID_FS_LABEL=ThisIsSwap\0ID_FS_LABEL_SAFE=ThisIsSwap\0
    DEVNAME=/dev/hda1\0"

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-01 05:07:19 +02:00
Kay Sievers
e8d569b414 move code to its own files
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-22 12:35:58 -04:00
Kay Sievers
8815afa1df rename ALARM_TIMEOUT to UDEV_ALARM_TIMEOUT
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-06 14:42:26 +02:00
Kay Sievers
8bd41f36f7 pack parsed rules list
This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory
or file-size with precompiled rules.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-05 15:24:41 +02:00
Kay Sievers
66f74a2d14 [PATCH] Keep udevstart from skipping devices without a 'dev' file 2005-07-02 23:50:48 -07:00
Kay Sievers
b8476286d6 store the imported device information in the udevdb
Any program can query with udevinfo for persistent device
attributes evaluated on device discovery now.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-26 18:55:24 +02:00
Kay Sievers
be4bedd16b unify execute_command() and execute_program()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-25 15:35:14 +02:00
Kay Sievers
561d4c5a3a udevd: allow starting of udevd with stopped exec-queue
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-08 11:57:53 +02:00
Kay Sievers
c07669bd66 udev: handle all events - not only class and block devices
Handle all events with rules. If udev is expected to handle hotplug.d/
the exernal helper must be called.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05 15:55:29 +02:00
Kay Sievers
6a522681e1 udev: move dev.d/ handling to external helper
Modern rules are expected to call notification and postprocessing with    
the RUN key. For compatibility the current behavior can be emulated
with an external helper.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05 05:11:29 +02:00
kay.sievers@vrfy.org
81af4e0519 [PATCH] export DEVNAME to RUN-key executed programs 2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org
821d0ec803 [PATCH] add RUN key to be able to run rule based notification
SUBSYSTEM=="block", RUN="/sbin/program"
  will execute the program only for block device events.

ACTION="remove", SUBSYSTEM=="block", RUN"/sbin/program"
  will execute the program, if a block device is removed.
2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org
fb39f0566e [PATCH] move execute_program to utils + add action to init_device 2005-04-26 23:55:00 -07:00
kay.sievers@vrfy.org
6b493a20e1 [PATCH] support log-priority levels in udev.conf 2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
e5e322bc62 [PATCH] rename namedev_dev to udev_rule 2005-04-26 23:53:17 -07:00
kay.sievers@vrfy.org
472419869c [PATCH] rename device_list->list to device_list->node 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
63f61c5cf6 [PATCH] replace strncpy()/strncat() by strlcpy()/strlcat() 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
56a8a624ee [PATCH] split udev and udevstart 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
7225821d63 [PATCH] disable logging for udevstart
The slow logging facilites on some systems are a reason for
the reported slowness of udevstart. On one of my boxes udevstart
is down from 9 second to 0.3 seconds.
2005-04-26 22:27:34 -07:00
kay.sievers@vrfy.org
8673dcb842 [PATCH] Make dev.d/ handling a separate processing stage
Move the logic when and how to call the dev.d/ scripts into the
main processing path.
2005-04-26 22:25:09 -07:00
kay.sievers@vrfy.org
af4b05d491 [PATCH] make the udev object available to more processing stages
Remove the overwriting of main_argv[] hack and use the values
from the udev object.
  
Pass the udev object to call_foreach_file().
  
In the udevstart case, export SUBSYSTEM and UDEVSTART to the
environment.
2005-04-26 22:24:38 -07:00
kay.sievers@vrfy.org
c6478ec1e1 [PATCH] add ACTION to udev object to expose it to the whole process 2005-04-26 22:24:10 -07:00
kay.sievers@vrfy.org
5d24c6ca36 [PATCH] cleanup netif handling and netif-dev.d/ events
Here we supress the dev.d/ execution if we didn't change a network
interface's name with a rule. This should solve the issue of two
running dhclients for the same interface, cause the
/etc/dev.d/net/hotplug.dev script that fakes the hotplug event runs
with every udevstart for every interface and fakes a second identical
hotplug event on bootup.

With this patch netif interfaces are no longer stored in the udevdb.
It is not needed, cause we don't have permissions or symlinks :) and
all information is available in sysfs.

This patch also moves the dev_d execution calls out of the
udev_add/udev_remove. As with the former api-cleanup-patch we have
all processed data in one udev struct and can place the execution
calls where needed.
2005-04-26 22:02:46 -07:00
kay.sievers@vrfy.org
7a947ce515 [PATCH] big cleanup of internal udev api
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 22:02:46 -07:00
kay.sievers@vrfy.org
f608f8ac16 [PATCH] fix problems using scsi_id with udevstart
when udevstart was running we didn't set the environment and the
subsystem argument for the callouts the dev.d/ scripts.

Here is a fix, that sets that with every udevstart iteration, corrects
argv[0] to be the basename() only not the whole path  and adds a test
for invoking callouts without arguments.
2005-04-26 21:37:03 -07:00
harald@redhat.com
a551c7b0ce [PATCH] PATCH some cleanups and security fixes
posted by Steve Grubb on https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130351
2005-04-26 21:37:03 -07:00
greg@kroah.com
70f630f64b [PATCH] add a "first" list to udevstart and make it contain the class/mem/ devices
Seems some programs really want /dev/null to work properly :)
2005-04-26 21:37:00 -07:00
kay.sievers@vrfy.org
aee380b6d8 [PATCH] Fix naming ethernet devices in udevstart
On Tue, Sep 07, 2004 at 12:46:43PM +0200, Kay Sievers wrote:
> On Mon, 2004-09-06 at 20:18 -0700, Tom Rini wrote:
> > I noticed somewhat recently that my enet devices weren't being renamed
> > on boot anymore.  I don't quite know when this got broken (or rather, if
> > it was supposed to be working.  I swear it worked for me once..), but
> > the following seems to do it.
>
> I think it never worked in the udevstart case. It worked only with the
> hotplug-event-udev, I expect.
>
> > In udev_scan_class(), look for not just
> > %s/%s/dev (which everything with a dev node has), but %s/%s/dev* (both
> > of my enet devices, sis900 & 3c59x only have device) and if that
> > exists, pass this along to udev.
>
> Yeah, network devices don't have a devnode and therefore no "dev", but
> they are all in /sys/class/net/. We may just test if we are there
> instead of the "device" match.

How about something like this. It adds all the net devices without
looking at the attributes and keeps the remaining logic like it is.

It also removes certain levels of indirection and much simplifies the
udevstart process. We surely don't need to open and close the udevdb
for every node while iterating over the list. (We are about 5% faster on
my box)

It's not well tested, so it would be nice if someone can have a look
at it, before a broken udevstart renders any system unbootable.
2005-04-26 21:37:00 -07:00
trini@kernel.crashing.org
2410242aa4 [PATCH] fix UDEV_NO_SLEEP
Move setting UDEV_NO_SLEEP into main().  I thought about moving
udev_init_config() around, but it still must be invoked in both udev and
udevstart cases, and before udev_hotplug() is called.  An alternative
would be to have main() do:
if (is_udevstart) {
	... current ...
} else {
	udev_init_config();
	return udev_hotplug();
}

And move setting UDEV_NO_SLEEP into udev_start().  I can redo it that
way, if you prefer.

Signed-off-by: Tom Rini <trini@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2005-04-26 21:36:59 -07:00
trini@kernel.crashing.org
eb6c7cd036 [PATCH] Make udev/udevstart be one binary
Hi,

The following patch makes udev/udevstart be a common binary.  First,
doing this grows udev by a total of 1.8kB (ppc32, stripped) whereas
udevstart by itself is 6.4kB.  I know you mentioned being able to
replace udevstart with a script, but at 1.8kB I don't think it'll be
easy to beat this with size there.  Next, the following are by-eye
timings of before, after, and with devfs on a slow, but still usable
embedded platform (config stripped down to more-or-less bare for
ramdisk):
-- Embedded Planet RPX LITE, 64Mhz MPC 823e --
devfs         : 15.333s, 15.253s, 14.988s (15.191s avg)
udev-pristine : 18.675s, 18.079s, 18.418s (18.390s avg)
udev-multi    : 14.587s, 14.747s, 14.868s (14.734s avg)

The patch ends up being rather large to add this, as in doing so I ended
up making all refs (that I hit..) to devpath/subsystem be marked as
'const'.


Signed-off-by: Tom Rini <trini@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2005-04-26 21:36:59 -07:00
greg@kroah.com
462be028f1 [PATCH] fix stupid off-by-one bug that caused udevstart to die on x86-64 boxes. 2005-04-26 21:36:59 -07:00
greg@kroah.com
fd87429578 [PATCH] fix dumb bug I added to udevstart 2005-04-26 21:36:59 -07:00
greg@kroah.com
0e306d087d [PATCH] make a "last list" of devices for udevstart to operate on last.
Should fix the dm startup issues, hopefully...
2005-04-26 21:36:59 -07:00
greg@kroah.com
57218a0873 [PATCH] reverse order of scanning of udevstart to look at class before block.
this should fix the startup issue for lvm, hopefully...
2005-04-26 21:36:21 -07:00
greg@kroah.com
e13fa59953 [PATCH] udevstart: close open directories.
Based on a munged patch from Olaf Hering <olh@suse.de>
2005-04-26 21:35:17 -07:00
kay.sievers@vrfy.org
5df33ccd8e [PATCH] udevstart fix
Sorry, udevstart needs a small cleanup after my recent copy/pastes.
2005-04-26 21:35:14 -07:00
kay.sievers@vrfy.org
9b28a52a0a [PATCH] DEVPATH for netdev
Here we change the DEVPATH for netdev's in the environment of the dev.d/
scripts to the name the device is renamed to. The original name doesn't
exist in the kernel after rename.
2005-04-26 21:35:13 -07:00
chris_friesen@sympatico.ca
f27125f98f [PATCH] udevd race conditions and performance, assorted cleanups
This patch covers a number of areas:

1) sysfs.h is fixed up to use the common dbg() macro.  This fixes the
case where DEBUG is defined but USE_LOG isn't.

2) udevstart.c is modified to include the proper headers, rather than
getting them indirectly which can break depending on Makefile flags

3) udevd.c gets some major changes:
a) I added a pipe from the signal handler.  This fixes the race
conditions that I mentioned earlier.  Basically, the point of the pipe
is to force the select() call to return immediately if a signal handler
fired before we actually started the select() call.  This then lets us
run the appropriate code based on flags set in the signal handler proper.
b) I added a number of flags to coalesce calls to common routines.  This
should make things slightly more efficient.
c) since most calls will tend to come in with a sequence number larger
than what has been received, I switched msg_queue_insert() to scan the
msg_list backwards to improve performance.

 filename="udevd.diff"
2005-04-26 21:35:13 -07:00
md@Linux.IT
3f20eac0a5 [PATCH] udevstart fixes
udevstart_no_retval: currently udevstart will always return rc=22
because of the error handling code. I completely removed it because it
is not used, and returning a generic error to the init script is not
much useful anyway.
2005-04-26 21:35:08 -07:00
kay.sievers@vrfy.org
d00bd1724b [PATCH] overall trivial trivial cleanup
Here I try to make the style a bit more consistant in the different
files, so that new patches just copy the 'right' one :)

Some "magic" numbers are replaced and udevtest.c is catched up with udev.
2005-04-26 21:35:08 -07:00
kay.sievers@vrfy.org
e4dc0e11c1 [PATCH] cleanup udevstart
I just wanted to terminate the snprintf() strings, cause I can see a
overflow with closed eyes after all the audit :)

But then I changed a bit more to bring it in line with the style of the
other files. I replaced the exec_udev() function with the one from
udevd, cause we don't need to read the stdout from udev.

Please have a look if it still works for you too and not
only for usernames with 3 characters :)
2005-04-26 21:35:07 -07:00
greg@kroah.com
82b9a63782 [PATCH] add udevstart program based on a old patch from Harald Hoyer <harald@redhat.com>
This can be used instead of the start_udev script for systems
that do not have a shell, or some other problem...
2005-04-26 21:35:07 -07:00