xref: /haiku/docs/develop/drivers/disk/ioctls.rst (revision 3d4afef9cba2f328e238089d4609d00d4b1524f3)
1Disk driver ioctls
2==================
3
4Here is a list of ioctls usually implemented by disk devices.
5
6B_GET_DEVICE_SIZE
7-----------------
8
9The parameter is a size_t and is filled with the disk size in bytes.
10This is limited to 4GB and not very useful. B_GET_GEOMETRY is used instead.
11
12B_GET_GEOMETRY
13--------------
14
15The parameter is a device_geometry structure to be filled with the device geometry.
16
17B_GET_ICON_NAME
18---------------
19
20Deprecated. Get the name of an icon to use. The icons are hardcoded in Tracker.
21
22B_GET_VECTOR_ICON
23-----------------
24
25The parameter is a device_icon structure to be populated with the icon data in HVIF format.
26This icon is then used to show the disk in Tracker, for example.
27
28B_EJECT_DEVICE
29--------------
30
31Eject the device (for removable devices).
32
33B_LOAD_MEDIA
34------------
35
36Load the device (reverse of eject) if possible.
37
38B_FLUSH_DRIVE_CACHE
39-------------------
40
41Make sure all data is stored on persistent storage and not in caches (including any caching inside
42the device)
43
44B_TRIM_DEVICE
45-------------
46
47The parameter is an fs_trim_data structure. It is guaranteed to be in kernel memory because
48the partition manager pre-processes requests coming from userland and makes sure no sectors
49are outside the partition range for a specific partition device.
50
51Mark the listed areas on disk as unused, allowing future reads to these areas to return
52random data or read errors. Flash memory devices (SSD, MMC, ...) may use this information
53to optimize their internal storage.
54