chiark / gitweb /
sd-network: rename operstates 'down' -> 'off' and 'up' -> 'no-carrier'
authorTom Gundersen <teg@jklm.no>
Wed, 13 Aug 2014 20:44:35 +0000 (22:44 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 13 Aug 2014 20:44:41 +0000 (22:44 +0200)
Suggested by Lennart and Kay.

src/network/networkd-link.c
src/network/networkd-link.h
src/network/networkd-manager.c
src/systemd/sd-network.h

index 398e8baac905d5cc5262a2990d6bf247e0b0ce88..908d834cd44e602e38df67182fc4b08bea9391ba 100644 (file)
@@ -1657,9 +1657,9 @@ static void link_update_operstate(Link *link) {
                         /* no useful addresses found */
                         link->operstate = LINK_OPERSTATE_CARRIER;
         } else if (link->flags & IFF_UP)
-                link->operstate = LINK_OPERSTATE_UP;
+                link->operstate = LINK_OPERSTATE_NO_CARRIER;
         else
-                link->operstate = LINK_OPERSTATE_DOWN;
+                link->operstate = LINK_OPERSTATE_OFF;
 }
 
 int link_save(Link *link) {
@@ -1793,8 +1793,8 @@ static const char* const link_state_table[_LINK_STATE_MAX] = {
 DEFINE_STRING_TABLE_LOOKUP(link_state, LinkState);
 
 static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
-        [LINK_OPERSTATE_DOWN] = "down",
-        [LINK_OPERSTATE_UP] = "up",
+        [LINK_OPERSTATE_OFF] = "off",
+        [LINK_OPERSTATE_NO_CARRIER] = "no-carrier",
         [LINK_OPERSTATE_DORMANT] = "dormant",
         [LINK_OPERSTATE_CARRIER] = "carrier",
         [LINK_OPERSTATE_DEGRADED] = "degraded",
index 6d58fa15849e5dfcf52fe08ee3ad48d5674fff9c..0f73ec7f9bb54022a3d0641e477fda4370d8b93f 100644 (file)
@@ -37,8 +37,8 @@ typedef enum LinkState {
 } LinkState;
 
 typedef enum LinkOperationalState {
-        LINK_OPERSTATE_DOWN,
-        LINK_OPERSTATE_UP,
+        LINK_OPERSTATE_OFF,
+        LINK_OPERSTATE_NO_CARRIER,
         LINK_OPERSTATE_DORMANT,
         LINK_OPERSTATE_CARRIER,
         LINK_OPERSTATE_DEGRADED,
index ff6c71db35e81ffc6690e0c457e603c5579878f8..e3d72edeceac2c4c9723c52002f102d96284fb19 100644 (file)
@@ -456,7 +456,7 @@ int manager_save(Manager *m) {
         Iterator i;
         _cleanup_free_ char *temp_path = NULL;
         _cleanup_fclose_ FILE *f = NULL;
-        LinkOperationalState operstate = LINK_OPERSTATE_DOWN;
+        LinkOperationalState operstate = LINK_OPERSTATE_OFF;
         const char *operstate_str;
         int r;
 
index 49034e84d02150345a13f2c5a4b33afea24f8117..dede7aea3de76a5364002c830040d98a0ef18a4f 100644 (file)
@@ -78,7 +78,13 @@ int sd_network_get_ntp(char ***addr);
 int sd_network_link_get_state(int ifindex, char **state);
 
 /* Get operatinal state from ifindex.
- * Possible states: down, up, dormant, carrier, degraded, routable
+ * Possible states:
+ *   off: the device is powered down
+ *   no-carrier: the device is powered up, but it does not yet have a carrier
+ *   dormant: the device has a carrier, but is not yet ready for normal traffic
+ *   carrier: the link has a carrier
+ *   degraded: the link has carrier and addresses valid on the local link configured
+ *   routable: the link has carrier and routable address configured
  * Possible return codes:
  *   -ENODATA: networkd is not aware of the link
  */