nss-myhostname: following the usual naming scheme for .c/.h files
authorLennart Poettering <lennart@poettering.net>
Thu, 10 Jul 2014 18:12:07 +0000 (20:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 10 Jul 2014 18:25:21 +0000 (20:25 +0200)
Makefile.am
src/nss-myhostname/addresses.c [moved from src/nss-myhostname/netlink.c with 97% similarity]
src/nss-myhostname/addresses.h [moved from src/nss-myhostname/ifconf.h with 89% similarity]
src/nss-myhostname/nss-myhostname.c

index 5050820..425a5e1 100644 (file)
@@ -4398,8 +4398,8 @@ endif
 if HAVE_MYHOSTNAME
 libnss_myhostname_la_SOURCES = \
        src/nss-myhostname/nss-myhostname.c \
-       src/nss-myhostname/ifconf.h \
-       src/nss-myhostname/netlink.c
+       src/nss-myhostname/addresses.h \
+       src/nss-myhostname/addresses.c
 
 libnss_myhostname_la_LDFLAGS = \
        $(AM_LDFLAGS) \
similarity index 97%
rename from src/nss-myhostname/netlink.c
rename to src/nss-myhostname/addresses.c
index e9518e3..d75e850 100644 (file)
@@ -23,7 +23,7 @@
 #include "sd-rtnl.h"
 #include "rtnl-util.h"
 #include "macro.h"
-#include "ifconf.h"
+#include "addresses.h"
 
 static int address_compare(const void *_a, const void *_b) {
         const struct address *a = _a, *b = _b;
@@ -48,7 +48,7 @@ static int address_compare(const void *_a, const void *_b) {
         return 0;
 }
 
-int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {
+int acquire_addresses(struct address **_list, unsigned *_n_list) {
         _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
         _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
         _cleanup_free_ struct address *list = NULL;
similarity index 89%
rename from src/nss-myhostname/ifconf.h
rename to src/nss-myhostname/addresses.h
index 92f03b2..1bfb357 100644 (file)
@@ -29,9 +29,8 @@
 #include "socket-util.h"
 
 struct address {
-        unsigned char family;
+        unsigned char family, scope;
         union in_addr_union address;
-        unsigned char scope;
         int ifindex;
 };
 
@@ -41,4 +40,4 @@ static inline size_t PROTO_ADDRESS_SIZE(int proto) {
         return proto == AF_INET6 ? 16 : 4;
 }
 
-int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list);
+int acquire_addresses(struct address **_list, unsigned *_n_list);
index 9320e69..6551ac9 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdlib.h>
 #include <arpa/inet.h>
 
-#include "ifconf.h"
+#include "addresses.h"
 #include "macro.h"
 
 /* Ensure that glibc's assert is used. We cannot use assert from macro.h, as
@@ -137,7 +137,7 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
                 }
 
                 /* If this fails, n_addresses is 0. Which is fine */
-                ifconf_acquire_addresses(&addresses, &n_addresses);
+                acquire_addresses(&addresses, &n_addresses);
 
                 canonical = hn;
                 local_address_ipv4 = LOCALADDRESS_IPV4;
@@ -389,7 +389,7 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
                         return NSS_STATUS_NOTFOUND;
                 }
 
-                ifconf_acquire_addresses(&addresses, &n_addresses);
+                acquire_addresses(&addresses, &n_addresses);
 
                 canonical = hn;
                 additional = n_addresses <= 0 && af == AF_INET6 ? "localhost" : NULL;
@@ -492,7 +492,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
                 return NSS_STATUS_UNAVAIL;
         }
 
-        ifconf_acquire_addresses(&addresses, &n_addresses);
+        acquire_addresses(&addresses, &n_addresses);
 
         for (a = addresses, n = 0; n < n_addresses; n++, a++) {
                 if (af != a->family)