Merged the disk device manager module interface for file systems with the
VFS's interface, so that a file system only has to implement one interface. As a side effect, the automatic file system detection may now work (not yet tested, though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12786 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "KDiskSystem.h"
|
||||
|
||||
struct fs_module_info;
|
||||
struct file_system_module_info;
|
||||
|
||||
namespace BPrivate {
|
||||
namespace DiskDevice {
|
||||
@@ -76,7 +76,7 @@ protected:
|
||||
virtual void UnloadModule();
|
||||
|
||||
private:
|
||||
fs_module_info *fModule;
|
||||
file_system_module_info *fModule;
|
||||
};
|
||||
|
||||
} // namespace DiskDevice
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ddm_modules.h
|
||||
//
|
||||
// Interfaces to be implemented by partition/FS modules.
|
||||
// Interface to be implemented by partition modules.
|
||||
|
||||
#ifndef _K_DISK_DEVICE_MODULES_H
|
||||
#define _K_DISK_DEVICE_MODULES_H
|
||||
@@ -185,106 +185,4 @@ typedef struct partition_module_info {
|
||||
partition_delete_child delete_child;
|
||||
} partition_module_info;
|
||||
|
||||
|
||||
// FS module interface
|
||||
|
||||
// scanning
|
||||
// (the device is write locked)
|
||||
typedef float (*fs_identify_partition)(int fd, partition_data *partition,
|
||||
void **cookie);
|
||||
typedef status_t (*fs_scan_partition)(int fd, partition_data *partition,
|
||||
void *cookie);
|
||||
typedef void (*fs_free_identify_partition_cookie)(partition_data *partition,
|
||||
void *cookie);
|
||||
typedef void (*fs_free_partition_content_cookie)(partition_data *partition);
|
||||
|
||||
// querying
|
||||
// (the device is read locked)
|
||||
typedef bool (*fs_supports_defragmenting)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
typedef bool (*fs_supports_repairing)(partition_data *partition,
|
||||
bool checkOnly, bool *whileMounted);
|
||||
typedef bool (*fs_supports_resizing)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
typedef bool (*fs_supports_moving)(partition_data *partition, bool *isNoOp);
|
||||
typedef bool (*fs_supports_setting_content_name)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
typedef bool (*fs_supports_setting_content_parameters)(
|
||||
partition_data *partition, bool *whileMounted);
|
||||
typedef bool (*fs_supports_initializing)(partition_data *partition);
|
||||
|
||||
typedef bool (*fs_validate_resize)(partition_data *partition, off_t *size);
|
||||
typedef bool (*fs_validate_move)(partition_data *partition, off_t *start);
|
||||
typedef bool (*fs_validate_set_content_name)(partition_data *partition,
|
||||
char *name);
|
||||
typedef bool (*fs_validate_set_content_parameters)(partition_data *partition,
|
||||
const char *parameters);
|
||||
typedef bool (*fs_validate_initialize)(partition_data *partition, char *name,
|
||||
const char *parameters);
|
||||
|
||||
// shadow partition modification
|
||||
// (device is write locked)
|
||||
typedef status_t (*fs_shadow_changed)(partition_data *partition,
|
||||
uint32 operation);
|
||||
|
||||
// writing
|
||||
// (the device is NOT locked)
|
||||
typedef status_t (*fs_defragment)(int fd, partition_id partition,
|
||||
disk_job_id job);
|
||||
typedef status_t (*fs_repair)(int fd, partition_id partition, bool checkOnly,
|
||||
disk_job_id job);
|
||||
typedef status_t (*fs_resize)(int fd, partition_id partition, off_t size,
|
||||
disk_job_id job);
|
||||
typedef status_t (*fs_move)(int fd, partition_id partition, off_t offset,
|
||||
disk_job_id job);
|
||||
typedef status_t (*fs_set_content_name)(int fd, partition_id partition,
|
||||
const char *name, disk_job_id job);
|
||||
typedef status_t (*fs_set_content_parameters)(int fd, partition_id partition,
|
||||
const char *parameters, disk_job_id job);
|
||||
typedef status_t (*fs_initialize)(const char *partition, const char *name,
|
||||
const char *parameters, disk_job_id job);
|
||||
// This is pretty close to how the hook in R5 looked. Save the job ID, of
|
||||
// course and that the parameters were given as (void*, size_t) pair.
|
||||
|
||||
typedef struct fs_module_info {
|
||||
module_info module;
|
||||
const char *pretty_name;
|
||||
uint32 flags;
|
||||
|
||||
// scanning
|
||||
fs_identify_partition identify_partition;
|
||||
fs_scan_partition scan_partition;
|
||||
fs_free_identify_partition_cookie free_identify_partition_cookie;
|
||||
fs_free_partition_content_cookie free_partition_content_cookie;
|
||||
|
||||
// querying
|
||||
fs_supports_defragmenting supports_defragmenting;
|
||||
fs_supports_repairing supports_repairing;
|
||||
fs_supports_resizing supports_resizing;
|
||||
fs_supports_moving supports_moving;
|
||||
fs_supports_setting_content_name supports_setting_content_name;
|
||||
fs_supports_setting_content_parameters
|
||||
supports_setting_content_parameters;
|
||||
fs_supports_initializing supports_initializing;
|
||||
|
||||
fs_validate_resize validate_resize;
|
||||
fs_validate_move validate_move;
|
||||
fs_validate_set_content_name validate_set_content_name;
|
||||
fs_validate_set_content_parameters
|
||||
validate_set_content_parameters;
|
||||
fs_validate_initialize validate_initialize;
|
||||
|
||||
// shadow partition modification
|
||||
fs_shadow_changed shadow_changed;
|
||||
|
||||
// writing
|
||||
fs_defragment defragment;
|
||||
fs_repair repair;
|
||||
fs_resize resize;
|
||||
fs_move move;
|
||||
fs_set_content_name set_content_name;
|
||||
fs_set_content_parameters set_content_parameters;
|
||||
fs_initialize initialize;
|
||||
} fs_module_info;
|
||||
|
||||
#endif // _K_DISK_DEVICE_MODULES_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <storage/DiskDeviceDefs.h>
|
||||
|
||||
#include <disk_device_manager/disk_device_manager.h>
|
||||
#include <disk_device_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
// disk_device_manager.h
|
||||
//
|
||||
// C API exported by the disk device manager.
|
||||
// Currently only functions of interest for partition modules/FS add-ons
|
||||
// are considered.
|
||||
|
||||
#ifndef _DISK_DEVICE_MANAGER_H
|
||||
#define _DISK_DEVICE_MANAGER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
#include <storage/DiskDeviceDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// C API partition representation
|
||||
// Fields marked [sys] are set by the system and are not to be changed by
|
||||
// the disk system modules.
|
||||
typedef struct partition_data {
|
||||
partition_id id; // [sys]
|
||||
off_t offset;
|
||||
off_t size;
|
||||
off_t content_size;
|
||||
uint32 block_size;
|
||||
int32 child_count;
|
||||
int32 index; // [sys]
|
||||
uint32 status;
|
||||
uint32 flags;
|
||||
dev_t volume; // [sys]
|
||||
void *mount_cookie; // [sys]
|
||||
char *name; // max: B_OS_NAME_LENGTH
|
||||
char *content_name; //
|
||||
char *type; //
|
||||
const char *content_type; // [sys]
|
||||
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;
|
||||
device_geometry geometry;
|
||||
} disk_device_data;
|
||||
|
||||
// C API partitionable space representation
|
||||
typedef struct partitionable_space_data {
|
||||
off_t offset;
|
||||
off_t size;
|
||||
} partitionable_space_data;
|
||||
|
||||
// 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,
|
||||
};
|
||||
|
||||
// disk device job cancel status
|
||||
enum {
|
||||
B_DISK_DEVICE_JOB_CONTINUE,
|
||||
B_DISK_DEVICE_JOB_CANCEL,
|
||||
B_DISK_DEVICE_JOB_REVERSE,
|
||||
};
|
||||
|
||||
// disk device locking
|
||||
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);
|
||||
// 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)
|
||||
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);
|
||||
|
||||
// partition write access
|
||||
// (write lock required)
|
||||
partition_data *create_child_partition(partition_id partitionID, int32 index,
|
||||
partition_id childID);
|
||||
// childID is an optional input parameter -- -1 to be ignored
|
||||
bool delete_partition(partition_id partitionID);
|
||||
void partition_modified(partition_id partitionID);
|
||||
// tells the disk device manager, that the parition has been modified
|
||||
|
||||
// disk systems
|
||||
disk_system_id find_disk_system(const char *name);
|
||||
|
||||
// jobs
|
||||
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);
|
||||
bool set_disk_device_job_error_message(disk_job_id jobID, const char *message);
|
||||
uint32 update_disk_device_job_interrupt_properties(disk_job_id jobID,
|
||||
uint32 interruptProperties);
|
||||
// returns one of B_DISK_DEVICE_JOB_{CONTINUE,CANCEL,REVERSE}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DISK_DEVICE_MANAGER_H
|
||||
Reference in New Issue
Block a user