2008-05-10 15:44:00 +04:00
|
|
|
/*
|
2011-06-13 05:27:13 +04:00
|
|
|
* Copyright 2003-2011, Haiku, Inc.
|
2008-05-10 15:44:00 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-06-10 03:04:54 +04:00
|
|
|
#ifndef _K_DISK_DEVICE_MODULES_H
|
|
|
|
#define _K_DISK_DEVICE_MODULES_H
|
|
|
|
|
2008-05-10 15:44:00 +04:00
|
|
|
//! Interface to be implemented by partitioning modules.
|
|
|
|
|
2003-06-11 02:41:02 +04:00
|
|
|
#include <disk_device_manager.h>
|
|
|
|
#include <module.h>
|
2003-06-10 03:04:54 +04:00
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2003-06-11 02:41:02 +04:00
|
|
|
|
|
|
|
typedef struct partition_module_info {
|
|
|
|
module_info module;
|
2008-05-10 15:44:00 +04:00
|
|
|
const char* short_name;
|
2007-08-23 01:21:30 +04:00
|
|
|
const char* pretty_name;
|
2003-07-18 22:41:21 +04:00
|
|
|
uint32 flags;
|
2003-06-11 02:41:02 +04:00
|
|
|
|
|
|
|
// scanning
|
2007-08-23 01:21:30 +04:00
|
|
|
// (the device is write locked)
|
|
|
|
float (*identify_partition)(int fd, partition_data* partition,
|
|
|
|
void** cookie);
|
|
|
|
status_t (*scan_partition)(int fd, partition_data* partition,
|
|
|
|
void* identifyCookie);
|
|
|
|
void (*free_identify_partition_cookie)(partition_data* partition,
|
|
|
|
void* cookie);
|
|
|
|
void (*free_partition_cookie)(partition_data* partition);
|
|
|
|
void (*free_partition_content_cookie)(partition_data* partition);
|
|
|
|
|
2003-06-11 02:41:02 +04:00
|
|
|
|
|
|
|
// querying
|
2007-08-23 01:21:30 +04:00
|
|
|
// (the device is read locked)
|
|
|
|
uint32 (*get_supported_operations)(partition_data* partition, uint32 mask);
|
|
|
|
uint32 (*get_supported_child_operations)(partition_data* partition,
|
|
|
|
partition_data* child, uint32 mask);
|
|
|
|
|
|
|
|
bool (*supports_initializing_child)(partition_data* partition,
|
|
|
|
const char* system);
|
|
|
|
bool (*is_sub_system_for)(partition_data* partition);
|
|
|
|
|
|
|
|
bool (*validate_resize)(partition_data* partition, off_t* size);
|
|
|
|
bool (*validate_resize_child)(partition_data* partition,
|
|
|
|
partition_data* child, off_t* size);
|
|
|
|
bool (*validate_move)(partition_data* partition, off_t* start);
|
|
|
|
bool (*validate_move_child)(partition_data* partition,
|
|
|
|
partition_data* child, off_t* start);
|
|
|
|
bool (*validate_set_name)(partition_data* partition, char* name);
|
|
|
|
bool (*validate_set_content_name)(partition_data* partition, char* name);
|
|
|
|
bool (*validate_set_type)(partition_data* partition, const char* type);
|
|
|
|
bool (*validate_set_parameters)(partition_data* partition,
|
|
|
|
const char* parameters);
|
|
|
|
|
|
|
|
bool (*validate_set_content_parameters)(partition_data* partition,
|
|
|
|
const char* parameters);
|
|
|
|
bool (*validate_initialize)(partition_data* partition, char* name,
|
|
|
|
const char* parameters);
|
|
|
|
bool (*validate_create_child)(partition_data* partition, off_t* start,
|
2009-07-21 00:29:16 +04:00
|
|
|
off_t* size, const char* type, const char* name,
|
|
|
|
const char* parameters, int32* index);
|
2007-08-23 01:21:30 +04:00
|
|
|
status_t (*get_partitionable_spaces)(partition_data* partition,
|
|
|
|
partitionable_space_data* buffer, int32 count,
|
|
|
|
int32* actualCount);
|
|
|
|
// When not implemented, a standard algorithm is used.
|
|
|
|
|
|
|
|
status_t (*get_next_supported_type)(partition_data* partition,
|
|
|
|
int32* cookie, char* type);
|
|
|
|
status_t (*get_type_for_content_type)(const char* contentType, char* type);
|
|
|
|
|
2003-06-11 02:41:02 +04:00
|
|
|
|
2003-07-25 02:53:23 +04:00
|
|
|
// shadow partition modification
|
2007-08-23 01:21:30 +04:00
|
|
|
// (device is write locked)
|
2007-10-07 19:39:35 +04:00
|
|
|
status_t (*shadow_changed)(partition_data* partition,
|
|
|
|
partition_data *child, uint32 operation);
|
2007-08-23 01:21:30 +04:00
|
|
|
|
2003-07-25 02:53:23 +04:00
|
|
|
|
2003-06-11 02:41:02 +04:00
|
|
|
// writing
|
2007-08-23 01:21:30 +04:00
|
|
|
// (device is NOT locked)
|
|
|
|
status_t (*repair)(int fd, partition_id partition, bool checkOnly,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*resize)(int fd, partition_id partition, off_t size,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*resize_child)(int fd, partition_id partition, off_t size,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*move)(int fd, partition_id partition, off_t offset,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*move_child)(int fd, partition_id partition, partition_id child,
|
|
|
|
off_t offset, disk_job_id job);
|
|
|
|
status_t (*set_name)(int fd, partition_id partition, const char* name,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*set_content_name)(int fd, partition_id partition,
|
|
|
|
const char* name, disk_job_id job);
|
|
|
|
status_t (*set_type)(int fd, partition_id partition, const char* type,
|
|
|
|
disk_job_id job);
|
|
|
|
status_t (*set_parameters)(int fd, partition_id partition,
|
|
|
|
const char* parameters, disk_job_id job);
|
|
|
|
status_t (*set_content_parameters)(int fd, partition_id partition,
|
|
|
|
const char* parameters, disk_job_id job);
|
|
|
|
status_t (*initialize)(int fd, partition_id partition, const char* name,
|
2007-10-05 03:48:18 +04:00
|
|
|
const char *parameters, off_t partitionSize, disk_job_id job);
|
2011-06-13 05:27:13 +04:00
|
|
|
status_t (*uninitialize)(int fd, partition_id partition,
|
2011-06-13 05:38:03 +04:00
|
|
|
off_t partitionSize, uint32 blockSize, disk_job_id job);
|
2007-08-23 01:21:30 +04:00
|
|
|
status_t (*create_child)(int fd, partition_id partition, off_t offset,
|
2011-06-13 05:27:13 +04:00
|
|
|
off_t size, const char* type, const char* name,
|
|
|
|
const char* parameters, disk_job_id job,
|
2009-07-21 00:29:16 +04:00
|
|
|
partition_id* childID);
|
2007-08-23 01:21:30 +04:00
|
|
|
// childID is used for the return value, but is also an optional input
|
|
|
|
// parameter -- -1 to be ignored
|
|
|
|
status_t (*delete_child)(int fd, partition_id partition, partition_id child,
|
|
|
|
disk_job_id job);
|
2003-06-11 02:41:02 +04:00
|
|
|
} partition_module_info;
|
2003-06-10 03:04:54 +04:00
|
|
|
|
|
|
|
#endif // _K_DISK_DEVICE_MODULES_H
|