DEVICE(9) Hyra Kernel Developer’s Manual DEVICE(9)

NAME

device - hyra device subsystem

SYNOPSIS

#include <sys/device.h>

DESCRIPTION

Devices registered with the kernel are represented by the device structure:

struct device {
dev_t major, minor;
size_t blocksize;
int(*write)(struct device *dev, struct sio_txn *sio);
int(*read)(struct device *dev, struct sio_txn *sio);
int(*ioctl)(struct device *dev, uint32_t cmd, uintptr_t arg);
...
TAILQ_ENTRY(device) link;
};

Device instances are to be allocated with the device_alloc() function. These instances are registered with the kernel by the device_create() function.

The major number identifies the driver and the minor number identifies the device itself. The major number must be allocated with the device_alloc_major() function.

If the device blocksize is greater than 1, this device is considered a block device, otherwise if it is 1, it is considered a character device.

AUTHORS

Ian Moffett <ian@osmora.org>

Hyra Apr 29 2024 Hyra