OpenBSD manual page server

Manual Page Search Parameters

CONFIG_ATTACH(9) Kernel Developer's Manual CONFIG_ATTACH(9)

config_attach, config_detach, config_detach_childrenattach and detach devices

#include <sys/param.h>
#include <sys/device.h>

struct device *
config_attach(struct device *parent, void *cf, void *aux, cfprint_t print);

int
config_detach(struct device *dev, int flags);

int
config_detach_children(struct device *parent, int flags);

The () function attaches a found device. Memory is allocated for the softc structure and the driver's attach function is called according to the configuration table. If successful, config_attach() returns the softc. If unsuccessful, it returns NULL.

The () function is called by the parent to detach the child device. The second argument flags contains detachment flags:

#define	DETACH_FORCE	0x01	/* Force detachment; hardware gone */
#define	DETACH_QUIET	0x02	/* Don't print a notice */

config_detach() is always called from process context, allowing tsleep(9) to be called while the device detaches itself (to deal with processes which have a device open).

config_detach() returns zero if successful and an error code otherwise.

config_found(9)

December 5, 2014 OpenBSD-7.1