April 2012
Intermediate to advanced
352 pages
8h
English
The FreeBSD kernel provides the following functions for working with disk structures:
#include <geom/geom_disk.h> struct disk * disk_alloc(void); void disk_create(struct disk *disk, int version); void disk_destroy(struct disk *disk);
A disk structure is a dynamically allocated structure that’s owned by the kernel. That is, you cannot allocate a struct disk on your own. Instead, you must call disk_alloc.
Allocating a disk structure does not make the storage device available to the system. To do that, you must initialize the structure (by defining the necessary fields) and then call disk_create. The version argument must always be DISK_VERSION.
Note that as soon as disk_create returns, the device is “live” and its ...
Read now
Unlock full access