* Type-independent Stuff
*/
-static const char *dmi_string(const struct dmi_header *dm, uint8_t s) {
+static const char* dmi_string(const struct dmi_header *dm, uint8_t s) {
const char *bp = (const char *) dm->data;
if (s == 0)
return !stats_by_path_equal(ctx->stats_by_path, stats_by_path);
}
-Link *link_free(Link *link) {
+Link* link_free(Link *link) {
if (!link)
return NULL;
bool link_config_should_reload(LinkConfigContext *ctx);
int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, sd_device *device_db_clone, Link **ret);
-Link *link_free(Link *link);
+Link* link_free(Link *link);
DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
int link_get_config(LinkConfigContext *ctx, Link *link);
return n;
}
-static const char *modalias_usb(sd_device *dev, char *s, size_t size) {
+static const char* modalias_usb(sd_device *dev, char *s, size_t size) {
const char *v, *p, *n = NULL;
uint16_t vn, pn;
{ "lookup-prefix", required_argument, NULL, 'p' },
{}
};
- const char *filter = NULL;
- const char *device = NULL;
- const char *subsystem = NULL;
- const char *prefix = NULL;
+ const char *filter = NULL, *device = NULL, *subsystem = NULL, *prefix = NULL;
_cleanup_(sd_device_unrefp) sd_device *srcdev = NULL;
sd_device *dev = ASSERT_PTR(ASSERT_PTR(event)->dev);
int r;
*/
static void get_cap_mask(
sd_device *pdev,
- const char* attr,
+ const char *attr,
unsigned long *bitmask,
size_t bitmask_size,
EventMode mode) {
const char *v;
- char text[4096];
+ char text[4096], *word;
unsigned i;
- char* word;
unsigned long val;
int r;
static bool test_pointers(
sd_device *dev,
const struct input_id *id,
- const unsigned long* bitmask_ev,
- const unsigned long* bitmask_abs,
- const unsigned long* bitmask_key,
- const unsigned long* bitmask_rel,
- const unsigned long* bitmask_props,
+ const unsigned long *bitmask_ev,
+ const unsigned long *bitmask_abs,
+ const unsigned long *bitmask_key,
+ const unsigned long *bitmask_rel,
+ const unsigned long *bitmask_props,
EventMode mode) {
- bool has_abs_coordinates = false;
- bool has_rel_coordinates = false;
- bool has_mt_coordinates = false;
- size_t num_joystick_axes = 0;
- size_t num_joystick_buttons = 0;
- bool has_pad_buttons = false;
- bool is_direct = false;
- bool has_touch = false;
- bool has_3d_coordinates = false;
- bool has_keys = false;
- bool has_stylus = false;
- bool has_pen = false;
- bool finger_but_no_pen = false;
- bool has_mouse_button = false;
- bool is_mouse = false;
- bool is_abs_mouse = false;
- bool is_touchpad = false;
- bool is_touchscreen = false;
- bool is_tablet = false;
- bool is_tablet_pad = false;
- bool is_joystick = false;
- bool is_accelerometer = false;
- bool is_pointing_stick = false;
- bool has_wheel = false;
+ size_t num_joystick_axes = 0, num_joystick_buttons = 0;
+ bool has_abs_coordinates = false,
+ has_rel_coordinates = false,
+ has_mt_coordinates = false,
+ has_pad_buttons = false,
+ is_direct = false,
+ has_touch = false,
+ has_3d_coordinates = false,
+ has_keys = false,
+ has_stylus = false,
+ has_pen = false,
+ finger_but_no_pen = false,
+ has_mouse_button = false,
+ is_mouse = false,
+ is_abs_mouse = false,
+ is_touchpad = false,
+ is_touchscreen = false,
+ is_tablet = false,
+ is_tablet_pad = false,
+ is_joystick = false,
+ is_accelerometer = false,
+ is_pointing_stick = false,
+ has_wheel = false;
has_keys = test_bit(EV_KEY, bitmask_ev);
has_abs_coordinates = test_bit(ABS_X, bitmask_abs) && test_bit(ABS_Y, bitmask_abs);
/* key like devices */
static bool test_key(
sd_device *dev,
- const unsigned long* bitmask_ev,
- const unsigned long* bitmask_key,
+ const unsigned long *bitmask_ev,
+ const unsigned long *bitmask_key,
EventMode mode) {
bool found = false;
static int builtin_input_id(UdevEvent *event, int argc, char *argv[]) {
sd_device *pdev, *dev = ASSERT_PTR(ASSERT_PTR(event)->dev);
- unsigned long bitmask_ev[NBITS(EV_MAX)];
- unsigned long bitmask_abs[NBITS(ABS_MAX)];
- unsigned long bitmask_key[NBITS(KEY_MAX)];
- unsigned long bitmask_rel[NBITS(REL_MAX)];
- unsigned long bitmask_props[NBITS(INPUT_PROP_MAX)];
+ unsigned long bitmask_ev[NBITS(EV_MAX)],
+ bitmask_abs[NBITS(ABS_MAX)],
+ bitmask_key[NBITS(KEY_MAX)],
+ bitmask_rel[NBITS(REL_MAX)],
+ bitmask_props[NBITS(INPUT_PROP_MAX)];
const char *sysname;
- bool is_pointer;
- bool is_key;
+ bool is_pointer, is_key;
/* walk up the parental chain until we find the real input device; the
* argument is very likely a subdevice of this, like eventN */
static int install_force_release(sd_device *dev, const unsigned *release, unsigned release_count) {
sd_device *atkbd;
const char *cur;
- char codes[4096];
- char *s;
+ char *s, codes[4096];
size_t l;
unsigned i;
int r;
static int builtin_keyboard(UdevEvent *event, int argc, char *argv[]) {
sd_device *dev = ASSERT_PTR(ASSERT_PTR(event)->dev);
- unsigned release[1024];
- unsigned release_count = 0;
+ unsigned release[1024], release_count = 0;
_cleanup_close_ int fd = -EBADF;
const char *node;
int has_abs = -1, r;
return 0;
}
-static sd_device *skip_subsystem(sd_device *dev, const char *subsys) {
+static sd_device* skip_subsystem(sd_device *dev, const char *subsys) {
sd_device *parent;
assert(dev);
return dev;
}
-static sd_device *handle_scsi_fibre_channel(sd_device *parent, char **path) {
+static sd_device* handle_scsi_fibre_channel(sd_device *parent, char **path) {
sd_device *targetdev;
_cleanup_(sd_device_unrefp) sd_device *fcdev = NULL;
const char *port, *sysname;
return parent;
}
-static sd_device *handle_scsi_sas_wide_port(sd_device *parent, char **path) {
+static sd_device* handle_scsi_sas_wide_port(sd_device *parent, char **path) {
sd_device *targetdev, *target_parent;
_cleanup_(sd_device_unrefp) sd_device *sasdev = NULL;
const char *sas_address, *sysname;
return parent;
}
-static sd_device *handle_scsi_sas(sd_device *parent, char **path) {
+static sd_device* handle_scsi_sas(sd_device *parent, char **path) {
sd_device *targetdev, *target_parent, *port, *expander;
_cleanup_(sd_device_unrefp) sd_device *target_sasdev = NULL, *expander_sasdev = NULL, *port_sasdev = NULL;
- const char *sas_address = NULL;
- const char *phy_id;
- const char *sysname;
+ const char *sas_address = NULL, *phy_id, *sysname;
unsigned num_phys;
_cleanup_free_ char *lun = NULL;
return parent;
}
-static sd_device *handle_scsi_iscsi(sd_device *parent, char **path) {
+static sd_device* handle_scsi_iscsi(sd_device *parent, char **path) {
sd_device *transportdev;
_cleanup_(sd_device_unrefp) sd_device *sessiondev = NULL, *conndev = NULL;
- const char *target, *connname, *addr, *port;
+ const char *target, *connname, *addr, *port, *sysname, *sysnum;
_cleanup_free_ char *lun = NULL;
- const char *sysname, *sysnum;
assert(parent);
assert(path);
return parent;
}
-static sd_device *handle_scsi_ata(sd_device *parent, char **path, char **compat_path) {
+static sd_device* handle_scsi_ata(sd_device *parent, char **path, char **compat_path) {
sd_device *targetdev, *target_parent;
_cleanup_(sd_device_unrefp) sd_device *atadev = NULL;
const char *port_no, *sysname, *name;
return parent;
}
-static sd_device *handle_scsi_default(sd_device *parent, char **path) {
+static sd_device* handle_scsi_default(sd_device *parent, char **path) {
sd_device *hostdev;
int host, bus, target, lun;
const char *name, *base, *pos;
return hostdev;
}
-static sd_device *handle_scsi_hyperv(sd_device *parent, char **path, size_t guid_str_len) {
- sd_device *hostdev;
- sd_device *vmbusdev;
+static sd_device* handle_scsi_hyperv(sd_device *parent, char **path, size_t guid_str_len) {
+ sd_device *hostdev, *vmbusdev;
const char *guid_str;
_cleanup_free_ char *lun = NULL;
char guid[39];
return parent;
}
-static sd_device *handle_scsi(sd_device *parent, char **path, char **compat_path, bool *supported_parent) {
+static sd_device* handle_scsi(sd_device *parent, char **path, char **compat_path, bool *supported_parent) {
const char *id, *name;
if (!device_is_devtype(parent, "scsi_device"))
return handle_scsi_default(parent, path);
}
-static sd_device *handle_cciss(sd_device *parent, char **path) {
+static sd_device* handle_cciss(sd_device *parent, char **path) {
const char *str;
unsigned controller, disk;
}
}
-static sd_device *handle_usb(sd_device *parent, char **path) {
+static sd_device* handle_usb(sd_device *parent, char **path) {
const char *str, *port;
int r;
return parent;
}
-static sd_device *handle_bcma(sd_device *parent, char **path) {
+static sd_device* handle_bcma(sd_device *parent, char **path) {
const char *sysname;
unsigned core;
}
/* Handle devices of AP bus in System z platform. */
-static sd_device *handle_ap(sd_device *parent, char **path) {
+static sd_device* handle_ap(sd_device *parent, char **path) {
const char *type, *func;
assert(parent);
* is concatenated with the identification with an underscore '_'.
*/
static int builtin_usb_id(UdevEvent *event, int argc, char *argv[]) {
- sd_device *dev = ASSERT_PTR(ASSERT_PTR(event)->dev);
- char vendor_str[64] = "";
- char vendor_str_enc[256];
- const char *vendor_id;
- char model_str[64] = "";
- char model_str_enc[256];
- const char *product_id;
- char serial_str[UDEV_NAME_SIZE] = "";
- char packed_if_str[UDEV_NAME_SIZE] = "";
- char revision_str[64] = "";
- char type_str[64] = "";
- char instance_str[64] = "";
- const char *ifnum = NULL;
- const char *driver = NULL;
- char serial[256];
-
- sd_device *dev_interface, *dev_usb;
- const char *if_class, *if_subclass;
+ sd_device *dev_interface, *dev_usb, *dev = ASSERT_PTR(ASSERT_PTR(event)->dev);
+ const char *syspath, *sysname, *interface_syspath, *vendor_id, *product_id,
+ *ifnum = NULL, *driver = NULL, *if_class, *if_subclass;
+ char *s, model_str[64] = "", model_str_enc[256], serial_str[UDEV_NAME_SIZE] = "",
+ packed_if_str[UDEV_NAME_SIZE] = "", revision_str[64] = "", type_str[64] = "",
+ instance_str[64] = "", serial[256], vendor_str[64] = "", vendor_str_enc[256];
unsigned if_class_num;
- int protocol = 0;
+ int r, protocol = 0;
size_t l;
- char *s;
-
- const char *syspath, *sysname, *interface_syspath;
- int r;
r = sd_device_get_syspath(dev, &syspath);
if (r < 0)
#include "udev-util.h"
#include "user-util.h"
-UdevEvent *udev_event_new(sd_device *dev, UdevWorker *worker, EventMode mode) {
+UdevEvent* udev_event_new(sd_device *dev, UdevWorker *worker, EventMode mode) {
int log_level = worker ? worker->log_level : log_get_max_level();
UdevEvent *event;
return event;
}
-UdevEvent *udev_event_free(UdevEvent *event) {
+UdevEvent* udev_event_free(UdevEvent *event) {
if (!event)
return NULL;
EventMode event_mode;
} UdevEvent;
-UdevEvent *udev_event_new(sd_device *dev, UdevWorker *worker, EventMode mode);
-UdevEvent *udev_event_free(UdevEvent *event);
+UdevEvent* udev_event_new(sd_device *dev, UdevWorker *worker, EventMode mode);
+UdevEvent* udev_event_free(UdevEvent *event);
DEFINE_TRIVIAL_CLEANUP_FUNC(UdevEvent*, udev_event_free);
int udev_event_execute_rules(UdevEvent *event, UdevRules *rules);
{ .name = "sys", .fmt = 'S', .type = FORMAT_SUBST_SYS },
};
-static const char *format_type_to_string(FormatSubstitutionType t) {
+static const char* format_type_to_string(FormatSubstitutionType t) {
FOREACH_ELEMENT(entry, map)
if (entry->type == t)
return entry->name;
DEFINE_TRIVIAL_CLEANUP_FUNC(UdevRuleFile*, udev_rule_file_free);
-UdevRules *udev_rules_free(UdevRules *rules) {
+UdevRules* udev_rules_free(UdevRules *rules) {
if (!rules)
return NULL;
unsigned udev_rule_file_get_issues(UdevRuleFile *rule_file);
UdevRules* udev_rules_new(ResolveNameTiming resolve_name_timing);
int udev_rules_load(UdevRules **ret_rules, ResolveNameTiming resolve_name_timing);
-UdevRules *udev_rules_free(UdevRules *rules);
+UdevRules* udev_rules_free(UdevRules *rules);
DEFINE_TRIVIAL_CLEANUP_FUNC(UdevRules*, udev_rules_free);
#define udev_rules_free_and_replace(a, b) free_and_replace_full(a, b, udev_rules_free)