summaryrefslogtreecommitdiffstats
path: root/sys/net/if.h
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-03-11 09:26:07 +0000
committermux <mux@FreeBSD.org>2002-03-11 09:26:07 +0000
commit9a5e4c88a3c8f122fd226c41249210b7d9a95ab7 (patch)
treeead93d76aaa7a11f5c58953041c77a386e18fc64 /sys/net/if.h
parent352806ecf32064d3f84e690dc624e0a0aac0507b (diff)
downloadFreeBSD-src-9a5e4c88a3c8f122fd226c41249210b7d9a95ab7.zip
FreeBSD-src-9a5e4c88a3c8f122fd226c41249210b7d9a95ab7.tar.gz
Simplify the interface cloning framework by handling unit
unit allocation with a bitmap in the generic layer. This allows us to get rid of the duplicated rman code in every clonable interface. Reviewed by: brooks Approved by: phk
Diffstat (limited to 'sys/net/if.h')
-rw-r--r--sys/net/if.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index 0b6b733..8790560 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -55,6 +55,7 @@ struct ifnet;
*/
#define IFNAMSIZ 16
#define IF_NAMESIZE IFNAMSIZ
+#define IF_MAXUNIT 0x7fff /* ifp->if_unit is only 15 bits */
/*
* Structure describing a `cloning' interface.
@@ -63,13 +64,16 @@ struct if_clone {
LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */
const char *ifc_name; /* name of device, e.g. `gif' */
size_t ifc_namelen; /* length of name */
+ int ifc_maxunit; /* maximum unit number */
+ unsigned char *ifc_units; /* bitmap to handle units */
+ int ifc_bmlen; /* bitmap length */
- int (*ifc_create)(struct if_clone *, int *);
+ int (*ifc_create)(struct if_clone *, int);
int (*ifc_destroy)(struct ifnet *);
};
-#define IF_CLONE_INITIALIZER(name, create, destroy) \
- { { 0 }, name, sizeof(name) - 1, create, destroy }
+#define IF_CLONE_INITIALIZER(name, create, destroy, maxunit) \
+ { { 0 }, name, sizeof(name) - 1, maxunit, NULL, 0, create, destroy }
/*
* Structure used to query names of interface cloners.
OpenPOWER on IntegriCloud