rtnl: rename constructors from the form sd_rtnl_xxx_yyy_new() to sd_rtnl_xxx_new_yyy()
So far we followed the rule to always indicate the "flavour" of constructors after the "_new_" or "_open_" in the function name, so let's keep things in sync here for rtnl and do the same.
This commit is contained in:
@@ -81,7 +81,7 @@ int sd_rtnl_message_route_set_dst_prefixlen(sd_rtnl_message *m, unsigned char pr
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_rtnl_message_route_new(uint16_t nlmsg_type, unsigned char rtm_family,
|
||||
int sd_rtnl_message_new_route(uint16_t nlmsg_type, unsigned char rtm_family,
|
||||
sd_rtnl_message **ret) {
|
||||
struct rtmsg *rtm;
|
||||
int r;
|
||||
@@ -144,7 +144,7 @@ int sd_rtnl_message_link_set_type(sd_rtnl_message *m, unsigned type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_rtnl_message_link_new(uint16_t nlmsg_type, int index, sd_rtnl_message **ret) {
|
||||
int sd_rtnl_message_new_link(uint16_t nlmsg_type, int index, sd_rtnl_message **ret) {
|
||||
struct ifinfomsg *ifi;
|
||||
int r;
|
||||
|
||||
@@ -217,7 +217,7 @@ int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_rtnl_message_addr_new(uint16_t nlmsg_type, int index, unsigned char family,
|
||||
int sd_rtnl_message_new_addr(uint16_t nlmsg_type, int index, unsigned char family,
|
||||
sd_rtnl_message **ret) {
|
||||
struct ifaddrmsg *ifa;
|
||||
int r;
|
||||
|
||||
@@ -35,7 +35,7 @@ int rtnl_set_link_name(sd_rtnl *rtnl, int ifindex, const char *name) {
|
||||
assert(ifindex > 0);
|
||||
assert(name);
|
||||
|
||||
r = sd_rtnl_message_link_new(RTM_SETLINK, ifindex, &message);
|
||||
r = sd_rtnl_message_new_link(RTM_SETLINK, ifindex, &message);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -62,7 +62,7 @@ int rtnl_set_link_properties(sd_rtnl *rtnl, int ifindex, const char *alias,
|
||||
if (!alias && !mac && mtu == 0)
|
||||
return 0;
|
||||
|
||||
r = sd_rtnl_message_link_new(RTM_SETLINK, ifindex, &message);
|
||||
r = sd_rtnl_message_new_link(RTM_SETLINK, ifindex, &message);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ static void test_link_configure(sd_rtnl *rtnl, int ifindex) {
|
||||
void *data;
|
||||
|
||||
/* we'd really like to test NEWLINK, but let's not mess with the running kernel */
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &message) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &message) >= 0);
|
||||
assert(sd_rtnl_message_append_string(message, IFLA_IFNAME, name) >= 0);
|
||||
assert(sd_rtnl_message_append_ether_addr(message, IFLA_ADDRESS, ether_aton(mac)) >= 0);
|
||||
assert(sd_rtnl_message_append_u32(message, IFLA_MTU, mtu) >= 0);
|
||||
@@ -66,7 +66,7 @@ static void test_link_get(sd_rtnl *rtnl, int ifindex) {
|
||||
void *data;
|
||||
uint16_t type;
|
||||
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
assert(m);
|
||||
|
||||
/* u8 test cases */
|
||||
@@ -137,7 +137,7 @@ static void test_route(void) {
|
||||
void *data;
|
||||
int r;
|
||||
|
||||
r = sd_rtnl_message_route_new(RTM_NEWROUTE, AF_INET, &req);
|
||||
r = sd_rtnl_message_new_route(RTM_NEWROUTE, AF_INET, &req);
|
||||
if (r < 0) {
|
||||
log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r));
|
||||
return;
|
||||
@@ -216,7 +216,7 @@ static void test_event_loop(int ifindex) {
|
||||
assert(ifname);
|
||||
|
||||
assert(sd_rtnl_open(0, &rtnl) >= 0);
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
|
||||
assert(sd_rtnl_call_async(rtnl, m, &link_handler, ifname, 0, NULL) >= 0);
|
||||
|
||||
@@ -250,7 +250,7 @@ static void test_async(int ifindex) {
|
||||
|
||||
assert(sd_rtnl_open(0, &rtnl) >= 0);
|
||||
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &m) >= 0);
|
||||
|
||||
assert(sd_rtnl_call_async(rtnl, m, &link_handler, ifname, 0, &serial) >= 0);
|
||||
|
||||
@@ -265,8 +265,8 @@ static void test_pipe(int ifindex) {
|
||||
|
||||
assert(sd_rtnl_open(0, &rtnl) >= 0);
|
||||
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &m1) >= 0);
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, ifindex, &m2) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &m1) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, ifindex, &m2) >= 0);
|
||||
|
||||
counter ++;
|
||||
assert(sd_rtnl_call_async(rtnl, m1, &pipe_handler, &counter, 0, NULL) >= 0);
|
||||
@@ -285,7 +285,7 @@ static void test_container(void) {
|
||||
uint16_t type;
|
||||
void *data;
|
||||
|
||||
assert(sd_rtnl_message_link_new(RTM_NEWLINK, 0, &m) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_NEWLINK, 0, &m) >= 0);
|
||||
|
||||
assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
|
||||
assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) == -ENOTSUP);
|
||||
@@ -365,7 +365,7 @@ int main(void) {
|
||||
|
||||
test_link_configure(rtnl, if_loopback);
|
||||
|
||||
assert(sd_rtnl_message_link_new(RTM_GETLINK, if_loopback, &m) >= 0);
|
||||
assert(sd_rtnl_message_new_link(RTM_GETLINK, if_loopback, &m) >= 0);
|
||||
assert(m);
|
||||
|
||||
assert(sd_rtnl_message_get_type(m, &type) >= 0);
|
||||
|
||||
Reference in New Issue
Block a user