]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
lldp: change order of arguments of lldp_read_*() functions
authorBeniamino Galvani <bgalvani@redhat.com>
Fri, 10 Jul 2015 16:26:06 +0000 (18:26 +0200)
committerBeniamino Galvani <bgalvani@redhat.com>
Fri, 2 Oct 2015 15:11:41 +0000 (17:11 +0200)
These functions are going to be exported, swap the 'data' and 'length'
arguments so that their signature is consistent with the rest of the
code.

src/libsystemd-network/lldp-internal.c
src/libsystemd-network/lldp-internal.h
src/libsystemd-network/sd-lldp.c

index 2906b5a4b65ba3bcc21e9533de4eb53057891f7c..76958059467dd7856ea65e25a4bbf1b54e5e39e9 100644 (file)
@@ -30,8 +30,8 @@
 
 int lldp_read_chassis_id(tlv_packet *tlv,
                          uint8_t *type,
-                         uint16_t *length,
-                         uint8_t **data) {
+                         uint8_t **data,
+                         uint16_t *length) {
         uint8_t subtype;
         int r;
 
@@ -69,8 +69,8 @@ int lldp_read_chassis_id(tlv_packet *tlv,
 
 int lldp_read_port_id(tlv_packet *tlv,
                       uint8_t *type,
-                      uint16_t *length,
-                      uint8_t **data) {
+                      uint8_t **data,
+                      uint16_t *length) {
         uint8_t subtype;
         char *s;
         int r;
@@ -137,8 +137,8 @@ int lldp_read_ttl(tlv_packet *tlv, uint16_t *ttl) {
 }
 
 int lldp_read_system_name(tlv_packet *tlv,
-                          uint16_t *length,
-                          char **data) {
+                          char **data,
+                          uint16_t *length) {
         char *s;
         int r;
 
@@ -161,8 +161,8 @@ int lldp_read_system_name(tlv_packet *tlv,
 }
 
 int lldp_read_system_description(tlv_packet *tlv,
-                                 uint16_t *length,
-                                 char **data) {
+                                 char **data,
+                                 uint16_t *length) {
         char *s;
         int r;
 
@@ -185,8 +185,8 @@ int lldp_read_system_description(tlv_packet *tlv,
 }
 
 int lldp_read_port_description(tlv_packet *tlv,
-                               uint16_t *length,
-                               char **data) {
+                               char **data,
+                               uint16_t *length) {
         char *s;
         int r;
 
@@ -244,7 +244,7 @@ int lldp_mib_update_objects(lldp_chassis *c, tlv_packet *tlv) {
         assert_return(c, -EINVAL);
         assert_return(tlv, -EINVAL);
 
-        r = lldp_read_port_id(tlv, &type, &length, &data);
+        r = lldp_read_port_id(tlv, &type, &data, &length);
         if (r < 0)
                 return r;
 
@@ -281,7 +281,7 @@ int lldp_mib_remove_objects(lldp_chassis *c, tlv_packet *tlv) {
         assert_return(c, -EINVAL);
         assert_return(tlv, -EINVAL);
 
-        r = lldp_read_port_id(tlv, &type, &length, &data);
+        r = lldp_read_port_id(tlv, &type, &data, &length);
         if (r < 0)
                 return r;
 
@@ -312,7 +312,7 @@ int lldp_mib_add_objects(Prioq *by_expiry,
         assert_return(neighbour_mib, -EINVAL);
         assert_return(tlv, -EINVAL);
 
-        r = lldp_read_chassis_id(tlv, &subtype, &length, &data);
+        r = lldp_read_chassis_id(tlv, &subtype, &data, &length);
         if (r < 0)
                 goto drop;
 
@@ -452,7 +452,7 @@ int lldp_neighbour_port_new(lldp_chassis *c,
 
         assert(tlv);
 
-        r = lldp_read_port_id(tlv, &type, &length, &data);
+        r = lldp_read_port_id(tlv, &type, &data, &length);
         if (r < 0)
                 return r;
 
@@ -505,7 +505,7 @@ int lldp_chassis_new(tlv_packet *tlv,
 
         assert(tlv);
 
-        r = lldp_read_chassis_id(tlv, &type, &length, &data);
+        r = lldp_read_chassis_id(tlv, &type, &data, &length);
         if (r < 0)
                 return r;
 
index f4eadbb87e6ad34949d69d830558c8fc97782a21..c61080828bda228fdf5a5a1a583edb47f5fac032 100644 (file)
@@ -86,13 +86,13 @@ int lldp_mib_update_objects(lldp_chassis *c, tlv_packet *tlv);
 int lldp_mib_add_objects(Prioq *by_expiry, Hashmap *neighbour_mib, tlv_packet *tlv);
 int lldp_mib_remove_objects(lldp_chassis *c, tlv_packet *tlv);
 
-int lldp_read_chassis_id(tlv_packet *tlv, uint8_t *type, uint16_t *length, uint8_t **data);
-int lldp_read_port_id(tlv_packet *tlv, uint8_t *type, uint16_t *length, uint8_t **data);
+int lldp_read_chassis_id(tlv_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length);
+int lldp_read_port_id(tlv_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length);
 int lldp_read_ttl(tlv_packet *tlv, uint16_t *ttl);
-int lldp_read_system_name(tlv_packet *tlv, uint16_t *length, char **data);
-int lldp_read_system_description(tlv_packet *tlv, uint16_t *length, char **data);
+int lldp_read_system_name(tlv_packet *tlv, char **data, uint16_t *length);
+int lldp_read_system_description(tlv_packet *tlv, char **data, uint16_t *length);
 int lldp_read_system_capability(tlv_packet *tlv, uint16_t *data);
-int lldp_read_port_description(tlv_packet *tlv, uint16_t *length, char **data);
+int lldp_read_port_description(tlv_packet *tlv, char **data, uint16_t *length);
 
 int lldp_handle_packet(tlv_packet *m, uint16_t length);
 #define log_lldp(fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "LLDP: " fmt, ##__VA_ARGS__)
index 53cd19a750ddfe96a848ca1a44f364734ca1e120..5a03ab444873cb1f58ecc33b07a447ee74737135 100644 (file)
@@ -455,7 +455,7 @@ int sd_lldp_save(sd_lldp *lldp, const char *lldp_file) {
                         _cleanup_free_ char *s = NULL;
                         char *k, *t;
 
-                        r = lldp_read_chassis_id(p->packet, &type, &length, &mac);
+                        r = lldp_read_chassis_id(p->packet, &type, &mac, &length);
                         if (r < 0)
                                 continue;
 
@@ -468,7 +468,7 @@ int sd_lldp_save(sd_lldp *lldp, const char *lldp_file) {
                                 goto fail;
                         }
 
-                        r = lldp_read_port_id(p->packet, &type, &length, &port_id);
+                        r = lldp_read_port_id(p->packet, &type, &port_id, &length);
                         if (r < 0)
                                 continue;
 
@@ -513,7 +513,7 @@ int sd_lldp_save(sd_lldp *lldp, const char *lldp_file) {
                         free(s);
                         s = k;
 
-                        r = lldp_read_system_name(p->packet, &length, &k);
+                        r = lldp_read_system_name(p->packet, &k, &length);
                         if (r < 0)
                                 k = strappend(s, "'_NAME=N/A' ");
                         else {