static int has_multiple_graphics_cards(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
bool found = false;
int r;
static int validate_device(sd_device *device) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *enumerate = NULL;
const char *v, *sysname, *subsystem;
- sd_device *parent, *other;
+ sd_device *parent;
int r;
assert(device);
static int device_setup_extra_units(Manager *m, sd_device *dev, Set **ready_units, Set **not_ready_units) {
_cleanup_strv_free_ char **aliases = NULL;
- const char *devlink, *syspath, *devname = NULL;
+ const char *syspath, *devname = NULL;
Device *l;
int r;
static void device_enumerate(Manager *m) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
int r;
assert(m);
static void swap_process_new(Manager *m, const char *device, int prio, bool set_flags) {
_cleanup_(sd_device_unrefp) sd_device *d = NULL;
- const char *dn, *devlink;
+ const char *dn;
struct stat st, st_link;
int r;
int swap_process_device_new(Manager *m, sd_device *dev) {
_cleanup_free_ char *e = NULL;
- const char *dn, *devlink;
+ const char *dn;
Unit *u;
int r;
} else if (S_ISREG(st.st_mode)) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
/* If a regular file is specified, search for a loopback block device that is backed by it */
static int manager_enumerate_devices(Manager *m) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(m);
}
j = 0;
- FOREACH_DEVICE_DEVLINK(d, g) {
+ FOREACH_DEVICE_DEVLINK(d, link) {
if (j >= N_IOVEC_UDEV_FIELDS)
break;
- b = strjoin("_UDEV_DEVLINK=", g);
+ b = strjoin("_UDEV_DEVLINK=", link);
if (b) {
iovec[n++] = IOVEC_MAKE_STRING(b);
z++;
if (hashmap_isempty(enumerator->match_property))
return true;
- HASHMAP_FOREACH_KEY(value_patterns, property_pattern, enumerator->match_property) {
- const char *property, *value;
-
+ HASHMAP_FOREACH_KEY(value_patterns, property_pattern, enumerator->match_property)
FOREACH_DEVICE_PROPERTY(device, property, value) {
if (fnmatch(property_pattern, property, 0) != 0)
continue;
if (strv_fnmatch(value_patterns, value))
return true;
}
- }
return false;
}
/* add tag bloom filter */
tag_bloom_bits = 0;
- FOREACH_DEVICE_TAG(device, val)
- tag_bloom_bits |= string_bloom64(val);
+ FOREACH_DEVICE_TAG(device, tag)
+ tag_bloom_bits |= string_bloom64(tag);
if (tag_bloom_bits > 0) {
nlh.filter_tag_bloom_hi = htobe32(tag_bloom_bits >> 32);
static int device_update_properties_bufs(sd_device *device) {
_cleanup_free_ char **buf_strv = NULL, *buf_nulstr = NULL;
size_t nulstr_len = 0, num = 0;
- const char *val, *prop;
assert(device);
}
int device_tag_index(sd_device *device, sd_device *device_old, bool add) {
- const char *tag;
int r = 0, k;
if (add && device_old)
}
if (has_info) {
- const char *property, *value, *tag;
+ const char *property, *value, *ct;
if (major(device->devnum) > 0) {
- const char *devlink;
-
FOREACH_DEVICE_DEVLINK(device, devlink)
fprintf(f, "S:%s\n", devlink + STRLEN("/dev/"));
FOREACH_DEVICE_TAG(device, tag)
fprintf(f, "G:%s\n", tag); /* Any tag */
- SET_FOREACH(tag, device->current_tags)
- fprintf(f, "Q:%s\n", tag); /* Current tag */
+ SET_FOREACH(ct, device->current_tags)
+ fprintf(f, "Q:%s\n", ct); /* Current tag */
/* Always write the latest database version here, instead of the value stored in
* device->database_version, as which may be 0. */
unref_and_replace_full(a, b, sd_device_ref, sd_device_unref)
#define FOREACH_DEVICE_PROPERTY(device, key, value) \
- for (key = sd_device_get_property_first(device, &(value)); \
+ for (const char *value, *key = sd_device_get_property_first(device, &(value)); \
key; \
key = sd_device_get_property_next(device, &(value)))
#define FOREACH_DEVICE_TAG(device, tag) \
- for (tag = sd_device_get_tag_first(device); \
+ for (const char *tag = sd_device_get_tag_first(device); \
tag; \
tag = sd_device_get_tag_next(device))
#define FOREACH_DEVICE_CURRENT_TAG(device, tag) \
- for (tag = sd_device_get_current_tag_first(device); \
+ for (const char *tag = sd_device_get_current_tag_first(device); \
tag; \
tag = sd_device_get_current_tag_next(device))
#define FOREACH_DEVICE_SYSATTR(device, attr) \
- for (attr = sd_device_get_sysattr_first(device); \
+ for (const char *attr = sd_device_get_sysattr_first(device); \
attr; \
attr = sd_device_get_sysattr_next(device))
#define FOREACH_DEVICE_DEVLINK(device, devlink) \
- for (devlink = sd_device_get_devlink_first(device); \
+ for (const char *devlink = sd_device_get_devlink_first(device); \
devlink; \
devlink = sd_device_get_devlink_next(device))
#define _FOREACH_DEVICE_CHILD(device, child, suffix_ptr) \
- for (child = sd_device_get_child_first(device, suffix_ptr); \
+ for (sd_device *child = sd_device_get_child_first(device, suffix_ptr); \
child; \
child = sd_device_get_child_next(device, suffix_ptr))
_FOREACH_DEVICE_CHILD(device, child, &suffix)
#define FOREACH_DEVICE(enumerator, device) \
- for (device = sd_device_enumerator_get_device_first(enumerator); \
+ for (sd_device *device = sd_device_enumerator_get_device_first(enumerator); \
device; \
device = sd_device_enumerator_get_device_next(enumerator))
#define FOREACH_SUBSYSTEM(enumerator, device) \
- for (device = sd_device_enumerator_get_subsystem_first(enumerator); \
+ for (sd_device *device = sd_device_enumerator_get_subsystem_first(enumerator); \
device; \
device = sd_device_enumerator_get_subsystem_next(enumerator))
static void test_send_receive_one(sd_device *device, bool subsystem_filter, bool tag_filter, bool use_bpf) {
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
- const char *syspath, *subsystem, *tag, *devtype = NULL;
+ const char *syspath, *subsystem, *devtype = NULL;
log_device_info(device, "/* %s(subsystem_filter=%s, tag_filter=%s, use_bpf=%s) */", __func__,
true_false(subsystem_filter), true_false(tag_filter), true_false(use_bpf));
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
const char *syspath, *subsystem;
- sd_device *d;
log_device_info(device, "/* %s */", __func__);
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
const char *syspath;
- sd_device *d;
log_device_info(device, "/* %s */", __func__);
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
const char *syspath, *sysattr_value;
- sd_device *d;
log_device_info(device, "/* %s(%s) */", __func__, sysattr);
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
const char *syspath, *parent_syspath;
- sd_device *parent, *d;
+ sd_device *parent;
int r;
log_device_info(device, "/* %s */", __func__);
int main(int argc, char *argv[]) {
sd_device *loopback;
pthread_t t;
- const char *key, *value;
int r;
r = sd_device_new_from_syspath(&loopback, "/sys/class/net/lo");
TEST(sd_device_enumerator_devices) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
assert_se(sd_device_enumerator_new(&e) >= 0);
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
TEST(sd_device_enumerator_subsystems) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
assert_se(sd_device_enumerator_new(&e) >= 0);
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
unsigned n_new_dev = 0, n_removed_dev = 0;
- sd_device *d;
+ sd_device *dev;
assert_se(sd_device_enumerator_new(&e) >= 0);
assert_se(sd_device_enumerator_add_match_subsystem(e, subsystem, true) >= 0);
assert_se(!sd_device_unref(t));
}
- HASHMAP_FOREACH(d, h) {
+ HASHMAP_FOREACH(dev, h) {
const char *syspath;
- assert_se(sd_device_get_syspath(d, &syspath) >= 0);
+ assert_se(sd_device_get_syspath(dev, &syspath) >= 0);
log_warning("Device removed: subsystem:%s syspath:%s", subsystem, syspath);
n_removed_dev++;
- assert_se(!sd_device_unref(d));
+ assert_se(!sd_device_unref(dev));
}
hashmap_free(h);
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_hashmap_free_ Hashmap *subsystems = NULL;
unsigned n_new_dev = 0, n_removed_dev = 0;
- sd_device *d;
Hashmap *h;
char *s;
static void check_parent_match(sd_device_enumerator *e, sd_device *dev) {
const char *syspath;
bool found = false;
- sd_device *d;
assert_se(sd_device_get_syspath(dev, &syspath) >= 0);
TEST(sd_device_enumerator_add_match_parent) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
int r;
assert_se(sd_device_enumerator_new(&e) >= 0);
TEST(sd_device_get_child) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
int r;
assert_se(sd_device_enumerator_new(&e) >= 0);
FOREACH_DEVICE(e, dev) {
const char *syspath, *parent_syspath, *expected_suffix, *suffix;
- sd_device *parent, *child;
+ sd_device *parent;
bool found = false;
assert_se(sd_device_get_syspath(dev, &syspath) >= 0);
TEST(sd_device_new_from_path) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_(rm_rf_physical_and_freep) char *tmpdir = NULL;
- sd_device *dev;
int r;
assert_se(mkdtemp_malloc("/tmp/test-sd-device.XXXXXXX", &tmpdir) >= 0);
if (device_get_devlinks_generation(udev_device->device) != udev_device->devlinks_generation ||
!udev_device->devlinks_read) {
- const char *devlink;
-
udev_list_cleanup(udev_device->devlinks);
FOREACH_DEVICE_DEVLINK(udev_device->device, devlink)
if (device_get_properties_generation(udev_device->device) != udev_device->properties_generation ||
!udev_device->properties_read) {
- const char *key, *value;
-
udev_list_cleanup(udev_device->properties);
FOREACH_DEVICE_PROPERTY(udev_device->device, key, value)
assert_return_errno(udev_device, NULL, EINVAL);
if (!udev_device->sysattrs_read) {
- const char *sysattr;
-
udev_list_cleanup(udev_device->sysattrs);
FOREACH_DEVICE_SYSATTR(udev_device->device, sysattr)
if (device_get_tags_generation(udev_device->device) != udev_device->all_tags_generation ||
!udev_device->all_tags_read) {
- const char *tag;
-
udev_list_cleanup(udev_device->all_tags);
FOREACH_DEVICE_TAG(udev_device->device, tag)
if (device_get_tags_generation(udev_device->device) != udev_device->current_tags_generation ||
!udev_device->current_tags_read) {
- const char *tag;
-
udev_list_cleanup(udev_device->current_tags);
FOREACH_DEVICE_CURRENT_TAG(udev_device->device, tag)
static int manager_count_external_displays(Manager *m) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r, n = 0;
r = sd_device_enumerator_new(&e);
return sd_bus_reply_method_return(message, NULL);
}
-static int trigger_device(Manager *m, sd_device *d) {
+static int trigger_device(Manager *m, sd_device *parent) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
int r;
if (r < 0)
return r;
- if (d) {
- r = sd_device_enumerator_add_match_parent(e, d);
+ if (parent) {
+ r = sd_device_enumerator_add_match_parent(e, parent);
if (r < 0)
return r;
}
static int manager_enumerate_devices(Manager *m) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(m);
static int manager_enumerate_buttons(Manager *m) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(m);
static int find_loop_device(const char *backing_file, sd_device **ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
int r;
assert(backing_file);
static int list_devices(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
- sd_device *d;
unsigned c;
int r;
static int link_set_sr_iov_virt_ports(Link *link) {
const char *dev_port, *name;
- sd_device *pci_dev, *child;
+ sd_device *pci_dev;
int r;
assert(link);
static int device_is_power_sink(sd_device *device) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
bool found_source = false, found_sink = false;
- sd_device *parent, *d;
+ sd_device *parent;
int r;
assert(device);
int on_ac_power(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
bool found_ac_online = false, found_discharging_battery = false;
- sd_device *d;
int r;
r = sd_device_enumerator_new(&e);
int battery_is_discharging_and_low(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
bool unsure = false, found_low = false;
- sd_device *dev;
int r;
/* We have not used battery capacity_level since value is set to full
static int block_device_get_originating(sd_device *dev, sd_device **ret) {
_cleanup_(sd_device_unrefp) sd_device *first_found = NULL;
const char *suffix;
- sd_device *child;
dev_t devnum = 0; /* avoid false maybe-uninitialized warning */
/* For the specified block device tries to chase it through the layers, in case LUKS-style DM
_cleanup_(sd_device_unrefp) sd_device *dev_unref = NULL;
_cleanup_close_ int fd_close = -EBADF;
bool has_partitions = false;
- sd_device *part;
int r, k = 0;
assert(dev || fd >= 0);
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_set_free_ Set *nodes = NULL;
_cleanup_closedir_ DIR *dir = NULL;
- sd_device *d;
char *n;
int r;
int fetch_batteries_capacity_by_name(Hashmap **ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
_cleanup_hashmap_free_ Hashmap *batteries_capacity_by_name = NULL;
- sd_device *dev;
int r;
assert(ret);
usec_t after_timestamp) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
bool trunc = true;
int r;
int get_total_suspend_interval(Hashmap *last_capacity, usec_t *ret) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
usec_t total_suspend_interval = 0;
- sd_device *dev;
int r;
assert(last_capacity);
/* Return true if all batteries have acpi_btp support */
int battery_trip_point_alarm_exists(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *dev;
int r;
r = battery_enumerator_new(&e);
if (data->devlink) {
const char *devlink;
- FOREACH_DEVICE_DEVLINK(device, devlink)
- if (path_equal(devlink, data->devlink))
+ FOREACH_DEVICE_DEVLINK(device, link)
+ if (path_equal(link, data->devlink))
goto found;
if (sd_device_get_devname(device, &devlink) >= 0 && path_equal(devlink, data->devlink))
static int dm_list_get(DeviceMapper **head) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(head);
static int loopback_list_get(LoopbackDevice **head) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(head);
static int md_list_get(RaidDevice **head) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
- sd_device *d;
int r;
assert(head);
unsigned release[1024];
unsigned release_count = 0;
_cleanup_close_ int fd = -EBADF;
- const char *node, *key, *value;
+ const char *node;
int has_abs = -1, r;
r = sd_device_get_devname(dev, &node);
static int get_virtfn_info(sd_device *pcidev, sd_device **ret_physfn_pcidev, char **ret_suffix) {
_cleanup_(sd_device_unrefp) sd_device *physfn_pcidev = NULL;
const char *syspath, *name;
- sd_device *child;
int r;
assert(pcidev);
static int dev_devicetree_onboard(sd_device *dev, NetNames *names) {
_cleanup_(sd_device_unrefp) sd_device *aliases_dev = NULL, *ofnode_dev = NULL, *devicetree_dev = NULL;
- const char *alias, *ofnode_path, *ofnode_syspath, *devicetree_syspath;
+ const char *ofnode_path, *ofnode_syspath, *devicetree_syspath;
sd_device *parent;
int r;
}
break;
case FORMAT_SUBST_LINKS:
- FOREACH_DEVICE_DEVLINK(dev, val) {
+ FOREACH_DEVICE_DEVLINK(dev, link) {
if (s == dest)
- strpcpy_full(&s, l, val + STRLEN("/dev/"), &truncated);
+ strpcpy_full(&s, l, link + STRLEN("/dev/"), &truncated);
else
- strpcpyl_full(&s, l, &truncated, " ", val + STRLEN("/dev/"), NULL);
+ strpcpyl_full(&s, l, &truncated, " ", link + STRLEN("/dev/"), NULL);
if (truncated)
break;
}
}
static int copy_all_tags(sd_device *d, sd_device *s) {
- const char *tag;
int r;
assert(d);
int udev_node_update(sd_device *dev, sd_device *dev_old) {
_cleanup_free_ char *filename = NULL;
- const char *devlink;
int r;
assert(dev);
int udev_node_remove(sd_device *dev) {
_cleanup_free_ char *filename = NULL;
- const char *devlink;
int r;
assert(dev);
}
static int import_parent_into_properties(sd_device *dev, const char *filter) {
- const char *key, *val;
sd_device *parent;
int r;
return token_match_string(token, val);
}
- case TK_M_DEVLINK: {
- const char *val;
-
+ case TK_M_DEVLINK:
FOREACH_DEVICE_DEVLINK(dev, val)
if (token_match_string(token, strempty(startswith(val, "/dev/"))) == (token->op == OP_MATCH))
return token->op == OP_MATCH;
return token->op == OP_NOMATCH;
- }
case TK_M_NAME:
return token_match_string(token, event->name);
case TK_M_ENV: {
return token_match_string(token, val);
}
case TK_M_TAG:
- case TK_M_PARENTS_TAG: {
- const char *val;
-
+ case TK_M_PARENTS_TAG:
FOREACH_DEVICE_CURRENT_TAG(dev, val)
if (token_match_string(token, val) == (token->op == OP_MATCH))
return token->op == OP_MATCH;
return token->op == OP_NOMATCH;
- }
case TK_M_SUBSYSTEM:
case TK_M_PARENTS_SUBSYSTEM: {
const char *val;
static int print_all_attributes(sd_device *device, bool is_parent) {
_cleanup_free_ SysAttr *sysattrs = NULL;
- const char *name, *value;
+ const char *value;
size_t n_items = 0;
int r;
}
static int print_record(sd_device *device, const char *prefix) {
- const char *str, *val, *subsys;
+ const char *str, *subsys;
dev_t devnum;
uint64_t q;
int i, ifi;
printf("%sI: %s%i%s\n", prefix, ansi_highlight_cyan(), ifi, ansi_normal());
if (sd_device_get_devname(device, &str) >= 0) {
+ const char *val;
+
assert_se(val = path_startswith(str, "/dev/"));
printf("%sN: %s%s%s\n", prefix, ansi_highlight_cyan(), val, ansi_normal());
if (device_get_devlink_priority(device, &i) >= 0)
printf("%sL: %s%i%s\n", prefix, ansi_highlight_cyan(), i, ansi_normal());
- FOREACH_DEVICE_DEVLINK(device, str) {
- assert_se(val = path_startswith(str, "/dev/"));
+ FOREACH_DEVICE_DEVLINK(device, link) {
+ assert_se(val = path_startswith(link, "/dev/"));
printf("%sS: %s%s%s\n", prefix, ansi_highlight_cyan(), val, ansi_normal());
}
}
if (sd_device_get_driver(device, &str) >= 0)
printf("%sV: %s%s%s\n", prefix, ansi_highlight_yellow4(), str, ansi_normal());
- FOREACH_DEVICE_PROPERTY(device, str, val)
- printf("%sE: %s=%s\n", prefix, str, val);
+ FOREACH_DEVICE_PROPERTY(device, key, val)
+ printf("%sE: %s=%s\n", prefix, key, val);
if (isempty(prefix))
puts("");
}
case QUERY_SYMLINK: {
- const char *devlink, *prefix = "";
+ const char *prefix = "";
FOREACH_DEVICE_DEVLINK(device, devlink) {
if (!arg_root)
return 0;
}
- case QUERY_PROPERTY: {
- const char *key, *value;
-
+ case QUERY_PROPERTY:
FOREACH_DEVICE_PROPERTY(device, key, value) {
if (arg_properties && !strv_contains(arg_properties, key))
continue;
}
return 0;
- }
case QUERY_ALL:
return print_record(device, NULL);
devpath, subsystem);
if (arg_show_property) {
- const char *key, *value;
-
FOREACH_DEVICE_PROPERTY(device, key, value)
printf("%s=%s\n", key, value);
_cleanup_(udev_rules_freep) UdevRules *rules = NULL;
_cleanup_(udev_event_freep) UdevEvent *event = NULL;
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
- const char *cmd, *key, *value;
+ const char *cmd;
sigset_t mask, sigmask_orig;
void *val;
int r;
if (path_strv_contains(arg_devices, name))
return check_and_exit(sd_device_monitor_get_event(monitor));
- FOREACH_DEVICE_DEVLINK(device, name)
- if (path_strv_contains(arg_devices, name))
+ FOREACH_DEVICE_DEVLINK(device, link)
+ if (path_strv_contains(arg_devices, link))
return check_and_exit(sd_device_monitor_get_event(monitor));
return 0;
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
bool part_table_read;
const char *sysname;
- sd_device *d;
int r, k;
r = sd_device_get_sysname(dev, &sysname);