diff options
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-blkid.c | 9 | ||||
-rw-r--r-- | src/udev/udev-builtin-btrfs.c | 3 | ||||
-rw-r--r-- | src/udev/udev-builtin-firmware.c | 9 | ||||
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 9 | ||||
-rw-r--r-- | src/udev/udev-builtin-input_id.c | 12 | ||||
-rw-r--r-- | src/udev/udev-builtin-kmod.c | 18 | ||||
-rw-r--r-- | src/udev/udev-builtin-path_id.c | 42 | ||||
-rw-r--r-- | src/udev/udev-builtin-uaccess.c | 3 | ||||
-rw-r--r-- | src/udev/udev-builtin-usb_id.c | 15 | ||||
-rw-r--r-- | src/udev/udev-builtin.c | 27 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 90 | ||||
-rw-r--r-- | src/udev/udev-event.c | 21 | ||||
-rw-r--r-- | src/udev/udev-node.c | 15 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 75 | ||||
-rw-r--r-- | src/udev/udev-watch.c | 15 | ||||
-rw-r--r-- | src/udev/udevadm-control.c | 6 | ||||
-rw-r--r-- | src/udev/udevadm-info.c | 30 | ||||
-rw-r--r-- | src/udev/udevadm-monitor.c | 9 | ||||
-rw-r--r-- | src/udev/udevadm-settle.c | 3 | ||||
-rw-r--r-- | src/udev/udevadm-test-builtin.c | 6 | ||||
-rw-r--r-- | src/udev/udevadm-test.c | 3 | ||||
-rw-r--r-- | src/udev/udevadm-trigger.c | 9 | ||||
-rw-r--r-- | src/udev/udevadm.c | 15 | ||||
-rw-r--r-- | src/udev/udevd.c | 63 |
24 files changed, 169 insertions, 338 deletions
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index cf194c00c6..810f27d1d0 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -34,8 +34,7 @@ #include "efivars.h" #include "udev.h" -static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) -{ +static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) { char s[256]; s[0] = '\0'; @@ -182,8 +181,7 @@ static int find_gpt_root(struct udev_device *dev, blkid_probe pr, bool test) { return 0; } -static int probe_superblocks(blkid_probe pr) -{ +static int probe_superblocks(blkid_probe pr) { struct stat st; int rc; @@ -215,8 +213,7 @@ static int probe_superblocks(blkid_probe pr) return blkid_do_safeprobe(pr); } -static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { const char *root_partition; int64_t offset = 0; bool noraid = false; diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c index 2baafe6131..4e80a1d1d1 100644 --- a/src/udev/udev-builtin-btrfs.c +++ b/src/udev/udev-builtin-btrfs.c @@ -35,8 +35,7 @@ struct btrfs_ioctl_vol_args { #define BTRFS_IOCTL_MAGIC 0x94 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, struct btrfs_ioctl_vol_args) -static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool test) { struct btrfs_ioctl_vol_args args; _cleanup_close_ int fd = -1; int err; diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c index 8cfeed663b..bd8c2fb966 100644 --- a/src/udev/udev-builtin-firmware.c +++ b/src/udev/udev-builtin-firmware.c @@ -27,8 +27,7 @@ #include "udev.h" -static bool set_loading(struct udev *udev, char *loadpath, const char *state) -{ +static bool set_loading(struct udev *udev, char *loadpath, const char *state) { FILE *ldfile; ldfile = fopen(loadpath, "we"); @@ -41,8 +40,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state) return true; } -static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) -{ +static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { char *buf; FILE *fsource = NULL, *ftarget = NULL; bool ret = false; @@ -74,8 +72,7 @@ exit: return ret; } -static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); static const char *searchpath[] = { FIRMWARE_PATH }; char loadpath[UTIL_PATH_SIZE]; diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index d6aa96bb3d..cac97e756b 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -183,8 +183,7 @@ static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool te } /* called at udev startup and reload */ -static int builtin_hwdb_init(struct udev *udev) -{ +static int builtin_hwdb_init(struct udev *udev) { if (hwdb) return 0; hwdb = udev_hwdb_new(udev); @@ -194,14 +193,12 @@ static int builtin_hwdb_init(struct udev *udev) } /* called on udev shutdown and reload request */ -static void builtin_hwdb_exit(struct udev *udev) -{ +static void builtin_hwdb_exit(struct udev *udev) { hwdb = udev_hwdb_unref(hwdb); } /* called every couple of seconds during event activity; 'true' if config has changed */ -static bool builtin_hwdb_validate(struct udev *udev) -{ +static bool builtin_hwdb_validate(struct udev *udev) { return udev_hwdb_validate(hwdb); } diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 3b2e8975f5..1a1121ef94 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -47,8 +47,7 @@ static void get_cap_mask(struct udev_device *dev, struct udev_device *pdev, const char* attr, unsigned long *bitmask, size_t bitmask_size, - bool test) -{ + bool test) { char text[4096]; unsigned i; char* word; @@ -96,8 +95,7 @@ static void test_pointers (struct udev_device *dev, const unsigned long* bitmask_abs, const unsigned long* bitmask_key, const unsigned long* bitmask_rel, - bool test) -{ + bool test) { int is_mouse = 0; int is_touchpad = 0; @@ -154,8 +152,7 @@ static void test_pointers (struct udev_device *dev, static void test_key (struct udev_device *dev, const unsigned long* bitmask_ev, const unsigned long* bitmask_key, - bool test) -{ + bool test) { unsigned i; unsigned long found; unsigned long mask; @@ -193,8 +190,7 @@ static void test_key (struct udev_device *dev, udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); } -static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev_device *pdev; unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c index 5880c38842..454ee2edff 100644 --- a/src/udev/udev-builtin-kmod.c +++ b/src/udev/udev-builtin-kmod.c @@ -33,8 +33,7 @@ static struct kmod_ctx *ctx; -static int load_module(struct udev *udev, const char *alias) -{ +static int load_module(struct udev *udev, const char *alias) { struct kmod_list *list = NULL; struct kmod_list *l; int err; @@ -66,13 +65,11 @@ static int load_module(struct udev *udev, const char *alias) _printf_(6,0) static void udev_kmod_log(void *data, int priority, const char *file, int line, - const char *fn, const char *format, va_list args) -{ + const char *fn, const char *format, va_list args) { udev_main_log(data, priority, file, line, fn, format, args); } -static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); int i; @@ -93,8 +90,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te } /* called at udev startup and reload */ -static int builtin_kmod_init(struct udev *udev) -{ +static int builtin_kmod_init(struct udev *udev) { if (ctx) return 0; @@ -109,15 +105,13 @@ static int builtin_kmod_init(struct udev *udev) } /* called on udev shutdown and reload request */ -static void builtin_kmod_exit(struct udev *udev) -{ +static void builtin_kmod_exit(struct udev *udev) { log_debug("unload module index"); ctx = kmod_unref(ctx); } /* called every couple of seconds during event activity; 'true' if config has changed */ -static bool builtin_kmod_validate(struct udev *udev) -{ +static bool builtin_kmod_validate(struct udev *udev) { log_debug("validate module index"); if (!ctx) return false; diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index 3ca59e0113..ac0f71f83e 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -33,8 +33,7 @@ #include "udev.h" _printf_(2,3) -static int path_prepend(char **path, const char *fmt, ...) -{ +static int path_prepend(char **path, const char *fmt, ...) { va_list va; char *pre; int err = 0; @@ -65,8 +64,7 @@ out: ** Linux only supports 32 bit luns. ** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. */ -static int format_lun_number(struct udev_device *dev, char **path) -{ +static int format_lun_number(struct udev_device *dev, char **path) { unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); /* address method 0, peripheral device addressing with bus id of zero */ @@ -76,8 +74,7 @@ static int format_lun_number(struct udev_device *dev, char **path) return path_prepend(path, "lun-0x%04lx%04lx00000000", lun & 0xffff, (lun >> 16) & 0xffff); } -static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) -{ +static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) { struct udev_device *parent = dev; while (parent != NULL) { @@ -92,8 +89,7 @@ static struct udev_device *skip_subsystem(struct udev_device *dev, const char *s return dev; } -static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); struct udev_device *targetdev; struct udev_device *fcdev = NULL; @@ -122,8 +118,7 @@ out: return parent; } -static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); struct udev_device *targetdev; struct udev_device *target_parent; @@ -159,8 +154,7 @@ out: return parent; } -static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); struct udev_device *transportdev; struct udev_device *sessiondev = NULL; @@ -218,8 +212,7 @@ out: return parent; } -static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) { struct udev_device *hostdev; int host, bus, target, lun; const char *name; @@ -339,8 +332,7 @@ static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char * return parent; } -static struct udev_device *handle_scsi(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_scsi(struct udev_device *parent, char **path) { const char *devtype; const char *name; const char *id; @@ -401,8 +393,7 @@ out: return parent; } -static struct udev_device *handle_cciss(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_cciss(struct udev_device *parent, char **path) { const char *str; unsigned int controller, disk; @@ -415,8 +406,7 @@ static struct udev_device *handle_cciss(struct udev_device *parent, char **path) return parent; } -static void handle_scsi_tape(struct udev_device *dev, char **path) -{ +static void handle_scsi_tape(struct udev_device *dev, char **path) { const char *name; /* must be the last device in the syspath */ @@ -430,8 +420,7 @@ static void handle_scsi_tape(struct udev_device *dev, char **path) path_prepend(path, "st%c", name[2]); } -static struct udev_device *handle_usb(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_usb(struct udev_device *parent, char **path) { const char *devtype; const char *str; const char *port; @@ -453,8 +442,7 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) return parent; } -static struct udev_device *handle_bcma(struct udev_device *parent, char **path) -{ +static struct udev_device *handle_bcma(struct udev_device *parent, char **path) { const char *sysname; unsigned int core; @@ -466,8 +454,7 @@ static struct udev_device *handle_bcma(struct udev_device *parent, char **path) return parent; } -static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) -{ +static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) { struct udev_device *scsi_dev; scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); @@ -491,8 +478,7 @@ out: return parent; } -static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev_device *parent; char *path = NULL; bool some_transport = false; diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c index ddb015744f..e2b276eb4d 100644 --- a/src/udev/udev-builtin-uaccess.c +++ b/src/udev/udev-builtin-uaccess.c @@ -34,8 +34,7 @@ #include "udev.h" #include "util.h" -static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool test) { int r; const char *path = NULL, *seat; bool changed_acl = false; diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index 883e11eb07..06d4191584 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -31,8 +31,7 @@ #include "udev.h" -static void set_usb_iftype(char *to, int if_class_num, size_t len) -{ +static void set_usb_iftype(char *to, int if_class_num, size_t len) { const char *type = "generic"; switch (if_class_num) { @@ -82,8 +81,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) to[len-1] = '\0'; } -static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) -{ +static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) { int type_num = 0; char *eptr; const char *type = "generic"; @@ -114,8 +112,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len return type_num; } -static void set_scsi_type(char *to, const char *from, size_t len) -{ +static void set_scsi_type(char *to, const char *from, size_t len) { int type_num; char *eptr; const char *type = "generic"; @@ -148,8 +145,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) #define USB_DT_DEVICE 0x01 #define USB_DT_INTERFACE 0x04 -static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) -{ +static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) { _cleanup_free_ char *filename = NULL; _cleanup_close_ int fd = -1; ssize_t size; @@ -232,8 +228,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ +static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) { char vendor_str[64]; char vendor_str_enc[256]; const char *vendor_id; diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index fd373d04dc..05a272646b 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -52,8 +52,7 @@ static const struct udev_builtin *builtins[] = { #endif }; -void udev_builtin_init(struct udev *udev) -{ +void udev_builtin_init(struct udev *udev) { unsigned int i; if (initialized) @@ -66,8 +65,7 @@ void udev_builtin_init(struct udev *udev) initialized = true; } -void udev_builtin_exit(struct udev *udev) -{ +void udev_builtin_exit(struct udev *udev) { unsigned int i; if (!initialized) @@ -80,8 +78,7 @@ void udev_builtin_exit(struct udev *udev) initialized = false; } -bool udev_builtin_validate(struct udev *udev) -{ +bool udev_builtin_validate(struct udev *udev) { unsigned int i; for (i = 0; i < ELEMENTSOF(builtins); i++) @@ -90,26 +87,22 @@ bool udev_builtin_validate(struct udev *udev) return false; } -void udev_builtin_list(struct udev *udev) -{ +void udev_builtin_list(struct udev *udev) { unsigned int i; for (i = 0; i < ELEMENTSOF(builtins); i++) fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); } -const char *udev_builtin_name(enum udev_builtin_cmd cmd) -{ +const char *udev_builtin_name(enum udev_builtin_cmd cmd) { return builtins[cmd]->name; } -bool udev_builtin_run_once(enum udev_builtin_cmd cmd) -{ +bool udev_builtin_run_once(enum udev_builtin_cmd cmd) { return builtins[cmd]->run_once; } -enum udev_builtin_cmd udev_builtin_lookup(const char *command) -{ +enum udev_builtin_cmd udev_builtin_lookup(const char *command) { char name[UTIL_PATH_SIZE]; enum udev_builtin_cmd i; char *pos; @@ -124,8 +117,7 @@ enum udev_builtin_cmd udev_builtin_lookup(const char *command) return UDEV_BUILTIN_MAX; } -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) -{ +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) { char arg[UTIL_PATH_SIZE]; int argc; char *argv[128]; @@ -137,8 +129,7 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c return builtins[cmd]->cmd(dev, argc, argv, test); } -int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) -{ +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) { struct udev_list_entry *entry; entry = udev_device_add_property(dev, key, val); diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 74bbd3a99e..6fb5bb4a7a 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -70,8 +70,7 @@ struct udev_ctrl_connection { int sock; }; -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) -{ +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) { struct udev_ctrl *uctrl; const int on = 1; @@ -100,13 +99,11 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) return uctrl; } -struct udev_ctrl *udev_ctrl_new(struct udev *udev) -{ +struct udev_ctrl *udev_ctrl_new(struct udev *udev) { return udev_ctrl_new_from_fd(udev, -1); } -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { int err; if (!uctrl->bound) { @@ -135,21 +132,18 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) return 0; } -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) { return uctrl->udev; } -static struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ +static struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) { if (uctrl == NULL) return NULL; uctrl->refcount++; return uctrl; } -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) -{ +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) { if (uctrl == NULL) return NULL; uctrl->refcount--; @@ -161,8 +155,7 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) return NULL; } -int udev_ctrl_cleanup(struct udev_ctrl *uctrl) -{ +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) { if (uctrl == NULL) return 0; if (uctrl->cleanup_socket) @@ -170,15 +163,13 @@ int udev_ctrl_cleanup(struct udev_ctrl *uctrl) return 0; } -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { if (uctrl == NULL) return -EINVAL; return uctrl->sock; } -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) -{ +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { struct udev_ctrl_connection *conn; struct ucred ucred = {}; const int on = 1; @@ -219,16 +210,14 @@ err: return NULL; } -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) { if (conn == NULL) return NULL; conn->refcount++; return conn; } -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) { if (conn == NULL) return NULL; conn->refcount--; @@ -241,8 +230,7 @@ struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connect return NULL; } -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) -{ +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) { struct udev_ctrl_msg_wire ctrl_msg_wire; int err = 0; @@ -296,48 +284,39 @@ out: return err; } -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) -{ +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); } -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); } -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) -{ +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); } -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) -{ +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); } -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); } -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); } -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { struct udev_ctrl_msg *uctrl_msg; ssize_t size; struct cmsghdr *cmsg; @@ -416,8 +395,7 @@ err: return NULL; } -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg == NULL) return NULL; ctrl_msg->refcount--; @@ -428,57 +406,49 @@ struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) return NULL; } -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) return ctrl_msg->ctrl_msg_wire.intval; return -1; } -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) return 1; return -1; } -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) return 1; return -1; } -int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) return 1; return -1; } -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) return ctrl_msg->ctrl_msg_wire.buf; return NULL; } -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) return ctrl_msg->ctrl_msg_wire.intval; return -1; } -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) return 1; return -1; } -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) return 1; return -1; diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 6ad80d51aa..00cd6d47db 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -34,8 +34,7 @@ #include "udev.h" #include "rtnl-util.h" -struct udev_event *udev_event_new(struct udev_device *dev) -{ +struct udev_event *udev_event_new(struct udev_device *dev) { struct udev *udev = udev_device_get_udev(dev); struct udev_event *event; @@ -51,8 +50,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) return event; } -void udev_event_unref(struct udev_event *event) -{ +void udev_event_unref(struct udev_event *event) { if (event == NULL) return; udev_list_cleanup(&event->run_list); @@ -62,8 +60,7 @@ void udev_event_unref(struct udev_event *event) free(event); } -size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) -{ +size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) { struct udev_device *dev = event->dev; enum subst_type { SUBST_UNKNOWN, @@ -377,8 +374,7 @@ out: static int spawn_exec(struct udev_event *event, const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, - int fd_stdout, int fd_stderr) -{ + int fd_stdout, int fd_stderr) { int err; int fd; @@ -424,8 +420,7 @@ static void spawn_read(struct udev_event *event, usec_t timeout_usec, const char *cmd, int fd_stdout, int fd_stderr, - char *result, size_t ressize) -{ + char *result, size_t ressize) { size_t respos = 0; int fd_ep = -1; struct epoll_event ep_outpipe, ep_errpipe; @@ -623,8 +618,7 @@ out: return err; } -int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) -{ +int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) { int i = 0; char *pos; @@ -750,8 +744,7 @@ out: return err; } -static int rename_netif(struct udev_event *event) -{ +static int rename_netif(struct udev_event *event) { struct udev_device *dev = event->dev; _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL; char name[IFNAMSIZ]; diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 200e24fb41..d42af9a6d2 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -32,8 +32,7 @@ #include "udev.h" #include "smack-util.h" -static int node_symlink(struct udev_device *dev, const char *node, const char *slink) -{ +static int node_symlink(struct udev_device *dev, const char *node, const char *slink) { struct stat stats; char target[UTIL_PATH_SIZE]; char *s; @@ -126,8 +125,7 @@ exit: } /* find device node of device with highest priority */ -static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) -{ +static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) { struct udev *udev = udev_device_get_udev(dev); DIR *dir; int priority = 0; @@ -180,8 +178,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons } /* manage "stack of names" with possibly specified device priorities */ -static void link_update(struct udev_device *dev, const char *slink, bool add) -{ +static void link_update(struct udev_device *dev, const char *slink, bool add) { struct udev *udev = udev_device_get_udev(dev); char name_enc[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE * 2]; @@ -224,8 +221,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) } } -void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) -{ +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) { struct udev_list_entry *list_entry; /* update possible left-over symlinks */ @@ -353,8 +349,7 @@ void udev_node_add(struct udev_device *dev, bool apply, link_update(dev, udev_list_entry_get_name(list_entry), true); } -void udev_node_remove(struct udev_device *dev) -{ +void udev_node_remove(struct udev_device *dev) { struct udev_list_entry *list_entry; char filename[UTIL_PATH_SIZE]; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index aacde38da9..59bc124985 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -216,8 +216,7 @@ struct rule_tmp { }; #ifdef DEBUG -static const char *operation_str(enum operation_type type) -{ +static const char *operation_str(enum operation_type type) { static const char *operation_strs[] = { [OP_UNSET] = "UNSET", [OP_MATCH] = "match", @@ -232,8 +231,7 @@ static const char *operation_str(enum operation_type type) return operation_strs[type]; } -static const char *string_glob_str(enum string_glob_type type) -{ +static const char *string_glob_str(enum string_glob_type type) { static const char *string_glob_strs[] = { [GL_UNSET] = "UNSET", [GL_PLAIN] = "plain", @@ -246,8 +244,7 @@ static const char *string_glob_str(enum string_glob_type type) return string_glob_strs[type]; } -static const char *token_str(enum token_type type) -{ +static const char *token_str(enum token_type type) { static const char *token_strs[] = { [TK_UNSET] = "UNSET", [TK_RULE] = "RULE", @@ -311,8 +308,7 @@ static const char *token_str(enum token_type type) return token_strs[type]; } -static void dump_token(struct udev_rules *rules, struct token *token) -{ +static void dump_token(struct udev_rules *rules, struct token *token) { enum token_type type = token->type; enum operation_type op = token->key.op; enum string_glob_type glob = token->key.glob; @@ -421,8 +417,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) } } -static void dump_rules(struct udev_rules *rules) -{ +static void dump_rules(struct udev_rules *rules) { unsigned int i; log_debug("dumping %u (%zu bytes) tokens, %u (%zu bytes) strings", @@ -438,8 +433,7 @@ static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_rules(struct udev_rules *rules) {} #endif /* DEBUG */ -static int add_token(struct udev_rules *rules, struct token *token) -{ +static int add_token(struct udev_rules *rules, struct token *token) { /* grow buffer if needed */ if (rules->token_cur+1 >= rules->token_max) { struct token *tokens; @@ -461,8 +455,7 @@ static int add_token(struct udev_rules *rules, struct token *token) return 0; } -static uid_t add_uid(struct udev_rules *rules, const char *owner) -{ +static uid_t add_uid(struct udev_rules *rules, const char *owner) { unsigned int i; uid_t uid; unsigned int off; @@ -502,8 +495,7 @@ static uid_t add_uid(struct udev_rules *rules, const char *owner) return uid; } -static gid_t add_gid(struct udev_rules *rules, const char *group) -{ +static gid_t add_gid(struct udev_rules *rules, const char *group) { unsigned int i; gid_t gid; unsigned int off; @@ -543,8 +535,7 @@ static gid_t add_gid(struct udev_rules *rules, const char *group) return gid; } -static int import_property_from_string(struct udev_device *dev, char *line) -{ +static int import_property_from_string(struct udev_device *dev, char *line) { char *key; char *val; size_t len; @@ -607,8 +598,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) return 0; } -static int import_file_into_properties(struct udev_device *dev, const char *filename) -{ +static int import_file_into_properties(struct udev_device *dev, const char *filename) { FILE *f; char line[UTIL_LINE_SIZE]; @@ -650,8 +640,7 @@ static int import_program_into_properties(struct udev_event *event, return 0; } -static int import_parent_into_properties(struct udev_device *dev, const char *filter) -{ +static int import_parent_into_properties(struct udev_device *dev, const char *filter) { struct udev_device *dev_parent; struct udev_list_entry *list_entry; @@ -676,8 +665,7 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi } #define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udev_device *dev, const char *file, int timeout) -{ +static int wait_for_file(struct udev_device *dev, const char *file, int timeout) { char filepath[UTIL_PATH_SIZE]; char devicepath[UTIL_PATH_SIZE]; struct stat stats; @@ -711,8 +699,7 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) return -1; } -static int attr_subst_subdir(char *attr, size_t len) -{ +static int attr_subst_subdir(char *attr, size_t len) { bool found = false; if (strstr(attr, "/*/")) { @@ -749,8 +736,7 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) -{ +static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) { char *linepos; char *temp; @@ -837,8 +823,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty } /* extract possible KEY{attr} */ -static const char *get_key_attribute(struct udev *udev, char *str) -{ +static const char *get_key_attribute(struct udev *udev, char *str) { char *pos; char *attr; @@ -858,8 +843,7 @@ static const char *get_key_attribute(struct udev *udev, char *str) static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, enum operation_type op, - const char *value, const void *data) -{ + const char *value, const void *data) { struct token *token = &rule_tmp->token[rule_tmp->token_cur]; const char *attr = NULL; @@ -1000,8 +984,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, return 0; } -static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) -{ +static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) { unsigned int i; unsigned int start = 0; unsigned int end = rule_tmp->token_cur; @@ -1036,8 +1019,7 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) } static int add_rule(struct udev_rules *rules, char *line, - const char *filename, unsigned int filename_off, unsigned int lineno) -{ + const char *filename, unsigned int filename_off, unsigned int lineno) { char *linepos; const char *attr; struct rule_tmp rule_tmp; @@ -1508,8 +1490,7 @@ invalid: return -1; } -static int parse_file(struct udev_rules *rules, const char *filename) -{ +static int parse_file(struct udev_rules *rules, const char *filename) { FILE *f; unsigned int first_token; unsigned int filename_off; @@ -1593,8 +1574,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) return 0; } -struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) -{ +struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; struct udev_list file_list; struct token end_token; @@ -1664,8 +1644,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) return rules; } -struct udev_rules *udev_rules_unref(struct udev_rules *rules) -{ +struct udev_rules *udev_rules_unref(struct udev_rules *rules) { if (rules == NULL) return NULL; free(rules->tokens); @@ -1676,16 +1655,14 @@ struct udev_rules *udev_rules_unref(struct udev_rules *rules) return NULL; } -bool udev_rules_check_timestamp(struct udev_rules *rules) -{ +bool udev_rules_check_timestamp(struct udev_rules *rules) { if (!rules) return false; return paths_check_timestamp(rules_dirs, &rules->dirs_ts_usec, true); } -static int match_key(struct udev_rules *rules, struct token *token, const char *val) -{ +static int match_key(struct udev_rules *rules, struct token *token, const char *val) { char *key_value = rules_str(rules, token->key.value_off); char *pos; bool match = false; @@ -1758,8 +1735,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * return -1; } -static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) -{ +static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) { const char *name; char nbuf[UTIL_NAME_SIZE]; const char *value; @@ -2485,8 +2461,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, } } -int udev_rules_apply_static_dev_perms(struct udev_rules *rules) -{ +int udev_rules_apply_static_dev_perms(struct udev_rules *rules) { struct token *cur; struct token *rule; uid_t uid = 0; diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index cbe0c37a4f..061bd05875 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -36,8 +36,7 @@ static int inotify_fd = -1; * set to cloexec since we need our children to be able to add * watches for us */ -int udev_watch_init(struct udev *udev) -{ +int udev_watch_init(struct udev *udev) { inotify_fd = inotify_init1(IN_CLOEXEC); if (inotify_fd < 0) log_error("inotify_init failed: %m"); @@ -47,8 +46,7 @@ int udev_watch_init(struct udev *udev) /* move any old watches directory out of the way, and then restore * the watches */ -void udev_watch_restore(struct udev *udev) -{ +void udev_watch_restore(struct udev *udev) { if (inotify_fd < 0) return; @@ -94,8 +92,7 @@ unlink: } } -void udev_watch_begin(struct udev *udev, struct udev_device *dev) -{ +void udev_watch_begin(struct udev *udev, struct udev_device *dev) { char filename[UTIL_PATH_SIZE]; int wd; int r; @@ -121,8 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) udev_device_set_watch_handle(dev, wd); } -void udev_watch_end(struct udev *udev, struct udev_device *dev) -{ +void udev_watch_end(struct udev *udev, struct udev_device *dev) { int wd; char filename[UTIL_PATH_SIZE]; @@ -142,8 +138,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) udev_device_set_watch_handle(dev, -1); } -struct udev_device *udev_watch_lookup(struct udev *udev, int wd) -{ +struct udev_device *udev_watch_lookup(struct udev *udev, int wd) { char filename[UTIL_PATH_SIZE]; char device[UTIL_NAME_SIZE]; ssize_t len; diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c index 3a6c8ef4fe..6e3bc2ae98 100644 --- a/src/udev/udevadm-control.c +++ b/src/udev/udevadm-control.c @@ -28,8 +28,7 @@ #include "udev.h" #include "udev-util.h" -static void print_help(void) -{ +static void print_help(void) { printf("Usage: udevadm control COMMAND\n" " -e,--exit instruct the daemon to cleanup and exit\n" " -l,--log-priority=LEVEL set the udev log level for the daemon\n" @@ -42,8 +41,7 @@ static void print_help(void) " -h,--help print this help text\n\n"); } -static int adm_control(struct udev *udev, int argc, char *argv[]) -{ +static int adm_control(struct udev *udev, int argc, char *argv[]) { _cleanup_udev_ctrl_unref_ struct udev_ctrl *uctrl = NULL; int timeout = 60; int rc = 1, c; diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index 8145e6f50c..22d0826011 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -32,8 +32,7 @@ #include "udev.h" #include "udev-util.h" -static bool skip_attribute(const char *name) -{ +static bool skip_attribute(const char *name) { static const char* const skip[] = { "uevent", "dev", @@ -51,8 +50,7 @@ static bool skip_attribute(const char *name) return false; } -static void print_all_attributes(struct udev_device *device, const char *key) -{ +static void print_all_attributes(struct udev_device *device, const char *key) { struct udev_list_entry *sysattr; udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { @@ -84,8 +82,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) printf("\n"); } -static int print_device_chain(struct udev_device *device) -{ +static int print_device_chain(struct udev_device *device) { struct udev_device *device_parent; const char *str; @@ -130,8 +127,7 @@ static int print_device_chain(struct udev_device *device) return 0; } -static void print_record(struct udev_device *device) -{ +static void print_record(struct udev_device *device) { const char *str; int i; struct udev_list_entry *list_entry; @@ -156,8 +152,7 @@ static void print_record(struct udev_device *device) printf("\n"); } -static int stat_device(const char *name, bool export, const char *prefix) -{ +static int stat_device(const char *name, bool export, const char *prefix) { struct stat statbuf; if (stat(name, &statbuf) != 0) @@ -175,8 +170,7 @@ static int stat_device(const char *name, bool export, const char *prefix) return 0; } -static int export_devices(struct udev *udev) -{ +static int export_devices(struct udev *udev) { struct udev_enumerate *udev_enumerate; struct udev_list_entry *list_entry; @@ -197,8 +191,7 @@ static int export_devices(struct udev *udev) return 0; } -static void cleanup_dir(DIR *dir, mode_t mask, int depth) -{ +static void cleanup_dir(DIR *dir, mode_t mask, int depth) { struct dirent *dent; if (depth <= 0) @@ -228,8 +221,7 @@ static void cleanup_dir(DIR *dir, mode_t mask, int depth) } } -static void cleanup_db(struct udev *udev) -{ +static void cleanup_db(struct udev *udev) { DIR *dir; unlink("/run/udev/queue.bin"); @@ -265,8 +257,7 @@ static void cleanup_db(struct udev *udev) } } -static struct udev_device *find_device(struct udev *udev, const char *id, const char *prefix) -{ +static struct udev_device *find_device(struct udev *udev, const char *id, const char *prefix) { char name[UTIL_PATH_SIZE]; if (prefix && !startswith(id, prefix)) { @@ -295,8 +286,7 @@ static struct udev_device *find_device(struct udev *udev, const char *id, const return NULL; } -static int uinfo(struct udev *udev, int argc, char *argv[]) -{ +static int uinfo(struct udev *udev, int argc, char *argv[]) { _cleanup_udev_device_unref_ struct udev_device *device = NULL; bool root = 0; bool export = 0; diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index a54aa82c73..e776fb99dc 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -37,14 +37,12 @@ static bool udev_exit; -static void sig_handler(int signum) -{ +static void sig_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) udev_exit = true; } -static void print_device(struct udev_device *device, const char *source, int prop) -{ +static void print_device(struct udev_device *device, const char *source, int prop) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); @@ -75,8 +73,7 @@ static void help(void) { " -h,--help\n\n"); } -static int adm_monitor(struct udev *udev, int argc, char *argv[]) -{ +static int adm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act = {}; sigset_t mask; bool prop = false; diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c index fa5b0c2d2e..fae8b4c6b3 100644 --- a/src/udev/udevadm-settle.c +++ b/src/udev/udevadm-settle.c @@ -44,8 +44,7 @@ static void help(void) { " -h,--help\n\n"); } -static int adm_settle(struct udev *udev, int argc, char *argv[]) -{ +static int adm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "seq-start", required_argument, NULL, '\0' }, /* removed */ { "seq-end", required_argument, NULL, '\0' }, /* removed */ diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index 80418783ff..179f269693 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -34,16 +34,14 @@ #include "udev.h" -static void help(struct udev *udev) -{ +static void help(struct udev *udev) { fprintf(stderr, "\n"); fprintf(stderr, "Usage: udevadm builtin [--help] COMMAND SYSPATH\n"); udev_builtin_list(udev); fprintf(stderr, "\n"); } -static int adm_builtin(struct udev *udev, int argc, char *argv[]) -{ +static int adm_builtin(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "help", no_argument, NULL, 'h' }, {} diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index 52cc26c1d6..0f6cccffb5 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -32,8 +32,7 @@ #include "udev.h" #include "udev-util.h" -static int adm_test(struct udev *udev, int argc, char *argv[]) -{ +static int adm_test(struct udev *udev, int argc, char *argv[]) { int resolve_names = 1; char filename[UTIL_PATH_SIZE]; const char *action = "add"; diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index 0ee27bb408..668791b7a0 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -38,8 +38,7 @@ static int verbose; static int dry_run; -static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) -{ +static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) { struct udev_list_entry *entry; udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { @@ -60,8 +59,7 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) } } -static const char *keyval(const char *str, const char **val, char *buf, size_t size) -{ +static const char *keyval(const char *str, const char **val, char *buf, size_t size) { char *pos; strscpy(buf, size,str); @@ -93,8 +91,7 @@ static void help(void) { " -h,--help\n\n"); } -static int adm_trigger(struct udev *udev, int argc, char *argv[]) -{ +static int adm_trigger(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "verbose", no_argument, NULL, 'v' }, { "dry-run", no_argument, NULL, 'n' }, diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index dbca369011..1c06c1aacd 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -27,13 +27,11 @@ void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ + const char *format, va_list args) { log_metav(priority, file, line, fn, format, args); } -static int adm_version(struct udev *udev, int argc, char *argv[]) -{ +static int adm_version(struct udev *udev, int argc, char *argv[]) { printf("%s\n", VERSION); return 0; } @@ -63,8 +61,7 @@ static const struct udevadm_cmd *udevadm_cmds[] = { &udevadm_help, }; -static int adm_help(struct udev *udev, int argc, char *argv[]) -{ +static int adm_help(struct udev *udev, int argc, char *argv[]) { unsigned int i; fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); @@ -75,16 +72,14 @@ static int adm_help(struct udev *udev, int argc, char *argv[]) return 0; } -static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) -{ +static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) { if (cmd->debug) log_set_max_level(LOG_DEBUG); log_debug("calling: %s", cmd->name); return cmd->cmd(udev, argc, argv); } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { { "debug", no_argument, NULL, 'd' }, diff --git a/src/udev/udevd.c b/src/udev/udevd.c index dee7a87647..b75145eebf 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -57,8 +57,7 @@ static bool debug; void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ + const char *format, va_list args) { log_metav(priority, file, line, fn, format, args); } @@ -106,8 +105,7 @@ struct event { #endif }; -static inline struct event *node_to_event(struct udev_list_node *node) -{ +static inline struct event *node_to_event(struct udev_list_node *node) { return container_of(node, struct event, node); } @@ -137,34 +135,29 @@ struct worker_message { int exitcode; }; -static inline struct worker *node_to_worker(struct udev_list_node *node) -{ +static inline struct worker *node_to_worker(struct udev_list_node *node) { return container_of(node, struct worker, node); } -static void event_queue_delete(struct event *event) -{ +static void event_queue_delete(struct event *event) { udev_list_node_remove(&event->node); udev_device_unref(event->dev); free(event); } -static struct worker *worker_ref(struct worker *worker) -{ +static struct worker *worker_ref(struct worker *worker) { worker->refcount++; return worker; } -static void worker_cleanup(struct worker *worker) -{ +static void worker_cleanup(struct worker *worker) { udev_list_node_remove(&worker->node); udev_monitor_unref(worker->monitor); children--; free(worker); } -static void worker_unref(struct worker *worker) -{ +static void worker_unref(struct worker *worker) { worker->refcount--; if (worker->refcount > 0) return; @@ -172,8 +165,7 @@ static void worker_unref(struct worker *worker) worker_cleanup(worker); } -static void worker_list_cleanup(struct udev *udev) -{ +static void worker_list_cleanup(struct udev *udev) { struct udev_list_node *loop, *tmp; udev_list_node_foreach_safe(loop, tmp, &worker_list) { @@ -183,8 +175,7 @@ static void worker_list_cleanup(struct udev *udev) } } -static void worker_new(struct event *event) -{ +static void worker_new(struct event *event) { struct udev *udev = event->udev; struct worker *worker; struct udev_monitor *worker_monitor; @@ -416,8 +407,7 @@ out: } } -static void event_run(struct event *event) -{ +static void event_run(struct event *event) { struct udev_list_node *loop; udev_list_node_foreach(loop, &worker_list) { @@ -452,8 +442,7 @@ static void event_run(struct event *event) worker_new(event); } -static int event_queue_insert(struct udev_device *dev) -{ +static int event_queue_insert(struct udev_device *dev) { struct event *event; event = new0(struct event, 1); @@ -482,8 +471,7 @@ static int event_queue_insert(struct udev_device *dev) return 0; } -static void worker_kill(struct udev *udev) -{ +static void worker_kill(struct udev *udev) { struct udev_list_node *loop; udev_list_node_foreach(loop, &worker_list) { @@ -498,8 +486,7 @@ static void worker_kill(struct udev *udev) } /* lookup event for identical, parent, child device */ -static bool is_devpath_busy(struct event *event) -{ +static bool is_devpath_busy(struct event *event) { struct udev_list_node *loop; size_t common; @@ -576,8 +563,7 @@ static bool is_devpath_busy(struct event *event) return false; } -static void event_queue_start(struct udev *udev) -{ +static void event_queue_start(struct udev *udev) { struct udev_list_node *loop; udev_list_node_foreach(loop, &event_list) { @@ -594,8 +580,7 @@ static void event_queue_start(struct udev *udev) } } -static void event_queue_cleanup(struct udev *udev, enum event_state match_type) -{ +static void event_queue_cleanup(struct udev *udev, enum event_state match_type) { struct udev_list_node *loop, *tmp; udev_list_node_foreach_safe(loop, tmp, &event_list) { @@ -608,8 +593,7 @@ static void event_queue_cleanup(struct udev *udev, enum event_state match_type) } } -static void worker_returned(int fd_worker) -{ +static void worker_returned(int fd_worker) { for (;;) { struct worker_message msg; ssize_t size; @@ -641,8 +625,7 @@ static void worker_returned(int fd_worker) } /* receive the udevd message from userspace */ -static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) -{ +static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) { struct udev *udev = udev_ctrl_get_udev(uctrl); struct udev_ctrl_connection *ctrl_conn; struct udev_ctrl_msg *ctrl_msg = NULL; @@ -831,8 +814,7 @@ static int synthesize_change(struct udev_device *dev) { return 0; } -static int handle_inotify(struct udev *udev) -{ +static int handle_inotify(struct udev *udev) { int nbytes, pos; char *buf; struct inotify_event *ev; @@ -871,8 +853,7 @@ static int handle_inotify(struct udev *udev) return 0; } -static void handle_signal(struct udev *udev, int signo) -{ +static void handle_signal(struct udev *udev, int signo) { switch (signo) { case SIGINT: case SIGTERM: @@ -932,8 +913,7 @@ static void handle_signal(struct udev *udev, int signo) } } -static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) -{ +static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) { int ctrl = -1, netlink = -1; int fd, n; @@ -974,8 +954,7 @@ static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) * udev.children-max=<number of workers> events are fully serialized if set to 1 * udev.exec-delay=<number of seconds> delay execution of every executed program */ -static void kernel_cmdline_options(struct udev *udev) -{ +static void kernel_cmdline_options(struct udev *udev) { _cleanup_free_ char *line = NULL; char *w, *state; size_t l; |