My Kernel v0.1.0
device Struct Reference

Represents a device inside the kernel. More...

#include <device.h>

Data Fields

node_t this
 Used to list devices, internal use only.
 
const char * name
 The name of the device.
 
driver_tdriver
 The driver for this device.
 
const struct file_operationsfops
 Operations applied to the device's underlying file. More...
 
struct vnodevnode
 This device's vnode, used by the VFS.
 

Detailed Description

This structure is typically embedded in a more specific "per-bus" device-structure. It contains the basic information shared across all types of device, necessary for enumeration, synchronization, etc.

The bulk of the interactions should be performed through the device's bus's API (e.g. there could exist a pci_read(struct pci_device *dev) function to read from a pci device).

See also
device_driver for en example of this concept applied to drivers

Field Documentation

◆ fops

const struct file_operations* device::fops

Used by the VFS when interacting with a file opened from the devtmpfs. This should be generally filled in by the driver-type API, and not by the device's driver's init function.

See also
file_operations

The documentation for this struct was generated from the following file: