sys/vfs/hammer2: Don't fail to lockinit diolk for fchain / vchain
[dragonfly.git] / stand / lib / netif.h
blob922c789c7dae0ccbb54c4a922649697f422bd151
1 /* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */
3 /* $FreeBSD: src/lib/libstand/netif.h,v 1.1.1.1.6.1 2000/09/10 01:24:16 ps Exp $ */
5 #ifndef _STAND_NETIF_H_
6 #define _STAND_NETIF_H_
8 #include "iodesc.h"
10 #define NENTS(x) sizeof(x)/sizeof(x[0])
12 struct netif_driver {
13 const char *netif_bname;
14 int (*netif_match)(struct netif *, void *);
15 int (*netif_probe)(struct netif *, void *);
16 void (*netif_init)(struct iodesc *, void *);
17 int (*netif_get)(struct iodesc *, void *, size_t, time_t);
18 int (*netif_put)(struct iodesc *, void *, size_t);
19 void (*netif_end)(struct netif *);
20 struct netif_dif *netif_ifs;
21 int netif_nifs;
24 struct netif_dif {
25 int dif_unit;
26 int dif_nsel;
27 struct netif_stats *dif_stats;
28 void *dif_private;
29 /* the following fields are used internally by the netif layer */
30 u_long dif_used;
33 struct netif_stats {
34 int collisions;
35 int collision_error;
36 int missed;
37 int sent;
38 int received;
39 int deferred;
40 int overflow;
43 struct netif {
44 struct netif_driver *nif_driver;
45 int nif_unit;
46 int nif_sel;
47 void *nif_devdata;
50 extern struct netif_driver *netif_drivers[]; /* machdep */
52 extern int netif_debug;
54 void netif_init(void);
55 struct netif *netif_select(void *);
56 int netif_probe(struct netif *, void *);
57 void netif_attach(struct netif *, struct iodesc *, void *);
58 void netif_detach(struct netif *);
59 ssize_t netif_get(struct iodesc *, void *, size_t, time_t);
60 ssize_t netif_put(struct iodesc *, void *, size_t);
62 int netif_open(void *);
63 int netif_close(int);
65 struct iodesc *socktodesc(int);
67 #endif /* !_STAND_NETIF_H_ */