]> git.ipfire.org Git - thirdparty/systemd.git/blame - udevd.h
merge device event handling and make database content available on "remove"
[thirdparty/systemd.git] / udevd.h
CommitLineData
7fafc032
KS
1/*
2 * udevd.h
3 *
7fafc032 4 * Copyright (C) 2004 Ling, Xiaofeng <xiaofeng.ling@intel.com>
e8d569b4 5 * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
7fafc032
KS
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
a695feae 22#include "list.h"
33db4b8d 23
8e2229c4 24#define UDEV_MAGIC "udevd_" UDEV_VERSION
1bc33626 25#define UDEVD_SOCK_PATH "/org/kernel/udev/udevd"
a15f42c4
KS
26#define UDEVSEND_WAIT_MAX_SECONDS 3
27#define UDEVSEND_WAIT_LOOP_PER_SECOND 10
085cce37
KS
28
29#define UDEVD_PRIORITY -4
30#define UDEV_PRIORITY -2
31
fc55cf68
KS
32#define EVENT_QUEUE_DIR ".udev/queue"
33#define EVENT_FAILED_DIR ".udev/failed"
7baada47 34#define EVENT_SEQNUM ".udev/uevent_seqnum"
fc55cf68 35
1aa1e248 36/* maximum limit of forked childs */
a15f42c4 37#define UDEVD_MAX_CHILDS 64
085cce37 38/* start to throttle forking if maximum number of running childs in our session is reached */
fc465079 39#define UDEVD_MAX_CHILDS_RUNNING 16
085cce37 40
4a231017 41/* environment buffer, should match the kernel's size in lib/kobject_uevent.h */
7d1e179f
KS
42#define UEVENT_BUFFER_SIZE 2048
43#define UEVENT_NUM_ENVP 64
7fafc032 44
3b47c739
KS
45enum udevd_msg_type {
46 UDEVD_UNKNOWN,
8ab44e3f 47 UDEVD_UEVENT_UDEVSEND,
8ab44e3f 48 UDEVD_UEVENT_NETLINK,
3b47c739
KS
49 UDEVD_STOP_EXEC_QUEUE,
50 UDEVD_START_EXEC_QUEUE,
8ab44e3f
KS
51 UDEVD_SET_LOG_LEVEL,
52 UDEVD_SET_MAX_CHILDS,
c895fd00 53 UDEVD_RELOAD_RULES,
4a231017
KS
54};
55
3b47c739
KS
56
57struct udevd_msg {
58 char magic[32];
59 enum udevd_msg_type type;
60 char envbuf[UEVENT_BUFFER_SIZE+512];
61};
62
63struct uevent_msg {
510de9c9 64 enum udevd_msg_type type;
f8a178a3 65 struct list_head node;
35b7d88c 66 pid_t pid;
f4fc0136 67 int exitstatus;
0b3dfb3d 68 time_t queue_time;
4a231017
KS
69 char *action;
70 char *devpath;
71 char *subsystem;
ebfc1acd 72 dev_t devt;
4a231017 73 unsigned long long seqnum;
79721e0a 74 char *physdevpath;
7f7ae03a 75 unsigned int timeout;
3b47c739 76 char *envp[UEVENT_NUM_ENVP+1];
4a231017 77 char envbuf[];
7fafc032 78};