Added B_TRIM_DEVICE ioctl.

This commit is contained in:
Axel Dörfler
2013-11-07 19:01:24 +01:00
parent 34ce2cefc8
commit 29a8450843
3 changed files with 31 additions and 6 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2011, Haiku Inc. All Rights Reserved. * Copyright 2002-2013, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _DRIVERS_DRIVERS_H #ifndef _DRIVERS_DRIVERS_H
@@ -106,6 +106,7 @@ enum {
B_GET_ICON_NAME, /* get an icon name identifier */ B_GET_ICON_NAME, /* get an icon name identifier */
B_GET_VECTOR_ICON, /* retrieves the device's vector icon */ B_GET_VECTOR_ICON, /* retrieves the device's vector icon */
B_GET_DEVICE_NAME, /* get name, string buffer */ B_GET_DEVICE_NAME, /* get name, string buffer */
B_TRIM_DEVICE, /* trims blocks, see fs_trim_data */
B_GET_NEXT_OPEN_DEVICE = 1000, /* obsolete, will be removed */ B_GET_NEXT_OPEN_DEVICE = 1000, /* obsolete, will be removed */
B_ADD_FIXED_DRIVER, /* obsolete, will be removed */ B_ADD_FIXED_DRIVER, /* obsolete, will be removed */
@@ -169,6 +170,14 @@ typedef struct {
} device_icon; } device_icon;
/* B_TRIM_DEVICE data structure */
typedef struct {
off_t offset; /* offset (in bytes) */
off_t size;
off_t trimmed_size; /* filled on return */
} fs_trim_data;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@@ -435,6 +435,10 @@
#define B_SET_INTERRUPTABLE_IO FSSH_B_SET_INTERRUPTABLE_IO #define B_SET_INTERRUPTABLE_IO FSSH_B_SET_INTERRUPTABLE_IO
#define B_FLUSH_DRIVE_CACHE FSSH_B_FLUSH_DRIVE_CACHE #define B_FLUSH_DRIVE_CACHE FSSH_B_FLUSH_DRIVE_CACHE
#define B_GET_PATH_FOR_DEVICE FSSH_B_GET_PATH_FOR_DEVICE #define B_GET_PATH_FOR_DEVICE FSSH_B_GET_PATH_FOR_DEVICE
#define B_GET_ICON_NAME FSSH_B_GET_ICON_NAME
#define B_GET_VECTOR_ICON FSSH_B_GET_VECTOR_ICON
#define B_GET_DEVICE_NAME FSSH_B_GET_DEVICE_NAME
#define B_TRIM_DEVICE FSSH_B_TRIM_DEVICE
#define B_GET_NEXT_OPEN_DEVICE FSSH_B_GET_NEXT_OPEN_DEVICE #define B_GET_NEXT_OPEN_DEVICE FSSH_B_GET_NEXT_OPEN_DEVICE
#define B_ADD_FIXED_DRIVER FSSH_B_ADD_FIXED_DRIVER #define B_ADD_FIXED_DRIVER FSSH_B_ADD_FIXED_DRIVER
#define B_REMOVE_FIXED_DRIVER FSSH_B_REMOVE_FIXED_DRIVER #define B_REMOVE_FIXED_DRIVER FSSH_B_REMOVE_FIXED_DRIVER
@@ -462,6 +466,7 @@
#define driver_path fssh_driver_path #define driver_path fssh_driver_path
#define open_device_iterator fssh_open_device_iterator #define open_device_iterator fssh_open_device_iterator
#define device_icon fssh_device_icon #define device_icon fssh_device_icon
#define fs_trim_data fssh_fs_trim_data
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
+16 -5
View File
@@ -60,7 +60,7 @@ fssh_status_t fssh_init_hardware(void);
const char **fssh_publish_devices(void); const char **fssh_publish_devices(void);
fssh_device_hooks *fssh_find_device(const char *name); fssh_device_hooks *fssh_find_device(const char *name);
fssh_status_t fssh_init_driver(void); fssh_status_t fssh_init_driver(void);
void fssh_uninit_driver(void); void fssh_uninit_driver(void);
extern int32_t fssh_api_version; extern int32_t fssh_api_version;
@@ -111,17 +111,20 @@ enum {
/* B_DEV_MEDIA_CHANGE_REQUESTED: user */ /* B_DEV_MEDIA_CHANGE_REQUESTED: user */
/* pressed button on drive */ /* pressed button on drive */
/* B_DEV_DOOR_OPEN: door open */ /* B_DEV_DOOR_OPEN: door open */
FSSH_B_LOAD_MEDIA, /* load the media if supported */ FSSH_B_LOAD_MEDIA, /* load the media if supported */
FSSH_B_GET_BIOS_DRIVE_ID, /* get bios id for this device */ FSSH_B_GET_BIOS_DRIVE_ID, /* get bios id for this device */
FSSH_B_SET_UNINTERRUPTABLE_IO, /* prevent cntl-C from interrupting i/o */ FSSH_B_SET_UNINTERRUPTABLE_IO, /* prevent cntl-C from interrupting i/o */
FSSH_B_SET_INTERRUPTABLE_IO, /* allow cntl-C to interrupt i/o */ FSSH_B_SET_INTERRUPTABLE_IO, /* allow cntl-C to interrupt i/o */
FSSH_B_FLUSH_DRIVE_CACHE, /* flush drive cache */ FSSH_B_FLUSH_DRIVE_CACHE, /* flush drive cache */
FSSH_B_GET_PATH_FOR_DEVICE, /* get the absolute path of the device */ FSSH_B_GET_PATH_FOR_DEVICE, /* get the absolute path of the device */
FSSH_B_GET_ICON_NAME, /* get an icon name identifier */
FSSH_B_GET_VECTOR_ICON, /* retrieves the device's vector icon */
FSSH_B_GET_DEVICE_NAME, /* get name, string buffer */
FSSH_B_TRIM_DEVICE, /* trims blocks, see fs_trim_data */
FSSH_B_GET_NEXT_OPEN_DEVICE = 1000, /* iterate through open devices */ FSSH_B_GET_NEXT_OPEN_DEVICE = 1000, /* iterate through open devices */
FSSH_B_ADD_FIXED_DRIVER, /* private */ FSSH_B_ADD_FIXED_DRIVER, /* private */
@@ -196,7 +199,7 @@ typedef char fssh_driver_path[256];
typedef struct { typedef struct {
uint32_t cookie; /* must be set to 0 before iterating */ uint32_t cookie; /* must be set to 0 before iterating */
char device[256]; /* device path */ char device[256]; /* device path */
} fssh_open_device_iterator; } fssh_open_device_iterator;
@@ -210,6 +213,14 @@ typedef struct {
} fssh_device_icon; } fssh_device_icon;
/* B_TRIM_DEVICE data structure */
typedef struct {
fssh_off_t offset; /* offset (in bytes) */
fssh_off_t size;
fssh_off_t trimmed_size; /* filled on return */
} fssh_fs_trim_data;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif