1 // ddm_userland_interface.h 2 3 #ifndef _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H 4 #define _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H 5 6 #include <OS.h> 7 8 #include <DiskDeviceDefs.h> 9 10 #include <disk_device_manager.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 // userland partition representation 17 typedef struct user_partition_data user_partition_data; 18 struct user_partition_data { 19 partition_id id; 20 off_t offset; 21 off_t size; 22 off_t content_size; 23 uint32 block_size; 24 uint32 status; 25 uint32 flags; 26 dev_t volume; 27 int32 index; 28 int32 change_counter; // needed? 29 disk_system_id disk_system; 30 char *name; 31 char *content_name; 32 char *type; 33 char *content_type; 34 char *parameters; 35 char *content_parameters; 36 void *user_data; 37 int32 child_count; 38 user_partition_data *children[1]; 39 }; 40 41 // userland disk device representation 42 typedef struct user_disk_device_data { 43 uint32 device_flags; 44 char *path; 45 user_partition_data device_partition_data; 46 } user_disk_device_data; 47 48 // userland disk system representation 49 typedef struct user_disk_system_info { 50 disk_system_id id; 51 char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH? 52 char pretty_name[B_OS_NAME_LENGTH]; 53 uint32 flags; 54 } user_disk_system_info; 55 56 // userland disk device job representation 57 typedef struct user_disk_device_job_info { 58 disk_job_id id; 59 uint32 type; 60 partition_id partition; 61 char description[256]; 62 } user_disk_device_job_info; 63 64 65 /*! Syscalls entries */ 66 67 // iterating, retrieving device/partition data 68 partition_id _user_get_next_disk_device_id(int32 *cookie, size_t *neededSize); 69 partition_id _user_find_disk_device(const char *filename, size_t *neededSize); 70 partition_id _user_find_partition(const char *filename, size_t *neededSize); 71 status_t _user_get_disk_device_data(partition_id deviceID, bool deviceOnly, 72 user_disk_device_data *buffer, size_t bufferSize, 73 size_t *neededSize); 74 75 partition_id _user_register_file_device(const char *filename); 76 status_t _user_unregister_file_device(partition_id deviceID, 77 const char *filename); 78 // Only a valid deviceID or filename need to be passed. The other one 79 // is -1/NULL. If both is given only filename is ignored. 80 81 // disk systems 82 status_t _user_get_disk_system_info(disk_system_id id, 83 user_disk_system_info *info); 84 status_t _user_get_next_disk_system_info(int32 *cookie, 85 user_disk_system_info *info); 86 status_t _user_find_disk_system(const char *name, user_disk_system_info *info); 87 88 // disk device modification 89 status_t _user_defragment_partition(partition_id partitionID, 90 int32* changeCounter); 91 status_t _user_repair_partition(partition_id partitionID, int32* changeCounter, 92 bool checkOnly); 93 status_t _user_resize_partition(partition_id partitionID, int32* changeCounter, 94 partition_id childID, int32* childChangeCounter, off_t size, 95 off_t contentSize); 96 status_t _user_move_partition(partition_id partitionID, int32* changeCounter, 97 partition_id childID, int32* childChangeCounter, 98 off_t newOffset, partition_id* descendantIDs, 99 int32* descendantChangeCounters, int32 descendantCount); 100 status_t _user_set_partition_name(partition_id partitionID, 101 int32* changeCounter, partition_id childID, 102 int32* childChangeCounter, const char* name); 103 status_t _user_set_partition_content_name(partition_id partitionID, 104 int32* changeCounter, const char* name); 105 status_t _user_set_partition_type(partition_id partitionID, 106 int32* changeCounter, partition_id childID, 107 int32* childChangeCounter, const char* type); 108 status_t _user_set_partition_parameters(partition_id partitionID, 109 int32* changeCounter, partition_id childID, 110 int32* childChangeCounter, const char* parameters, 111 size_t parametersSize); 112 status_t _user_set_partition_content_parameters(partition_id partitionID, 113 int32* changeCounter, const char* parameters, 114 size_t parametersSize); 115 status_t _user_initialize_partition(partition_id partitionID, 116 int32* changeCounter, const char* diskSystemName, 117 const char* name, const char* parameters, 118 size_t parametersSize); 119 status_t _user_uninitialize_partition(partition_id partitionID, 120 int32* changeCounter); 121 122 status_t _user_create_child_partition(partition_id partitionID, 123 int32* changeCounter, off_t offset, off_t size, 124 const char* type, const char* name, const char* parameters, 125 size_t parametersSize, partition_id* childID, 126 int32* childChangeCounter); 127 status_t _user_delete_child_partition(partition_id partitionID, 128 int32* changeCounter, partition_id childID, 129 int32 childChangeCounter); 130 131 #ifdef __cplusplus 132 } 133 #endif 134 135 #endif // _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H 136