2003-01-17 11:22:35 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
|
|
|
// by the OpenBeOS license.
|
|
|
|
//---------------------------------------------------------------------
|
2003-01-16 11:26:22 +03:00
|
|
|
/*!
|
|
|
|
\file partition.h
|
|
|
|
hook function declarations for disk_scanner partition modules
|
|
|
|
*/
|
|
|
|
|
2002-12-21 22:07:30 +03:00
|
|
|
|
|
|
|
#ifndef _PARTSCAN_PARTITION_H
|
|
|
|
#define _PARTSCAN_PARTITION_H
|
|
|
|
|
|
|
|
#include <module.h>
|
|
|
|
|
|
|
|
struct extended_partition_info;
|
|
|
|
|
2002-12-25 18:13:25 +03:00
|
|
|
typedef bool (*partition_identify_hook)(int deviceFD,
|
|
|
|
const struct session_info *session, const uchar *block);
|
2002-12-21 22:07:30 +03:00
|
|
|
typedef status_t (*partition_get_nth_info_hook)(int deviceFD,
|
2002-12-25 18:13:25 +03:00
|
|
|
const struct session_info *session, const uchar *block, int32 index,
|
2002-12-21 22:07:30 +03:00
|
|
|
struct extended_partition_info *partitionInfo);
|
2003-01-20 02:01:02 +03:00
|
|
|
typedef bool (*partition_identify_module_hook)(const char *identifier);
|
|
|
|
typedef status_t (*partition_get_partitioning_params_hook)(int deviceFD,
|
|
|
|
const struct session_info *sessionInfo, char *buffer, size_t bufferSize,
|
|
|
|
size_t *actualSize);
|
|
|
|
typedef status_t (*partition_partition_hook)(int deviceFD,
|
|
|
|
const struct session_info *sessionInfo, const char *parameters);
|
2002-12-21 22:07:30 +03:00
|
|
|
|
|
|
|
typedef struct partition_module_info {
|
2003-01-20 02:01:02 +03:00
|
|
|
module_info module;
|
2003-01-26 18:06:23 +03:00
|
|
|
const char *short_name;
|
2002-12-21 22:07:30 +03:00
|
|
|
|
2003-01-20 02:01:02 +03:00
|
|
|
partition_identify_hook identify;
|
|
|
|
partition_get_nth_info_hook get_nth_info;
|
|
|
|
partition_get_partitioning_params_hook get_partitioning_params;
|
|
|
|
partition_partition_hook partition;
|
2002-12-21 22:07:30 +03:00
|
|
|
} partition_module_info;
|
|
|
|
|
|
|
|
/*
|
2003-01-26 18:06:23 +03:00
|
|
|
short_name:
|
|
|
|
----------
|
|
|
|
|
|
|
|
Identifies the module. That's the identifier to be passed to
|
|
|
|
partition_session().
|
|
|
|
|
|
|
|
|
2002-12-21 22:07:30 +03:00
|
|
|
identify():
|
|
|
|
----------
|
|
|
|
|
|
|
|
Checks whether the partition map of the given session can be recognized
|
|
|
|
by the module. Returns true, if it can, false otherwise.
|
|
|
|
|
|
|
|
params:
|
|
|
|
deviceFD: a device FD
|
2003-01-20 02:01:02 +03:00
|
|
|
sessionInfo: a complete info about the session the partitions reside on
|
2002-12-21 22:07:30 +03:00
|
|
|
block: the first block of the session
|
|
|
|
|
|
|
|
|
|
|
|
get_nth_info():
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Fills in the following fields of partitionInfo with information about
|
|
|
|
the indexth partition on the specified session:
|
|
|
|
* offset
|
|
|
|
* size
|
|
|
|
* flags
|
|
|
|
* partition_name
|
|
|
|
* partition_type
|
|
|
|
|
|
|
|
params:
|
|
|
|
deviceFD: a device FD
|
2002-12-25 18:13:25 +03:00
|
|
|
sessionInfo: a complete info about the session the partition resides on
|
2002-12-21 22:07:30 +03:00
|
|
|
block: the first block of the session
|
|
|
|
index: the partition index
|
|
|
|
partitionInfo: the partition info
|
|
|
|
|
|
|
|
The functions is only called, when a call to identify() returned
|
|
|
|
true.
|
|
|
|
|
|
|
|
Returns B_OK, if successful, B_ENTRY_NOT_FOUND, if the index is out of
|
|
|
|
range.
|
2003-01-20 02:01:02 +03:00
|
|
|
|
|
|
|
|
|
|
|
get_partitioning_params():
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Returns parameters for partitioning the supplied session.
|
|
|
|
If the session is already partitioned using this module, then the
|
|
|
|
parameters describing the current layout will be returned, otherwise
|
|
|
|
default values.
|
|
|
|
|
|
|
|
If the supplied buffer is too small for the parameters, the function
|
|
|
|
returns B_OK, but doesn't fill in the buffer; the required buffer
|
|
|
|
size is returned in actualSize. If the buffer is large enough,
|
|
|
|
actualSize is set to the actually used size. The size includes the
|
|
|
|
terminating null.
|
|
|
|
|
|
|
|
params:
|
|
|
|
deviceFD: a device FD
|
|
|
|
sessionInfo: a complete info about the session to be partitioned
|
|
|
|
buffer: pointer to a pre-allocated buffer of size bufferSize
|
|
|
|
bufferSize: the size of buffer
|
|
|
|
actualSize: pointer to a pre-allocated size_t to be set to the
|
|
|
|
actually needed buffer size
|
|
|
|
|
|
|
|
Returns B_OK, if the parameters could be returned successfully or the
|
|
|
|
buffer is too small, an error code otherwise.
|
|
|
|
|
|
|
|
|
|
|
|
partition():
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Partitions the specified session of the device according to the supplied
|
|
|
|
parameters.
|
|
|
|
|
|
|
|
params:
|
|
|
|
deviceFD: a device FD
|
|
|
|
sessionInfo: a complete info about the session to be partitioned
|
|
|
|
parameters: the parameters for partitioning
|
|
|
|
|
|
|
|
Returns B_OK, if everything went fine, an error code otherwise.
|
2002-12-21 22:07:30 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#endif _PARTSCAN_PARTITION_H
|