From: Michael Tremer Date: Sun, 11 Jun 2023 13:09:41 +0000 (+0000) Subject: zones: Move "struct nw_zone" into header X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=416ba6cd142bc5006b1c977bec86fc12dfffc80c;p=network.git zones: Move "struct nw_zone" into header Signed-off-by: Michael Tremer --- diff --git a/src/networkd/port-vlan.h b/src/networkd/port-vlan.h index e17f7e7a..c8072389 100644 --- a/src/networkd/port-vlan.h +++ b/src/networkd/port-vlan.h @@ -47,7 +47,7 @@ struct nw_port_vlan { // If the parent has not been read from the configuration we will // save the name and try to find it later. - char __parent_name[IF_NAMESIZE]; + char __parent_name[IFNAMSIZ]; }; extern const nw_port_type_t nw_port_type_vlan; diff --git a/src/networkd/port.h b/src/networkd/port.h index 3cbe4b09..422a65f2 100644 --- a/src/networkd/port.h +++ b/src/networkd/port.h @@ -25,10 +25,6 @@ #include -#ifndef IF_NAMESIZE -#define IF_NAMESIZE 16 -#endif - #define PORT_CONFIG_DIR CONFIG_DIR "/ports" typedef struct nw_port nw_port; @@ -82,7 +78,7 @@ struct nw_port { nw_link* link; const nw_port_type_t* type; - char name[IF_NAMESIZE]; + char name[IFNAMSIZ]; // Configuration nw_config *config; diff --git a/src/networkd/zone.c b/src/networkd/zone.c index 19d221fb..1610dc0c 100644 --- a/src/networkd/zone.c +++ b/src/networkd/zone.c @@ -38,19 +38,6 @@ static const nw_string_table_t nw_zone_type_id[] = { NW_STRING_TABLE_LOOKUP(nw_zone_type_id_t, nw_zone_type_id) -struct nw_zone { - nw_daemon* daemon; - int nrefs; - - // Link - nw_link* link; - - char name[NETWORK_ZONE_NAME_MAX_LENGTH]; - - // Configuration - nw_config *config; -}; - static void nw_zone_free(nw_zone* zone) { if (zone->link) nw_link_unref(zone->link); diff --git a/src/networkd/zone.h b/src/networkd/zone.h index 6ab951b4..2d1e1dc0 100644 --- a/src/networkd/zone.h +++ b/src/networkd/zone.h @@ -23,7 +23,6 @@ #define ZONE_CONFIG_DIR CONFIG_DIR "/zones" -#define NETWORK_ZONE_NAME_MAX_LENGTH 16 #define NETWORK_ZONE_DEFAULT_MTU 1500 typedef struct nw_zone nw_zone; @@ -32,10 +31,25 @@ typedef enum nw_zone_type_id { __EMPTY } nw_zone_type_id_t; +#include #include #include "config.h" #include "daemon.h" +#include "link.h" + +struct nw_zone { + nw_daemon* daemon; + int nrefs; + + // Link + nw_link* link; + + char name[IFNAMSIZ]; + + // Configuration + nw_config *config; +}; int nw_zone_create(nw_zone** zone, nw_daemon* daemon, const nw_zone_type_id_t type, const char* name, nw_config* config);