2 * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _FSSH_DISK_DEVICE_MANAGER_H
6 #define _FSSH_DISK_DEVICE_MANAGER_H
9 #include "fssh_disk_device_defs.h"
10 #include "fssh_drivers.h"
17 // C API partition representation
18 // Fields marked [sys] are set by the system and are not to be changed by
19 // the disk system modules.
20 typedef struct fssh_partition_data
{
21 fssh_partition_id id
; // [sys]
24 fssh_off_t content_size
;
27 int32_t index
; // [sys]
30 fssh_dev_t volume
; // [sys]
31 void *mount_cookie
; // [sys]
32 char *name
; // max: B_OS_NAME_LENGTH
33 char *content_name
; //
35 const char *content_type
; // [sys]
37 char *content_parameters
;
40 } fssh_partition_data
;
42 // C API disk device representation
43 typedef struct fssh_disk_device_data
{
44 fssh_partition_id id
; // equal to that of the root partition
47 fssh_device_geometry geometry
;
48 } fssh_disk_device_data
;
50 // C API partitionable space representation
51 typedef struct fssh_partitionable_space_data
{
54 } fssh_partitionable_space_data
;
56 // operations on partitions
58 FSSH_B_PARTITION_DEFRAGMENT
,
59 FSSH_B_PARTITION_REPAIR
,
60 FSSH_B_PARTITION_RESIZE
,
61 FSSH_B_PARTITION_RESIZE_CHILD
,
62 FSSH_B_PARTITION_MOVE
,
63 FSSH_B_PARTITION_MOVE_CHILD
,
64 FSSH_B_PARTITION_SET_NAME
,
65 FSSH_B_PARTITION_SET_CONTENT_NAME
,
66 FSSH_B_PARTITION_SET_TYPE
,
67 FSSH_B_PARTITION_SET_PARAMETERS
,
68 FSSH_B_PARTITION_SET_CONTENT_PARAMETERS
,
69 FSSH_B_PARTITION_INITIALIZE
,
70 FSSH_B_PARTITION_CREATE_CHILD
,
71 FSSH_B_PARTITION_DELETE_CHILD
,
74 // disk device job cancel status
76 FSSH_B_DISK_DEVICE_JOB_CONTINUE
,
77 FSSH_B_DISK_DEVICE_JOB_CANCEL
,
78 FSSH_B_DISK_DEVICE_JOB_REVERSE
,
81 // disk device locking
82 fssh_disk_device_data
* fssh_write_lock_disk_device(
83 fssh_partition_id partitionID
);
84 void fssh_write_unlock_disk_device(
85 fssh_partition_id partitionID
);
86 fssh_disk_device_data
* fssh_read_lock_disk_device(
87 fssh_partition_id partitionID
);
88 void fssh_read_unlock_disk_device(
89 fssh_partition_id partitionID
);
90 // parameter is the ID of any partition on the device
92 // getting disk devices/partitions by path
93 // (no locking required)
94 int32_t fssh_find_disk_device(const char *path
);
95 int32_t fssh_find_partition(const char *path
);
97 // disk device/partition read access
98 // (read lock required)
99 fssh_disk_device_data
* fssh_get_disk_device(fssh_partition_id partitionID
);
100 fssh_partition_data
* fssh_get_partition(fssh_partition_id partitionID
);
101 fssh_partition_data
* fssh_get_parent_partition(
102 fssh_partition_id partitionID
);
103 fssh_partition_data
* fssh_get_child_partition(fssh_partition_id partitionID
,
106 // partition write access
107 // (write lock required)
108 fssh_partition_data
* fssh_create_child_partition(
109 fssh_partition_id partitionID
, int32_t index
,
110 fssh_partition_id childID
);
111 // childID is an optional input parameter -- -1 to be ignored
112 bool fssh_delete_partition(fssh_partition_id partitionID
);
113 void fssh_partition_modified(fssh_partition_id partitionID
);
114 // tells the disk device manager, that the parition has been modified
116 fssh_status_t
fssh_scan_partition(fssh_partition_id partitionID
);
117 // Service method for disks systems: Synchronously scans the partition.
118 // Device must not be locked.
121 fssh_disk_system_id
fssh_find_disk_system(const char *name
);
124 bool fssh_update_disk_device_job_progress(fssh_disk_job_id jobID
,
126 bool fssh_update_disk_device_job_extra_progress(fssh_disk_job_id jobID
,
128 bool fssh_set_disk_device_job_error_message(fssh_disk_job_id jobID
,
129 const char *message
);
130 uint32_t fssh_update_disk_device_job_interrupt_properties(
131 fssh_disk_job_id jobID
, uint32_t interruptProperties
);
132 // returns one of B_DISK_DEVICE_JOB_{CONTINUE,CANCEL,REVERSE}
138 #endif // _FSSH_DISK_DEVICE_MANAGER_H