sd-device: trivial cleanups (#38162)
This commit is contained in:
@@ -20,9 +20,9 @@ int device_enumerator_add_parent_devices(sd_device_enumerator *enumerator, sd_de
|
||||
int device_enumerator_add_match_is_initialized(sd_device_enumerator *enumerator, MatchInitializedType type);
|
||||
int device_enumerator_add_match_parent_incremental(sd_device_enumerator *enumerator, sd_device *parent);
|
||||
int device_enumerator_add_prioritized_subsystem(sd_device_enumerator *enumerator, const char *subsystem);
|
||||
sd_device *device_enumerator_get_first(sd_device_enumerator *enumerator);
|
||||
sd_device *device_enumerator_get_next(sd_device_enumerator *enumerator);
|
||||
sd_device **device_enumerator_get_devices(sd_device_enumerator *enumerator, size_t *ret_n_devices);
|
||||
sd_device* device_enumerator_get_first(sd_device_enumerator *enumerator);
|
||||
sd_device* device_enumerator_get_next(sd_device_enumerator *enumerator);
|
||||
sd_device** device_enumerator_get_devices(sd_device_enumerator *enumerator, size_t *ret_n_devices);
|
||||
|
||||
#define FOREACH_DEVICE_AND_SUBSYSTEM(enumerator, device) \
|
||||
for (device = device_enumerator_get_first(enumerator); \
|
||||
|
||||
@@ -98,7 +98,7 @@ static void device_enumerator_unref_devices(sd_device_enumerator *enumerator) {
|
||||
enumerator->n_devices = 0;
|
||||
}
|
||||
|
||||
static sd_device_enumerator *device_enumerator_free(sd_device_enumerator *enumerator) {
|
||||
static sd_device_enumerator* device_enumerator_free(sd_device_enumerator *enumerator) {
|
||||
assert(enumerator);
|
||||
|
||||
device_enumerator_unref_devices(enumerator);
|
||||
@@ -1021,7 +1021,7 @@ int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
|
||||
return r;
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator) {
|
||||
_public_ sd_device* sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (device_enumerator_scan_devices(enumerator) < 0)
|
||||
@@ -1038,7 +1038,7 @@ _public_ sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator *
|
||||
return enumerator->devices[0];
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator *enumerator) {
|
||||
_public_ sd_device* sd_device_enumerator_get_device_next(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (!enumerator->scan_uptodate ||
|
||||
@@ -1088,7 +1088,7 @@ int device_enumerator_scan_subsystems(sd_device_enumerator *enumerator) {
|
||||
return r;
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_enumerator_get_subsystem_first(sd_device_enumerator *enumerator) {
|
||||
_public_ sd_device* sd_device_enumerator_get_subsystem_first(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (device_enumerator_scan_subsystems(enumerator) < 0)
|
||||
@@ -1105,7 +1105,7 @@ _public_ sd_device *sd_device_enumerator_get_subsystem_first(sd_device_enumerato
|
||||
return enumerator->devices[0];
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_enumerator_get_subsystem_next(sd_device_enumerator *enumerator) {
|
||||
_public_ sd_device* sd_device_enumerator_get_subsystem_next(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (!enumerator->scan_uptodate ||
|
||||
@@ -1161,7 +1161,7 @@ int device_enumerator_scan_devices_and_subsystems(sd_device_enumerator *enumerat
|
||||
return r;
|
||||
}
|
||||
|
||||
sd_device *device_enumerator_get_first(sd_device_enumerator *enumerator) {
|
||||
sd_device* device_enumerator_get_first(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (!enumerator->scan_uptodate)
|
||||
@@ -1178,7 +1178,7 @@ sd_device *device_enumerator_get_first(sd_device_enumerator *enumerator) {
|
||||
return enumerator->devices[0];
|
||||
}
|
||||
|
||||
sd_device *device_enumerator_get_next(sd_device_enumerator *enumerator) {
|
||||
sd_device* device_enumerator_get_next(sd_device_enumerator *enumerator) {
|
||||
assert_return(enumerator, NULL);
|
||||
|
||||
if (!enumerator->scan_uptodate ||
|
||||
@@ -1189,7 +1189,7 @@ sd_device *device_enumerator_get_next(sd_device_enumerator *enumerator) {
|
||||
return enumerator->devices[++enumerator->current_device_index];
|
||||
}
|
||||
|
||||
sd_device **device_enumerator_get_devices(sd_device_enumerator *enumerator, size_t *ret_n_devices) {
|
||||
sd_device** device_enumerator_get_devices(sd_device_enumerator *enumerator, size_t *ret_n_devices) {
|
||||
assert(enumerator);
|
||||
assert(ret_n_devices);
|
||||
|
||||
|
||||
@@ -412,13 +412,13 @@ _public_ int sd_device_monitor_attach_event(sd_device_monitor *m, sd_event *even
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ sd_event *sd_device_monitor_get_event(sd_device_monitor *m) {
|
||||
_public_ sd_event* sd_device_monitor_get_event(sd_device_monitor *m) {
|
||||
assert_return(m, NULL);
|
||||
|
||||
return m->event;
|
||||
}
|
||||
|
||||
_public_ sd_event_source *sd_device_monitor_get_event_source(sd_device_monitor *m) {
|
||||
_public_ sd_event_source* sd_device_monitor_get_event_source(sd_device_monitor *m) {
|
||||
assert_return(m, NULL);
|
||||
|
||||
return m->event_source;
|
||||
@@ -447,7 +447,7 @@ _public_ int sd_device_monitor_get_description(sd_device_monitor *m, const char
|
||||
return 0;
|
||||
}
|
||||
|
||||
static sd_device_monitor *device_monitor_free(sd_device_monitor *m) {
|
||||
static sd_device_monitor* device_monitor_free(sd_device_monitor *m) {
|
||||
assert(m);
|
||||
|
||||
(void) sd_device_monitor_detach_event(m);
|
||||
|
||||
@@ -52,7 +52,7 @@ int device_new_aux(sd_device **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static sd_device *device_free(sd_device *device) {
|
||||
static sd_device* device_free(sd_device *device) {
|
||||
assert(device);
|
||||
|
||||
sd_device_unref(device->parent);
|
||||
@@ -1051,7 +1051,7 @@ static int device_enumerate_children(sd_device *device) {
|
||||
return 1; /* Enumerated. */
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_get_child_first(sd_device *device, const char **ret_suffix) {
|
||||
_public_ sd_device* sd_device_get_child_first(sd_device *device, const char **ret_suffix) {
|
||||
int r;
|
||||
|
||||
assert(device);
|
||||
@@ -1069,7 +1069,7 @@ _public_ sd_device *sd_device_get_child_first(sd_device *device, const char **re
|
||||
return sd_device_get_child_next(device, ret_suffix);
|
||||
}
|
||||
|
||||
_public_ sd_device *sd_device_get_child_next(sd_device *device, const char **ret_suffix) {
|
||||
_public_ sd_device* sd_device_get_child_next(sd_device *device, const char **ret_suffix) {
|
||||
sd_device *child;
|
||||
|
||||
assert(device);
|
||||
@@ -1922,7 +1922,7 @@ _public_ int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *r
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_tag_first(sd_device *device) {
|
||||
_public_ const char* sd_device_get_tag_first(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -1936,7 +1936,7 @@ _public_ const char *sd_device_get_tag_first(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_tag_next(sd_device *device) {
|
||||
_public_ const char* sd_device_get_tag_next(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -1962,7 +1962,7 @@ static bool device_database_supports_current_tags(sd_device *device) {
|
||||
return device->database_version >= 1;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_current_tag_first(sd_device *device) {
|
||||
_public_ const char* sd_device_get_current_tag_first(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -1979,7 +1979,7 @@ _public_ const char *sd_device_get_current_tag_first(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_current_tag_next(sd_device *device) {
|
||||
_public_ const char* sd_device_get_current_tag_next(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -1996,7 +1996,7 @@ _public_ const char *sd_device_get_current_tag_next(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_devlink_first(sd_device *device) {
|
||||
_public_ const char* sd_device_get_devlink_first(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -2010,7 +2010,7 @@ _public_ const char *sd_device_get_devlink_first(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_devlink_next(sd_device *device) {
|
||||
_public_ const char* sd_device_get_devlink_next(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
@@ -2083,7 +2083,7 @@ int device_properties_prepare(sd_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_property_first(sd_device *device, const char **_value) {
|
||||
_public_ const char* sd_device_get_property_first(sd_device *device, const char **_value) {
|
||||
const char *key;
|
||||
int r;
|
||||
|
||||
@@ -2100,7 +2100,7 @@ _public_ const char *sd_device_get_property_first(sd_device *device, const char
|
||||
return key;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_property_next(sd_device *device, const char **_value) {
|
||||
_public_ const char* sd_device_get_property_next(sd_device *device, const char **_value) {
|
||||
const char *key;
|
||||
int r;
|
||||
|
||||
@@ -2217,19 +2217,14 @@ static int device_sysattrs_read_all(sd_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_sysattr_first(sd_device *device) {
|
||||
_public_ const char* sd_device_get_sysattr_first(sd_device *device) {
|
||||
void *v;
|
||||
int r;
|
||||
|
||||
assert_return(device, NULL);
|
||||
|
||||
if (!device->sysattrs_read) {
|
||||
r = device_sysattrs_read_all(device);
|
||||
if (r < 0) {
|
||||
errno = -r;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (!device->sysattrs_read &&
|
||||
device_sysattrs_read_all(device) < 0)
|
||||
return NULL;
|
||||
|
||||
device->sysattrs_iterator = ITERATOR_FIRST;
|
||||
|
||||
@@ -2237,7 +2232,7 @@ _public_ const char *sd_device_get_sysattr_first(sd_device *device) {
|
||||
return v;
|
||||
}
|
||||
|
||||
_public_ const char *sd_device_get_sysattr_next(sd_device *device) {
|
||||
_public_ const char* sd_device_get_sysattr_next(sd_device *device) {
|
||||
void *v;
|
||||
|
||||
assert_return(device, NULL);
|
||||
|
||||
+14
-14
@@ -50,8 +50,8 @@ typedef int (*sd_device_monitor_handler_t)(sd_device_monitor *m, sd_device *devi
|
||||
|
||||
/* device */
|
||||
|
||||
sd_device *sd_device_ref(sd_device *device);
|
||||
sd_device *sd_device_unref(sd_device *device);
|
||||
sd_device* sd_device_ref(sd_device *device);
|
||||
sd_device* sd_device_unref(sd_device *device);
|
||||
|
||||
int sd_device_new_from_syspath(sd_device **ret, const char *syspath);
|
||||
int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum);
|
||||
@@ -98,8 +98,8 @@ const char* sd_device_get_property_first(sd_device *device, const char **value);
|
||||
const char* sd_device_get_property_next(sd_device *device, const char **value);
|
||||
const char* sd_device_get_sysattr_first(sd_device *device);
|
||||
const char* sd_device_get_sysattr_next(sd_device *device);
|
||||
sd_device *sd_device_get_child_first(sd_device *device, const char **ret_suffix);
|
||||
sd_device *sd_device_get_child_next(sd_device *device, const char **ret_suffix);
|
||||
sd_device* sd_device_get_child_first(sd_device *device, const char **ret_suffix);
|
||||
sd_device* sd_device_get_child_next(sd_device *device, const char **ret_suffix);
|
||||
|
||||
int sd_device_has_tag(sd_device *device, const char *tag);
|
||||
int sd_device_has_current_tag(sd_device *device, const char *tag);
|
||||
@@ -117,13 +117,13 @@ int sd_device_open(sd_device *device, int flags);
|
||||
/* device enumerator */
|
||||
|
||||
int sd_device_enumerator_new(sd_device_enumerator **ret);
|
||||
sd_device_enumerator *sd_device_enumerator_ref(sd_device_enumerator *enumerator);
|
||||
sd_device_enumerator *sd_device_enumerator_unref(sd_device_enumerator *enumerator);
|
||||
sd_device_enumerator* sd_device_enumerator_ref(sd_device_enumerator *enumerator);
|
||||
sd_device_enumerator* sd_device_enumerator_unref(sd_device_enumerator *enumerator);
|
||||
|
||||
sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator);
|
||||
sd_device *sd_device_enumerator_get_device_next(sd_device_enumerator *enumerator);
|
||||
sd_device *sd_device_enumerator_get_subsystem_first(sd_device_enumerator *enumerator);
|
||||
sd_device *sd_device_enumerator_get_subsystem_next(sd_device_enumerator *enumerator);
|
||||
sd_device* sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator);
|
||||
sd_device* sd_device_enumerator_get_device_next(sd_device_enumerator *enumerator);
|
||||
sd_device* sd_device_enumerator_get_subsystem_first(sd_device_enumerator *enumerator);
|
||||
sd_device* sd_device_enumerator_get_subsystem_next(sd_device_enumerator *enumerator);
|
||||
|
||||
int sd_device_enumerator_add_match_subsystem(sd_device_enumerator *enumerator, const char *subsystem, int match);
|
||||
int sd_device_enumerator_add_match_sysattr(sd_device_enumerator *enumerator, const char *sysattr, const char *value, int match);
|
||||
@@ -139,8 +139,8 @@ int sd_device_enumerator_add_all_parents(sd_device_enumerator *enumerator);
|
||||
/* device monitor */
|
||||
|
||||
int sd_device_monitor_new(sd_device_monitor **ret);
|
||||
sd_device_monitor *sd_device_monitor_ref(sd_device_monitor *m);
|
||||
sd_device_monitor *sd_device_monitor_unref(sd_device_monitor *m);
|
||||
sd_device_monitor* sd_device_monitor_ref(sd_device_monitor *m);
|
||||
sd_device_monitor* sd_device_monitor_unref(sd_device_monitor *m);
|
||||
|
||||
int sd_device_monitor_get_fd(sd_device_monitor *m);
|
||||
int sd_device_monitor_get_events(sd_device_monitor *m);
|
||||
@@ -148,8 +148,8 @@ int sd_device_monitor_get_timeout(sd_device_monitor *m, uint64_t *ret);
|
||||
int sd_device_monitor_set_receive_buffer_size(sd_device_monitor *m, size_t size);
|
||||
int sd_device_monitor_attach_event(sd_device_monitor *m, sd_event *event);
|
||||
int sd_device_monitor_detach_event(sd_device_monitor *m);
|
||||
sd_event *sd_device_monitor_get_event(sd_device_monitor *m);
|
||||
sd_event_source *sd_device_monitor_get_event_source(sd_device_monitor *m);
|
||||
sd_event* sd_device_monitor_get_event(sd_device_monitor *m);
|
||||
sd_event_source* sd_device_monitor_get_event_source(sd_device_monitor *m);
|
||||
int sd_device_monitor_set_description(sd_device_monitor *m, const char *description);
|
||||
int sd_device_monitor_get_description(sd_device_monitor *m, const char **ret);
|
||||
int sd_device_monitor_is_running(sd_device_monitor *m);
|
||||
|
||||
Reference in New Issue
Block a user