2006-04-04 04:29:07 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2006, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-06-10 03:04:54 +04:00
|
|
|
#ifndef _DISK_DEVICE_MANAGER_H
|
|
|
|
#define _DISK_DEVICE_MANAGER_H
|
|
|
|
|
2006-04-04 04:29:07 +04:00
|
|
|
|
|
|
|
#include <DiskDeviceDefs.h>
|
2003-06-11 02:42:53 +04:00
|
|
|
#include <Drivers.h>
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2004-10-29 05:36:07 +04:00
|
|
|
|
2003-06-12 02:04:34 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
// C API partition representation
|
2003-07-22 04:05:38 +04:00
|
|
|
// Fields marked [sys] are set by the system and are not to be changed by
|
|
|
|
// the disk system modules.
|
2003-06-10 03:04:54 +04:00
|
|
|
typedef struct partition_data {
|
2003-07-22 04:05:38 +04:00
|
|
|
partition_id id; // [sys]
|
2003-06-10 03:04:54 +04:00
|
|
|
off_t offset;
|
|
|
|
off_t size;
|
2003-07-30 04:27:25 +04:00
|
|
|
off_t content_size;
|
2003-06-10 03:04:54 +04:00
|
|
|
uint32 block_size;
|
|
|
|
int32 child_count;
|
2003-07-22 04:05:38 +04:00
|
|
|
int32 index; // [sys]
|
2004-11-08 14:29:12 +03:00
|
|
|
uint32 status;
|
2003-06-10 03:04:54 +04:00
|
|
|
uint32 flags;
|
2003-07-22 04:05:38 +04:00
|
|
|
dev_t volume; // [sys]
|
2003-09-21 22:25:42 +04:00
|
|
|
void *mount_cookie; // [sys]
|
2003-07-25 02:55:22 +04:00
|
|
|
char *name; // max: B_OS_NAME_LENGTH
|
2003-06-10 03:04:54 +04:00
|
|
|
char *content_name; //
|
|
|
|
char *type; //
|
2003-07-22 04:05:38 +04:00
|
|
|
const char *content_type; // [sys]
|
2003-06-10 03:04:54 +04:00
|
|
|
char *parameters;
|
|
|
|
char *content_parameters;
|
|
|
|
void *cookie;
|
|
|
|
void *content_cookie;
|
|
|
|
} partition_data;
|
|
|
|
|
|
|
|
// C API disk device representation
|
|
|
|
typedef struct disk_device_data {
|
|
|
|
partition_id id; // equal to that of the root partition
|
|
|
|
uint32 flags;
|
|
|
|
char *path;
|
2003-06-11 02:42:53 +04:00
|
|
|
device_geometry geometry;
|
2003-06-10 03:04:54 +04:00
|
|
|
} disk_device_data;
|
|
|
|
|
|
|
|
// C API partitionable space representation
|
|
|
|
typedef struct partitionable_space_data {
|
|
|
|
off_t offset;
|
|
|
|
off_t size;
|
|
|
|
} partitionable_space_data;
|
|
|
|
|
2003-07-25 02:55:22 +04:00
|
|
|
// operations on partitions
|
|
|
|
enum {
|
|
|
|
B_PARTITION_DEFRAGMENT,
|
|
|
|
B_PARTITION_REPAIR,
|
|
|
|
B_PARTITION_RESIZE,
|
|
|
|
B_PARTITION_RESIZE_CHILD,
|
|
|
|
B_PARTITION_MOVE,
|
|
|
|
B_PARTITION_MOVE_CHILD,
|
|
|
|
B_PARTITION_SET_NAME,
|
|
|
|
B_PARTITION_SET_CONTENT_NAME,
|
|
|
|
B_PARTITION_SET_TYPE,
|
|
|
|
B_PARTITION_SET_PARAMETERS,
|
|
|
|
B_PARTITION_SET_CONTENT_PARAMETERS,
|
|
|
|
B_PARTITION_INITIALIZE,
|
|
|
|
B_PARTITION_CREATE_CHILD,
|
|
|
|
B_PARTITION_DELETE_CHILD,
|
|
|
|
};
|
|
|
|
|
2003-07-30 04:27:25 +04:00
|
|
|
// disk device job cancel status
|
|
|
|
enum {
|
|
|
|
B_DISK_DEVICE_JOB_CONTINUE,
|
|
|
|
B_DISK_DEVICE_JOB_CANCEL,
|
|
|
|
B_DISK_DEVICE_JOB_REVERSE,
|
|
|
|
};
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
// disk device locking
|
2003-06-12 02:04:34 +04:00
|
|
|
disk_device_data *write_lock_disk_device(partition_id partitionID);
|
|
|
|
void write_unlock_disk_device(partition_id partitionID);
|
|
|
|
disk_device_data *read_lock_disk_device(partition_id partitionID);
|
|
|
|
void read_unlock_disk_device(partition_id partitionID);
|
2003-06-10 03:04:54 +04:00
|
|
|
// parameter is the ID of any partition on the device
|
|
|
|
|
|
|
|
// getting disk devices/partitions by path
|
|
|
|
// (no locking required)
|
|
|
|
int32 find_disk_device(const char *path);
|
|
|
|
int32 find_partition(const char *path);
|
|
|
|
|
|
|
|
// disk device/partition read access
|
|
|
|
// (read lock required)
|
2003-06-12 02:04:34 +04:00
|
|
|
disk_device_data *get_disk_device(partition_id partitionID);
|
|
|
|
partition_data *get_partition(partition_id partitionID);
|
|
|
|
partition_data *get_parent_partition(partition_id partitionID);
|
|
|
|
partition_data *get_child_partition(partition_id partitionID, int32 index);
|
2003-06-10 03:04:54 +04:00
|
|
|
|
|
|
|
// partition write access
|
|
|
|
// (write lock required)
|
2003-06-12 02:04:34 +04:00
|
|
|
partition_data *create_child_partition(partition_id partitionID, int32 index,
|
2003-06-14 02:08:10 +04:00
|
|
|
partition_id childID);
|
|
|
|
// childID is an optional input parameter -- -1 to be ignored
|
2003-06-12 02:04:34 +04:00
|
|
|
bool delete_partition(partition_id partitionID);
|
|
|
|
void partition_modified(partition_id partitionID);
|
2003-06-10 03:04:54 +04:00
|
|
|
// tells the disk device manager, that the parition has been modified
|
|
|
|
|
2003-06-23 03:12:20 +04:00
|
|
|
// disk systems
|
|
|
|
disk_system_id find_disk_system(const char *name);
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
// jobs
|
2003-07-30 21:49:50 +04:00
|
|
|
bool update_disk_device_job_progress(disk_job_id jobID, float progress);
|
|
|
|
bool update_disk_device_job_extra_progress(disk_job_id jobID,
|
|
|
|
const char *info);
|
2003-09-28 23:29:36 +04:00
|
|
|
bool set_disk_device_job_error_message(disk_job_id jobID, const char *message);
|
2003-07-30 21:49:50 +04:00
|
|
|
uint32 update_disk_device_job_interrupt_properties(disk_job_id jobID,
|
2003-07-30 04:27:25 +04:00
|
|
|
uint32 interruptProperties);
|
|
|
|
// returns one of B_DISK_DEVICE_JOB_{CONTINUE,CANCEL,REVERSE}
|
|
|
|
|
2003-06-12 02:04:34 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
#endif // _DISK_DEVICE_MANAGER_H
|