diff options
author | csapuntz <csapuntz@openbsd.org> | 2000-04-09 19:23:18 +0000 |
---|---|---|
committer | csapuntz <csapuntz@openbsd.org> | 2000-04-09 19:23:18 +0000 |
commit | 07e3414a332b23aba4b16d6b0302cf906684f033 (patch) | |
tree | 9320f1817946e04c202c3f1cc3869b06b0e2c550 /sys/sys/device.h | |
parent | Add a missing ``break'' (diff) | |
download | wireguard-openbsd-07e3414a332b23aba4b16d6b0302cf906684f033.tar.xz wireguard-openbsd-07e3414a332b23aba4b16d6b0302cf906684f033.zip |
Added config_detach_children, config_activate_children.
Added ref counting to devices: device_ref, device_unref and a new method
for devices : ca_zeroref, called when the ref count hits zero.
Note that ca_zeroref may be called from interrupt context.
Diffstat (limited to 'sys/sys/device.h')
-rw-r--r-- | sys/sys/device.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/sys/device.h b/sys/sys/device.h index 5db3220c683..4b319b84125 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.17 1999/08/08 00:37:09 niklas Exp $ */ +/* $OpenBSD: device.h,v 1.18 2000/04/09 19:23:18 csapuntz Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -71,6 +71,8 @@ enum devact { DVACT_DEACTIVATE, /* deactivate the device */ }; +#include <sys/lock.h> + struct device { enum devclass dv_class; /* this device's classification */ TAILQ_ENTRY(device) dv_list; /* entry on list of all devices */ @@ -79,6 +81,7 @@ struct device { char dv_xname[16]; /* external name (name + unit) */ struct device *dv_parent; /* pointer to parent device */ int dv_flags; /* misc. flags; see below */ + int dv_ref; /* ref count */ }; /* dv_flags */ @@ -142,6 +145,7 @@ struct cfattach { void (*ca_attach) __P((struct device *, struct device *, void *)); int (*ca_detach) __P((struct device *, int)); int (*ca_activate) __P((struct device *, enum devact)); + void (*ca_zeroref) __P((struct device *)); }; /* Flags given to config_detach(), and the ca_detach function. */ @@ -197,13 +201,19 @@ struct device *config_rootfound __P((char *, void *)); void config_scan __P((cfscan_t, struct device *)); struct device *config_attach __P((struct device *, void *, void *, cfprint_t)); int config_detach __P((struct device *, int)); +int config_detach_children __P((struct device *, int)); int config_activate __P((struct device *)); int config_deactivate __P((struct device *)); +int config_activate_children __P((struct device *, enum devact)); struct device *config_make_softc __P((struct device *parent, struct cfdata *cf)); void config_defer __P((struct device *, void (*)(struct device *))); void evcnt_attach __P((struct device *, const char *, struct evcnt *)); +struct device *device_lookup __P((struct cfdriver *, int unit)); +void device_ref __P((struct device *)); +void device_unref __P((struct device *)); + /* compatibility definitions */ #define config_found(d, a, p) config_found_sm((d), (a), (p), NULL) #if 0 |