mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
sd-device: introduce device_get_sysattr_unsigned_full()
This commit is contained in:
parent
87fe0a6960
commit
705c418f20
@ -20,7 +20,10 @@ int device_opendir(sd_device *device, const char *subdir, DIR **ret);
|
|||||||
int device_get_property_bool(sd_device *device, const char *key);
|
int device_get_property_bool(sd_device *device, const char *key);
|
||||||
int device_get_property_int(sd_device *device, const char *key, int *ret);
|
int device_get_property_int(sd_device *device, const char *key, int *ret);
|
||||||
int device_get_sysattr_int(sd_device *device, const char *sysattr, int *ret_value);
|
int device_get_sysattr_int(sd_device *device, const char *sysattr, int *ret_value);
|
||||||
int device_get_sysattr_unsigned(sd_device *device, const char *sysattr, unsigned *ret_value);
|
int device_get_sysattr_unsigned_full(sd_device *device, const char *sysattr, unsigned base, unsigned *ret_value);
|
||||||
|
static inline int device_get_sysattr_unsigned(sd_device *device, const char *sysattr, unsigned *ret_value) {
|
||||||
|
return device_get_sysattr_unsigned_full(device, sysattr, 0, ret_value);
|
||||||
|
}
|
||||||
int device_get_sysattr_u32(sd_device *device, const char *sysattr, uint32_t *ret_value);
|
int device_get_sysattr_u32(sd_device *device, const char *sysattr, uint32_t *ret_value);
|
||||||
int device_get_sysattr_bool(sd_device *device, const char *sysattr);
|
int device_get_sysattr_bool(sd_device *device, const char *sysattr);
|
||||||
int device_get_device_id(sd_device *device, const char **ret);
|
int device_get_device_id(sd_device *device, const char **ret);
|
||||||
|
@ -2399,7 +2399,7 @@ int device_get_sysattr_int(sd_device *device, const char *sysattr, int *ret_valu
|
|||||||
return v > 0;
|
return v > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_get_sysattr_unsigned(sd_device *device, const char *sysattr, unsigned *ret_value) {
|
int device_get_sysattr_unsigned_full(sd_device *device, const char *sysattr, unsigned base, unsigned *ret_value) {
|
||||||
const char *value;
|
const char *value;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -2408,7 +2408,7 @@ int device_get_sysattr_unsigned(sd_device *device, const char *sysattr, unsigned
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
unsigned v;
|
unsigned v;
|
||||||
r = safe_atou(value, &v);
|
r = safe_atou_full(value, base, &v);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_device_debug_errno(device, r, "Failed to parse '%s' attribute: %m", sysattr);
|
return log_device_debug_errno(device, r, "Failed to parse '%s' attribute: %m", sysattr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user