#define	ROOT ((device_t)NULL)

struct cfdriver {
	LIST_ENTRY(cfdriver) cd_list;				/* link on allcfdrivers */
	struct cfattachlist cd_attach;				/* list of all attachments */
	void				**cd_devs;				/* devices found */
	const char			*cd_name;				/* device name */
	enum devclass		cd_class;				/* device classification */
	int					cd_ndevs;				/* size of cd_devs array */
	const struct cfiattrdata * const *cd_attrs; /* attributes provided */
};

struct cfattachinit {
	const char *cfai_name;				/* driver name */
	struct cfattach * const *cfai_list;	/* list of attachments */
};

struct cfattach {
	const char *ca_name;								/* name of attachment */
	LIST_ENTRY(cfattach) ca_list;						/* link on cfdriver's list */
	size_t				 ca_devsize;					/* size of dev data (for malloc) */
	int					(*ca_match)(device_t, cfdata_t, void *);
	void				(*ca_attach)(device_t, device_t, void *);
	int					(*ca_detach)(device_t, int);
	int					(*ca_activate)(device_t, devact_t);
	/* technically, the next 2 belong into "struct cfdriver" */
	int					(*ca_rescan)(device_t, const char *, const int *); /* scan for new children */
	void				(*ca_childdetached)(device_t, device_t);
};

typedef struct cfdata *cfdata_t;
struct cfdata {
	const char *cf_name;		/* driver name */
	const char *cf_atname;		/* attachment name */
	short		cf_unit;		/* unit number */
	short		cf_fstate;		/* finding state (below) */
	int			*cf_loc;		/* locators (machine dependent) */
	int			cf_flags;		/* flags from config */
	const struct cfparent *cf_pspec;/* parent specification */
};

struct device {
	devclass_t			dv_class;		/* this device's classification */
	TAILQ_ENTRY(device) dv_list;		/* entry on list of all devices */
	cfdata_t			dv_cfdata;		/* config data that found us (NULL if pseudo-device) */
	cfdriver_t			dv_cfdriver;	/* our cfdriver */
	cfattach_t			dv_cfattach;	/* our cfattach */
	int					dv_unit;		/* device unit number */
	char				dv_xname[16];	/* external name (name + unit) */
	device_t			dv_parent;		/* pointer to parent device (NULL if pesudo- or root node) */
	int					dv_flags;		/* misc. flags; see below */
	int					*dv_locators;	/* our actual locators (optional) */
//	prop_dictionary_t dv_properties;/* properties dictionary */
};
