From b4931cbd16645e05066e2f21b97239eac5f3eb91 Mon Sep 17 00:00:00 2001 From: Thu Nguyen Date: Fri, 7 Jun 2024 00:04:23 +0000 Subject: [PATCH] mctp-link: move the netlink structs to header file Move the `linkmap_entry` and `linkmap_entry` struct definition to header file. This helps others source files can include and use those structs easily. Signed-off-by: Thu Nguyen --- src/mctp-netlink.c | 28 ---------------------------- src/mctp-netlink.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/mctp-netlink.c b/src/mctp-netlink.c index 34fb668..ab0351c 100644 --- a/src/mctp-netlink.c +++ b/src/mctp-netlink.c @@ -10,7 +10,6 @@ #include -#include #include #include #include @@ -20,33 +19,6 @@ #include "mctp-util.h" #include "mctp-ops.h" -struct linkmap_entry { - int ifindex; - char ifname[IFNAMSIZ+1]; - int net; - bool up; - - mctp_eid_t *local_eids; - size_t num_local; -}; - -struct mctp_nl { - // socket for queries - int sd; - // socket for monitor - int sd_monitor; - - struct linkmap_entry *linkmap; - size_t linkmap_count; - size_t linkmap_alloc; - bool verbose; - - // allows callers to silence printf of EEXIST returns. - // TODO: this is a workaround, if more are required we should - // rework how error messages are returned to callers. - bool quiet_eexist; -}; - static int fill_local_addrs(mctp_nl *nl); static int fill_linkmap(mctp_nl *nl); static void sort_linkmap(mctp_nl *nl); diff --git a/src/mctp-netlink.h b/src/mctp-netlink.h index 31ee6b6..deb0680 100644 --- a/src/mctp-netlink.h +++ b/src/mctp-netlink.h @@ -3,12 +3,39 @@ #include #include #include +#include #include #include "mctp.h" -struct mctp_nl; +struct linkmap_entry { + int ifindex; + char ifname[IFNAMSIZ+1]; + int net; + bool up; + + mctp_eid_t *local_eids; + size_t num_local; +}; + +struct mctp_nl { + // socket for queries + int sd; + // socket for monitor + int sd_monitor; + + struct linkmap_entry *linkmap; + size_t linkmap_count; + size_t linkmap_alloc; + bool verbose; + + // allows callers to silence printf of EEXIST returns. + // TODO: this is a workaround, if more are required we should + // rework how error messages are returned to callers. + bool quiet_eexist; +}; typedef struct mctp_nl mctp_nl; +typedef struct linkmap_entry linkmap_entry; struct mctp_nl_change { #define MCTP_NL_OP_COUNT 6