OpenBSD manual page server

Manual Page Search Parameters

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

mountroothook_establish, mountroothook_disestablishadd or remove a mountroot hook

#include <sys/types.h>
#include <sys/systm.h>

void *
mountroothook_establish(void (*fn)(void *), void *arg);

void
mountroothook_disestablish(void *cookie);

The () function adds fn to the list of hooks invoked by domountroothooks(9) at mountroot. When invoked, the hook function fn will be passed arg as its only argument.

The () function removes the hook described by the opaque pointer cookie from the list of hooks to be invoked at mountroot. If cookie is invalid, the result of mountroothook_disestablish() is undefined.

Mountroot hooks should be used to perform one-time activities that must happen immediately after the root filesystem has been mounted by the kernel, but before init(8) has been started.

Mountroot hooks are, like startup hooks, implemented via the more general dohooks(9) API.

If successful, mountroothook_establish() returns an opaque pointer describing the newly established mountroot hook. Otherwise, it returns NULL.

It may be appropriate to use a mountroot hook to split the attach function of a device driver. Once the root filesystem is mounted, the hook will be called and it is safe to use loadfirmware(9) to get the firmware out of the filesystem.

dohooks(9), domountroothooks(9), dostartuphooks(9)

The names are clumsy, at best.

June 4, 2013 OpenBSD-5.4