1 // ddm_modules.h 2 // 3 // Interface to be implemented by partitioning modules. 4 5 #ifndef _K_DISK_DEVICE_MODULES_H 6 #define _K_DISK_DEVICE_MODULES_H 7 8 #include <disk_device_manager.h> 9 #include <module.h> 10 #include <SupportDefs.h> 11 12 13 typedef struct partition_module_info { 14 module_info module; 15 const char* pretty_name; 16 uint32 flags; 17 18 // scanning 19 // (the device is write locked) 20 float (*identify_partition)(int fd, partition_data* partition, 21 void** cookie); 22 status_t (*scan_partition)(int fd, partition_data* partition, 23 void* identifyCookie); 24 void (*free_identify_partition_cookie)(partition_data* partition, 25 void* cookie); 26 void (*free_partition_cookie)(partition_data* partition); 27 void (*free_partition_content_cookie)(partition_data* partition); 28 29 30 // querying 31 // (the device is read locked) 32 uint32 (*get_supported_operations)(partition_data* partition, uint32 mask); 33 uint32 (*get_supported_child_operations)(partition_data* partition, 34 partition_data* child, uint32 mask); 35 36 bool (*supports_initializing_child)(partition_data* partition, 37 const char* system); 38 bool (*is_sub_system_for)(partition_data* partition); 39 40 bool (*validate_resize)(partition_data* partition, off_t* size); 41 bool (*validate_resize_child)(partition_data* partition, 42 partition_data* child, off_t* size); 43 bool (*validate_move)(partition_data* partition, off_t* start); 44 bool (*validate_move_child)(partition_data* partition, 45 partition_data* child, off_t* start); 46 bool (*validate_set_name)(partition_data* partition, char* name); 47 bool (*validate_set_content_name)(partition_data* partition, char* name); 48 bool (*validate_set_type)(partition_data* partition, const char* type); 49 bool (*validate_set_parameters)(partition_data* partition, 50 const char* parameters); 51 52 bool (*validate_set_content_parameters)(partition_data* partition, 53 const char* parameters); 54 bool (*validate_initialize)(partition_data* partition, char* name, 55 const char* parameters); 56 bool (*validate_create_child)(partition_data* partition, off_t* start, 57 off_t* size, const char* type, const char* parameters, 58 int32* index); 59 status_t (*get_partitionable_spaces)(partition_data* partition, 60 partitionable_space_data* buffer, int32 count, 61 int32* actualCount); 62 // When not implemented, a standard algorithm is used. 63 64 status_t (*get_next_supported_type)(partition_data* partition, 65 int32* cookie, char* type); 66 status_t (*get_type_for_content_type)(const char* contentType, char* type); 67 68 69 // shadow partition modification 70 // (device is write locked) 71 status_t (*shadow_changed)(partition_data* partition, 72 partition_data *child, uint32 operation); 73 74 75 // writing 76 // (device is NOT locked) 77 status_t (*repair)(int fd, partition_id partition, bool checkOnly, 78 disk_job_id job); 79 status_t (*resize)(int fd, partition_id partition, off_t size, 80 disk_job_id job); 81 status_t (*resize_child)(int fd, partition_id partition, off_t size, 82 disk_job_id job); 83 status_t (*move)(int fd, partition_id partition, off_t offset, 84 disk_job_id job); 85 status_t (*move_child)(int fd, partition_id partition, partition_id child, 86 off_t offset, disk_job_id job); 87 status_t (*set_name)(int fd, partition_id partition, const char* name, 88 disk_job_id job); 89 status_t (*set_content_name)(int fd, partition_id partition, 90 const char* name, disk_job_id job); 91 status_t (*set_type)(int fd, partition_id partition, const char* type, 92 disk_job_id job); 93 status_t (*set_parameters)(int fd, partition_id partition, 94 const char* parameters, disk_job_id job); 95 status_t (*set_content_parameters)(int fd, partition_id partition, 96 const char* parameters, disk_job_id job); 97 status_t (*initialize)(int fd, partition_id partition, const char* name, 98 const char *parameters, off_t partitionSize, disk_job_id job); 99 status_t (*create_child)(int fd, partition_id partition, off_t offset, 100 off_t size, const char* type, const char* parameters, 101 disk_job_id job, partition_id* childID); 102 // childID is used for the return value, but is also an optional input 103 // parameter -- -1 to be ignored 104 status_t (*delete_child)(int fd, partition_id partition, partition_id child, 105 disk_job_id job); 106 } partition_module_info; 107 108 #endif // _K_DISK_DEVICE_MODULES_H 109