mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
sd-netlink: introduce sd_netlink_message_read_data_suffix0()
This commit is contained in:
parent
84f7bd7698
commit
a1d2ae065b
@ -776,6 +776,32 @@ int sd_netlink_message_read_data(sd_netlink_message *m, unsigned short type, siz
|
||||
return r;
|
||||
}
|
||||
|
||||
int sd_netlink_message_read_data_suffix0(sd_netlink_message *m, unsigned short type, size_t *ret_size, void **ret_data) {
|
||||
void *attr_data;
|
||||
int r;
|
||||
|
||||
assert_return(m, -EINVAL);
|
||||
|
||||
r = netlink_message_read_internal(m, type, &attr_data, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_data) {
|
||||
void *data;
|
||||
|
||||
data = memdup_suffix0(attr_data, r);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
*ret_data = data;
|
||||
}
|
||||
|
||||
if (ret_size)
|
||||
*ret_size = r;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int sd_netlink_message_read_string_strdup(sd_netlink_message *m, unsigned short type, char **data) {
|
||||
void *attr_data;
|
||||
int r;
|
||||
|
@ -95,6 +95,7 @@ int sd_netlink_message_close_container(sd_netlink_message *m);
|
||||
|
||||
int sd_netlink_message_read(sd_netlink_message *m, unsigned short type, size_t size, void *data);
|
||||
int sd_netlink_message_read_data(sd_netlink_message *m, unsigned short type, size_t *ret_size, void **ret_data);
|
||||
int sd_netlink_message_read_data_suffix0(sd_netlink_message *m, unsigned short type, size_t *ret_size, void **ret_data);
|
||||
int sd_netlink_message_read_string_strdup(sd_netlink_message *m, unsigned short type, char **data);
|
||||
int sd_netlink_message_read_string(sd_netlink_message *m, unsigned short type, const char **data);
|
||||
int sd_netlink_message_read_strv(sd_netlink_message *m, unsigned short container_type, unsigned short type_id, char ***ret);
|
||||
|
Loading…
Reference in New Issue
Block a user