Removed this old code left-overs. I've looked through everything and AFAIKT,

every code has been moved to and adopted in the new Disk Device API backend.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30692 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-05-10 09:07:21 +00:00
parent 3641abdf0f
commit 874f5afe32
8 changed files with 0 additions and 652 deletions

View File

@ -1,240 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file disk_scanner.h
hook function declarations for disk_scanner module
*/
#ifndef _DISKSCANNER_H
#define _DISKSCANNER_H
#include <Drivers.h>
#include <module.h>
struct extended_partition_info;
struct partition_module_info;
struct session_info;
struct session_module_info;
#define DISK_SCANNER_MODULE_NAME "disk_scanner/disk_scanner/v1"
typedef status_t (*disk_scanner_get_session_module_hook)(int deviceFD,
off_t deviceSize, int32 blockSize,
struct session_module_info **sessionModule);
typedef status_t (*disk_scanner_get_partition_module_hook)(int deviceFD,
const struct session_info *sessionInfo,
struct partition_module_info **partitionModule);
typedef status_t (*disk_scanner_get_nth_session_info_hook)(int deviceFD,
int32 index, struct session_info *sessionInfo,
struct session_module_info **sessionModule);
typedef status_t (*disk_scanner_get_nth_partition_info_hook)(int deviceFD,
const struct session_info *sessionInfo, int32 partitionIndex,
struct extended_partition_info *partitionInfo, char *partitionMapName,
struct partition_module_info **partitionModule);
typedef status_t (*disk_scanner_get_partition_fs_info_hook)(int deviceFD,
struct extended_partition_info *partitionInfo);
typedef status_t (*disk_scanner_get_partitioning_params_hook)(int deviceFD,
const struct session_info *sessionInfo, const char *identifier,
char *buffer, size_t bufferSize, size_t *actualSize);
typedef status_t (*disk_scanner_partition_hook)(int deviceFD,
const struct session_info *sessionInfo, const char *identifier,
const char *parameters);
typedef struct disk_scanner_module_info {
module_info module;
disk_scanner_get_session_module_hook get_session_module;
disk_scanner_get_partition_module_hook get_partition_module;
disk_scanner_get_nth_session_info_hook get_nth_session_info;
disk_scanner_get_nth_partition_info_hook get_nth_partition_info;
disk_scanner_get_partition_fs_info_hook get_partition_fs_info;
disk_scanner_get_partitioning_params_hook get_partitioning_params;
disk_scanner_partition_hook partition;
} disk_scanner_module_info;
/*
get_session_module:
------------------
Searches for a module that can deal with the sessions on the specified
device and returns a module_info for it. put_module() must be called, when
done with the module.
params:
deviceFD: a device FD
deviceSize: size of the device in bytes
blockSize: the logical block size
sessionModule: buffer the pointer to the found module_info shall be
written into
Returns B_OK, if a module could be found, B_ENTRY_NOT_FOUND, if no
module was suitable for the job.
get_partition_module:
--------------------
Searches for a module that can deal with the partitions on the specified
session and returns a module_info for it. put_module() must be called, when
done with the module.
params:
deviceFD: a device FD
sessionInfo: a complete info about the session the partition resides on
partitionModule: buffer the pointer to the found module_info shall be
written into
Returns B_OK, if a module could be found, B_ENTRY_NOT_FOUND, if no
module was suitable for the job.
get_nth_session_info():
----------------------
Fills in all fields of sessionInfo with information about
the indexth session on the specified device.
params:
deviceFD: a device FD
index: the session index
sessionInfo: the session info
sessionModule: pointer to session_module_info*
The function first checks, whether the device is one that usually has
sessions (a CD). If so, it tries to find a suitable module and delegates
the work to that module. Otherwise, it is assumed, that the device does
not have sessions and for index == 0 the info is filled out with data
for a "virtual" session, i.e. one that spans the whole device.
If sessionModule is NULL, it is ignored. Otherwise, if it points to a
NULL pointer, then a pointer to the module that has been recognized to
handle the session layout is returned therein (NULL in case of a
a device other than a CD). If it points to a non-NULL pointer, the
referred to session module is used get the session info. The caller is
responsible to put_module() the module returned in sessionModule.
To sum it up, the feature can be used to avoid recognizing and
re- and unloading the respective module when iterating through the
sessions of a device -- before the first call *sessionModule is to be
initialized to NULL, after the last call, put_module() has to be invoked,
if *sessionModule is not NULL.
Returns B_OK, if successful, B_ENTRY_NOT_FOUND, if no suitable session
module could be found or if the session index is out of range.
get_nth_partition_info():
------------------------
Fills in the following fields of partitionInfo with information about
the indexth partition on the specified session:
* offset
* size
* logical_block_size
* session
* partition
* flags
* partition_name
* partition_type
params:
deviceFD: a device FD
sessionInfo: a complete info about the session the partition resides on
partitionIndex: partition index
partitionInfo: the partition info to be filled in
partitionMapName: Pointer to a pre-allocated char buffer of minimal
size B_FILE_NAME_LENGTH, into which the short name of
the partitioning system shall be written. The result is
the empty string (""), if no partitioning system is used
(e.g. for floppies). May be NULL.
partitionModule: pointer to partition_module_info*
The function first tries to find a suitable partition module and to
delagate the work to that module. If no module could be found, for
partition index == 0 the info is filled out with data for a "virtual"
partition, i.e. one that spans the whole session.
If partitionModule is NULL, it is ignored. Otherwise, if it points to a
NULL pointer, then a pointer to the module that has been recognized to
handle the partition layout is returned therein (NULL in case none
could be found). If it points to a non-NULL pointer, the referred to
partition module is used get the partition info. The caller is
responsible to put_module() the module returned in partitionModule.
To sum it up, the feature can be used to avoid recognizing and
re- and unloading the respective module when iterating through the
partitions of a session -- before the first call *partitionModule is to
be initialized to NULL, after the last call, put_module() has to be
invoked, if *partitionModule is not NULL.
Returns B_OK, if successful, B_ENTRY_NOT_FOUND, if the index is out of
range.
get_partition_fs_info():
-----------------------
Expects partitionInfo to be partially initialized and, if a module could
be found, that recognizes the FS on the partition, fills in
the fields:
* file_system_short_name
* file_system_long_name
* volume_name
The minimally required fields are:
* offset
* size
* logical_block_size
params:
deviceFD: a device FD
partitionInfo: the partition info
Returns B_OK, if successful (i.e. the FS was recognized),
B_ENTRY_NOT_FOUND, if no suitable module could be found.
get_partitioning_params():
-------------------------
Returns parameters for partitioning the supplied session.
If the session is already partitioned using the specified 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
identifier: identifies the partition module to be used
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 using the partition module
identified by an identifier and according to the supplied parameters.
deviceFD: a device FD
sessionInfo: a complete info about the session the partitions reside on
identifier: identifies the partition module to be used
parameters: the parameters for partitioning
Returns B_OK, if everything went fine, an error code otherwise.
*/
#endif // _DISKSCANNER_H

View File

@ -1,78 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file filesystem.h
hook function declarations for disk_scanner filesystem modules
*/
#ifndef _PARTSCAN_FS_H
#define _PARTSCAN_FS_H
#include <module.h>
struct extended_partition_info;
struct fs_buffer_cache;
typedef status_t (*fs_get_buffer)(struct fs_buffer_cache *cache,
off_t offset, size_t size, void **buffer, size_t *actualSize);
typedef bool (*fs_identify_hook)(int deviceFD,
struct extended_partition_info *partitionInfo, float *priority,
fs_get_buffer get_buffer, struct fs_buffer_cache *cache);
typedef struct fs_module_info {
module_info module;
fs_identify_hook identify;
} fs_module_info;
/*
identify():
----------
Expects partitionInfo to be partially initialized and, if
the module is able to recognize the FS on the partition, fills in
the fields:
* file_system_short_name
* file_system_long_name
* volume_name
The minimally required fields are:
* offset
* size
* logical_block_size
params:
deviceFD: a device FD
partitionInfo: the partition info
priority: Pointer to a float in which the priority of the FS shall be
stored. Used in case several FS add-ons recognize the FS;
then the module returning the highest priority is used.
-1 <= *priority <= 1
get_buffer: Function that should be used to read data from the device.
cache: To be passed to get_buffer.
Returns true, if successful (i.e. the FS was recognized), false otherwise.
fs_get_buffer():
---------------
Supplied with offset and size the function reads data from the device
into a buffer it allocates, and returns the buffer.
params:
cache: the cache for the device
offset: offset from which to read, relative to the beginning of the
*partition*
size: number of bytes to be read
buffer: pointer to a pre-allocated void* to be set to the read buffer
actualSize: pointer to a pre-allocated size_t to be set to the actual
number of bytes read from the device
Returns B_OK, if everything went fine, an error code otherwise.
*/
#endif // _PARTSCAN_FS_H

View File

@ -1,125 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file partition.h
hook function declarations for disk_scanner partition modules
*/
#ifndef _PARTSCAN_PARTITION_H
#define _PARTSCAN_PARTITION_H
#include <module.h>
struct extended_partition_info;
typedef bool (*partition_identify_hook)(int deviceFD,
const struct session_info *session, const uchar *block);
typedef status_t (*partition_get_nth_info_hook)(int deviceFD,
const struct session_info *session, const uchar *block, int32 index,
struct extended_partition_info *partitionInfo);
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);
typedef struct partition_module_info {
module_info module;
const char *short_name;
partition_identify_hook identify;
partition_get_nth_info_hook get_nth_info;
partition_get_partitioning_params_hook get_partitioning_params;
partition_partition_hook partition;
} partition_module_info;
/*
short_name:
----------
Identifies the module. That's the identifier to be passed to
partition_session().
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
sessionInfo: a complete info about the session the partitions reside on
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
sessionInfo: a complete info about the session the partition resides on
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.
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.
*/
#endif // _PARTSCAN_PARTITION_H

View File

@ -1,62 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*!
\file session.h
hook function declarations for disk_scanner session modules
*/
#ifndef _PARTSCAN_SESSION_H
#define _PARTSCAN_SESSION_H
#include <module.h>
struct session_info;
typedef bool (*session_identify_hook)(int deviceFD, off_t deviceSize,
int32 blockSize);
typedef status_t (*session_get_nth_info_hook)(int deviceFD, int32 index,
off_t deviceSize, int32 blockSize, struct session_info *sessionInfo);
typedef struct session_module_info {
module_info module;
session_identify_hook identify;
session_get_nth_info_hook get_nth_info;
} session_module_info;
/*
identify():
----------
Checks whether the module knows about sessions on the given device.
Returns true, if it does, false otherwise.
params:
deviceFD: a device FD
deviceSize: size of the device in bytes
blockSize: the logical block size
get_nth_info():
--------------
Fills in all fields of sessionInfo with information about
the indexth session on the specified device.
params:
deviceFD: a device FD
index: the session index
deviceSize: size of the device in bytes
blockSize: the logical block size
sessionInfo: the session 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.
*/
#endif // _PARTSCAN_SESSION_H

View File

@ -1,11 +0,0 @@
SubDir HAIKU_TOP src add-ons disk_scanner ;
# For convenience: Pseudo target that builds all GUI add-ons.
#
NotFile gui_disk_scanner_add_ons ;
Depends gui_disk_scanner_add_ons
: <boot!home!config!add-ons!disk_scanner!partition>intel
;
SubInclude HAIKU_TOP src add-ons disk_scanner fs ;
SubInclude HAIKU_TOP src add-ons disk_scanner partition ;

View File

@ -1 +0,0 @@
SubDir HAIKU_TOP src add-ons disk_scanner fs ;

View File

@ -1,9 +0,0 @@
SubDir HAIKU_TOP src add-ons disk_scanner partition ;
UsePrivateHeaders shared ;
UsePrivateHeaders storage ;
Addon <gui>intel : intel.cpp
: <boot!home!config!lib>libdiskdevice.so be ;
AbsSymLink <boot!home!config!add-ons!disk_scanner!partition>intel : <gui>intel
: /boot/home/config/add-ons/disk_scanner/partition ;

View File

@ -1,126 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
#include <new.h>
#include <DiskDevice.h>
#include <DiskScannerAddOn.h>
#include <Partition.h>
#include <Session.h>
#include <View.h>
// IntelParameterEditor
class IntelParameterEditor : public BView, public BDiskScannerParameterEditor {
public:
IntelParameterEditor(const BSession *session, const char *parameters);
virtual ~IntelParameterEditor();
virtual BView *View();
virtual bool EditingDone();
virtual status_t GetParameters(BString *parameters);
private:
const BSession *fSession;
BString fParameters;
};
// constructor
IntelParameterEditor::IntelParameterEditor(const BSession *session,
const char *parameters)
: BView(BRect(0, 0, 100, 100), "intel parameters", B_FOLLOW_ALL, 0),
BDiskScannerParameterEditor(),
fSession(session),
fParameters(parameters)
{
// for testing
rgb_color blue = { 0, 0, 255 };
SetViewColor(blue);
}
// destructor
IntelParameterEditor::~IntelParameterEditor()
{
}
// View
BView *
IntelParameterEditor::View()
{
return this;
}
// EditingDone
bool
IntelParameterEditor::EditingDone()
{
return true;
}
// GetParameters
status_t
IntelParameterEditor::GetParameters(BString *parameters)
{
status_t error = (parameters ? B_OK : B_BAD_VALUE);
if (error == B_OK)
*parameters = fParameters;
return error;
}
// IntelPartitionAddOn
class IntelPartitionAddOn : public BDiskScannerPartitionAddOn {
public:
IntelPartitionAddOn();
virtual ~IntelPartitionAddOn();
virtual const char *ShortName();
virtual const char *LongName();
virtual BDiskScannerParameterEditor *CreateEditor(const BSession *session,
const char *parameters);
};
// constructor
IntelPartitionAddOn::IntelPartitionAddOn()
: BDiskScannerPartitionAddOn()
{
}
// destructor
IntelPartitionAddOn::~IntelPartitionAddOn()
{
}
// ShortName
const char *
IntelPartitionAddOn::ShortName()
{
return "intel";
}
// LongName
const char *
IntelPartitionAddOn::LongName()
{
return "Intel Style Partitioning";
}
// CreateEditor
BDiskScannerParameterEditor *
IntelPartitionAddOn::CreateEditor(const BSession *session,
const char *parameters)
{
return new(nothrow) IntelParameterEditor(session, parameters);
}
// create_ds_partition_add_on
BDiskScannerPartitionAddOn *
create_ds_partition_add_on()
{
return new IntelPartitionAddOn;
}