libroot: Remove unused files

Not referenced in any Jamfile, does not compile, untouched since
2003 except for a few coding style and cppcheck fixes. The functionality
is implemented elsewhere in the disk device manager and userland
filesystem add-ons for DriveSetup.

Change-Id: I5ebe125931c8d4410c2d335f9d6c0e32008f038b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5637
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2022-09-13 18:43:55 +00:00
committed by waddlesplash
parent b4b3f69fca
commit d469ab6d6c
5 changed files with 0 additions and 821 deletions
@@ -1,86 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
#ifndef _DISK_SCANNER_ADD_ON
#define _DISK_SCANNER_ADD_ON
#include <SupportDefs.h>
class BDiskScannerParameterEditor;
class BPartition;
class BSession;
class BString;
class BView;
// BDiskScannerPartitionAddOn
class BDiskScannerPartitionAddOn {
public:
BDiskScannerPartitionAddOn();
virtual ~BDiskScannerPartitionAddOn();
virtual const char *ShortName() = 0;
virtual const char *LongName() = 0;
virtual BDiskScannerParameterEditor *CreateEditor(const BSession *session,
const char *parameters) = 0;
private:
virtual void _ReservedDiskScannerPartitionAddOn1();
virtual void _ReservedDiskScannerPartitionAddOn2();
virtual void _ReservedDiskScannerPartitionAddOn3();
virtual void _ReservedDiskScannerPartitionAddOn4();
virtual void _ReservedDiskScannerPartitionAddOn5();
uint32 _reserved[8];
};
// BDiskScannerFSAddOn
class BDiskScannerFSAddOn {
public:
BDiskScannerFSAddOn();
virtual ~BDiskScannerFSAddOn();
virtual const char *ShortName() = 0;
virtual const char *LongName() = 0;
virtual BDiskScannerParameterEditor *CreateEditor(
const BPartition *partition, const char *parameters) = 0;
private:
virtual void _ReservedDiskScannerFSAddOn1();
virtual void _ReservedDiskScannerFSAddOn2();
virtual void _ReservedDiskScannerFSAddOn3();
virtual void _ReservedDiskScannerFSAddOn4();
virtual void _ReservedDiskScannerFSAddOn5();
uint32 _reserved[8];
};
// BDiskScannerParameterEditor
class BDiskScannerParameterEditor {
public:
BDiskScannerParameterEditor();
virtual ~BDiskScannerParameterEditor();
virtual BView *View();
virtual bool EditingDone();
virtual status_t GetParameters(BString *parameters);
private:
virtual void _ReservedDiskScannerParameterEditor1();
virtual void _ReservedDiskScannerParameterEditor2();
virtual void _ReservedDiskScannerParameterEditor3();
virtual void _ReservedDiskScannerParameterEditor4();
virtual void _ReservedDiskScannerParameterEditor5();
uint32 _reserved[8];
};
// partition add-ons
extern "C" BDiskScannerPartitionAddOn *create_ds_partition_add_on();
// fs add-ons
extern "C" BDiskScannerFSAddOn *create_ds_fs_add_on();
#endif // _DISK_SCANNER_ADD_ON
@@ -1,218 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
#include <DiskScannerAddOn.h>
#include <String.h>
// BDiskScannerPartitionAddOn
// constructor
/*! \brief Creates a partition disk scanner add-on.
*/
BDiskScannerPartitionAddOn::BDiskScannerPartitionAddOn()
{
}
// destructor
/*! \brief Frees all resources associated with this object.
*/
BDiskScannerPartitionAddOn::~BDiskScannerPartitionAddOn()
{
}
/*! \fn virtual const char *BDiskScannerPartitionAddOn::ShortName() = 0;
\brief Returns a short name for the add-on.
To be implemented by derived classes.
The returned string identifies the respective partition kernel module is
passed to partition_session().
\return A short name for the add-on.
*/
/*! \fn virtual const char *BDiskScannerPartitionAddOn::LongName() = 0;
\brief Returns a user-readable long name for the add-on.
To be implemented by derived classes.
\return A long name for the add-on.
*/
/*! \fn virtual BDiskScannerPartitionAddOn::BDiskScannerParameterEditor *
CreateEditor(const BSession *session, const char *parameters) = 0;
\brief Creates and returns an editor for editing partitioning parameters
for a specified session.
To be implemented by derived classes.
\param session The session to be partitioned.
\param parameters Parameters retrieved from the partition module. Should
initially be presented to the user.
\return The newly created editor. \c NULL, if an error occurred.
*/
// FBC
void BDiskScannerPartitionAddOn::_ReservedDiskScannerPartitionAddOn1() {}
void BDiskScannerPartitionAddOn::_ReservedDiskScannerPartitionAddOn2() {}
void BDiskScannerPartitionAddOn::_ReservedDiskScannerPartitionAddOn3() {}
void BDiskScannerPartitionAddOn::_ReservedDiskScannerPartitionAddOn4() {}
void BDiskScannerPartitionAddOn::_ReservedDiskScannerPartitionAddOn5() {}
// BDiskScannerFSAddOn
// constructor
/*! \brief Creates a FS disk scanner add-on.
*/
BDiskScannerFSAddOn::BDiskScannerFSAddOn()
{
}
// destructor
/*! \brief Frees all resources associated with this object.
*/
BDiskScannerFSAddOn::~BDiskScannerFSAddOn()
{
}
/*! \fn virtual const char *BDiskScannerFSAddOn::ShortName() = 0;
\brief Returns a short name for the add-on.
To be implemented by derived classes.
The returned name identifies the file system (the kernel add-on) and is
passed to initialize_volume().
\return A short name for the add-on.
*/
/*! \fn virtual const char *BDiskScannerFSAddOn::LongName() = 0;
\brief Returns a user-readable long name for the add-on.
To be implemented by derived classes.
\return A long name for the add-on.
*/
/*! \fn virtual BDiskScannerFSAddOn::BDiskScannerParameterEditor *CreateEditor(
const BPartition *partition, const char *parameters) = 0;
\brief Creates and returns an editor for editing initialization parameters
for a specified partition.
To be implemented by derived classes.
\param partition The partition to be initialized.
\param parameters Parameters retrieved from the kernel FS add-on. Should
initially be presented to the user.
\return The newly created editor. \c NULL, if the FS doesn't need any
further parameters.
*/
// FBC
void BDiskScannerFSAddOn::_ReservedDiskScannerFSAddOn1() {}
void BDiskScannerFSAddOn::_ReservedDiskScannerFSAddOn2() {}
void BDiskScannerFSAddOn::_ReservedDiskScannerFSAddOn3() {}
void BDiskScannerFSAddOn::_ReservedDiskScannerFSAddOn4() {}
void BDiskScannerFSAddOn::_ReservedDiskScannerFSAddOn5() {}
// BDiskScannerParameterEditor
// constructor
/*! \brief Creates a disk scanner parameter editor.
*/
BDiskScannerParameterEditor::BDiskScannerParameterEditor()
{
}
// destructor
/*! \brief Frees all resources associated with this object.
*/
BDiskScannerParameterEditor::~BDiskScannerParameterEditor()
{
}
/*! \brief Returns a view containing the controls needed for editing the
parameters.
To be overridden by derived classes.
The base class version returns \c NULL.
The returned BView is added to a window occasionally and removed, when
editing is done. The view belongs to the editor and needs to be deleted
by it. Subsequent calls to this method may return the same view, or each
time delete the old one and return a new one.
\return A view containing the controls needed for editing the parameters.
\c NULL can be returned, if no parameters are needed.
*/
BView *
BDiskScannerParameterEditor::View()
{
return NULL;
}
// EditingDone
/*! \brief Called when the user finishes editing the parameters.
To be overridden by derived classes.
The base class version returns \c true.
The method is supposed to check whether the parameters the user set,
are valid, and, if so, return \c true. Otherwise an BAlert shall be
shown, explaining the problem to the user and \c false being returned
-- then the parameter dialog will not be closed.
\return \c true, if the current parameters are valid, \c false otherwise.
*/
bool
BDiskScannerParameterEditor::EditingDone()
{
return true;
}
/*! \brief Returns the edited parameters.
To be overridden by derived classes.
The base class version returns an empty string.
\param parameters A BString to be set to the edited parameters.
\return \c B_OK, if everything went fine, another error code otherwise.
*/
status_t
BDiskScannerParameterEditor::GetParameters(BString *parameters)
{
status_t error = (parameters ? B_OK : B_BAD_VALUE);
if (error == B_OK)
parameters->SetTo("");
return error;
}
// FBC
void BDiskScannerParameterEditor::_ReservedDiskScannerParameterEditor1() {}
void BDiskScannerParameterEditor::_ReservedDiskScannerParameterEditor2() {}
void BDiskScannerParameterEditor::_ReservedDiskScannerParameterEditor3() {}
void BDiskScannerParameterEditor::_ReservedDiskScannerParameterEditor4() {}
void BDiskScannerParameterEditor::_ReservedDiskScannerParameterEditor5() {}
/*! \fn BDiskScannerPartitionAddOn *create_ds_partition_add_on();
\brief To be provided by partition add-ons to create an add-on object.
\return A newly created BDiskScannerPartitionAddOn for this add-on.
*/
/*! \fn BDiskScannerFSAddOn *create_ds_fs_add_on();
\brief To be provided by FS add-ons to create an add-on object.
\return A newly created BDiskScannerFSAddOn for this add-on.
*/
@@ -1,192 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
#include <algorithm>
#include <new>
#include <stdio.h>
#include <string.h>
#include <Button.h>
#include <DiskScannerAddOn.h>
#include <Screen.h>
#include <View.h>
#include "PartitioningDialog.h"
enum {
MSG_OK = 'okay',
MSG_CANCEL = 'cncl',
};
// constructor
PartitioningDialog::PartitioningDialog(BRect dialogCenter)
: BWindow(BRect(100, 100, 100, 100), "Partitioning parameters",
B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE),
fEditor(NULL),
fEditorView(NULL),
fBlocker(-1),
fCancelled(NULL),
fCenter()
{
fBlocker = create_sem(0, "partitioning dialog blocker");
// calculate the dialog center point
if (!dialogCenter.IsValid())
dialogCenter = BScreen().Frame();
fCenter = dialogCenter.LeftTop() + dialogCenter.RightBottom();
fCenter.x /= 2;
fCenter.y /= 2;
}
// destructor
PartitioningDialog::~PartitioningDialog()
{
if (fEditorView)
fEditorView->RemoveSelf();
if (fBlocker >= 0)
delete_sem(fBlocker);
}
// MessageReceived
void
PartitioningDialog::MessageReceived(BMessage *message)
{
switch (message->what) {
case MSG_OK:
{
if (fEditor->EditingDone()) {
if (fCancelled)
*fCancelled = false;
Quit();
}
break;
}
case MSG_CANCEL:
if (fCancelled)
*fCancelled = true;
Quit();
break;
default:
BWindow::MessageReceived(message);
break;
}
}
// QuitRequested
bool
PartitioningDialog::QuitRequested()
{
if (fCancelled)
*fCancelled = true;
return true;
}
// Go
status_t
PartitioningDialog::Go(BDiskScannerParameterEditor *editor, bool *_cancelled)
{
status_t error = _Init(editor);
bool wasRun = false;
// fire up the window
if (error == B_OK) {
if (fBlocker >= 0) {
sem_id blocker = fBlocker;
bool cancelled = true;
fCancelled = &cancelled;
Show();
wasRun = true;
acquire_sem(blocker);
if (cancelled)
error = B_ERROR;
if (_cancelled)
*_cancelled = cancelled;
} else
error = fBlocker;
}
// delete the window if not run
if (!wasRun)
delete this;
return error;
}
// _Init
status_t
PartitioningDialog::_Init(BDiskScannerParameterEditor *editor)
{
status_t error = (editor ? B_OK : B_BAD_VALUE);
// set the parameter editor and view
if (error == B_OK) {
fEditor = editor;
fEditorView = editor->View();
if (!fEditorView)
error = B_ERROR;
}
// setup views
if (error == B_OK) {
BView *mainView = new(std::nothrow) BView(BRect(0, 0, 1, 1), "main",
B_FOLLOW_ALL, 0);
BMessage *okMessage = new BMessage(MSG_OK);
BMessage *cancelMessage = new BMessage(MSG_CANCEL);
BButton *okButton = new (std::nothrow) BButton(
BRect(0, 0, 1, 1), "ok", "OK", okMessage,
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
BButton *cancelButton = new (std::nothrow) BButton(
BRect(0, 0, 1, 1), "cancel", "Cancel", cancelMessage,
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
if (okMessage && cancelMessage && okButton && cancelButton) {
// add the views to the hierarchy
mainView->AddChild(fEditorView);
mainView->AddChild(okButton);
mainView->AddChild(cancelButton);
AddChild(mainView);
// set the buttons' preferred size
float buttonWidth = 0;
float buttonHeight = 0;
okButton->GetPreferredSize(&buttonWidth, &buttonHeight);
okButton->ResizeTo(buttonWidth, buttonHeight);
cancelButton->GetPreferredSize(&buttonWidth, &buttonHeight);
cancelButton->ResizeTo(buttonWidth, buttonHeight);
// setup their positions and sizes
int32 hSpacing = 10;
int32 vSpacing = 10;
BRect editorRect = fEditorView->Bounds();
BRect okRect = okButton->Bounds();
BRect cancelRect = cancelButton->Bounds();
// compute width and size of the main view
int32 width = std::max(editorRect.IntegerWidth() + 1,
okRect.IntegerWidth() + 1 + hSpacing
+ cancelRect.IntegerWidth() + 1)
+ 2 * hSpacing;
int32 height = editorRect.IntegerHeight() + 1
+ std::max(okRect.IntegerHeight(),
cancelRect.IntegerHeight()) + 1
+ 3 * vSpacing;
mainView->ResizeTo(width - 1, height -1);
ResizeTo(width - 1, height -1);
// set location of the editor view
fEditorView->MoveTo((width - editorRect.IntegerWidth() - 1) / 2,
vSpacing - 1);
fEditorView->ResizeTo(editorRect.Width(), editorRect.Height());
// set the location of the buttons
float buttonTop = 2 * vSpacing + editorRect.IntegerHeight();
float buttonLeft = width - hSpacing - okRect.IntegerWidth();
okButton->MoveTo(buttonLeft, buttonTop);
buttonLeft -= hSpacing + cancelRect.IntegerWidth();
cancelButton->MoveTo(buttonLeft, buttonTop);
} else {
// cleanup on error
error = B_NO_MEMORY;
if (!okButton && okMessage)
delete okMessage;
if (!cancelButton && cancelMessage)
delete cancelMessage;
delete okButton;
delete cancelButton;
delete mainView;
}
}
return error;
}
@@ -1,41 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
#ifndef _PARTITIONING_DIALOG_H
#define _PARTITIONING_DIALOG_H
#include <OS.h>
#include <Window.h>
class BDiskScannerParameterEditor;
namespace BPrivate {
class PartitioningDialog : public BWindow {
public:
PartitioningDialog(BRect dialogCenter);
virtual ~PartitioningDialog();
virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested();
status_t Go(BDiskScannerParameterEditor *editor, bool *cancelled);
private:
status_t _Init(BDiskScannerParameterEditor *editor);
private:
BDiskScannerParameterEditor *fEditor;
BView *fEditorView;
sem_id fBlocker;
bool *fCancelled;
BPoint fCenter;
};
} // namespace BPrivate
using BPrivate::PartitioningDialog;
#endif // _PARTITIONING_DIALOG_H
-284
View File
@@ -1,284 +0,0 @@
//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
#include <disk_scanner.h>
#include <disk_scanner/disk_scanner.h>
#include <KernelExport.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
// get_nth_session_info
/*! \brief Retrieves information about a session on a device.
\param deviceFD File descriptor for the device in question.
\param index The session index.
\param sessionInfo Pointer to a pre-allocated session_info to be filled
out by the function.
\return
- \c B_OK: Everything went fine.
- an error code: The contents of \a sessionInfo is undefined.
*/
status_t
get_nth_session_info(int deviceFD, int32 index, session_info *sessionInfo)
{
status_t error = (sessionInfo ? B_OK : B_BAD_VALUE);
disk_scanner_module_info *diskScanner = NULL;
// get the disk scanner module
if (error == B_OK) {
error = get_module(DISK_SCANNER_MODULE_NAME,
(module_info**)&diskScanner);
}
// get the session info
if (error == B_OK) {
error = diskScanner->get_nth_session_info(deviceFD, index,
sessionInfo, NULL);
}
// put the partition scanner module
if (diskScanner)
put_module(diskScanner->module.name);
return error;
}
// get_nth_partition_info
/*! \brief Retrieves information about a partition on a device.
The fields \c device and \c mounted_at of \a partitionInfo are not set.
\param deviceFD File descriptor for the device in question.
\param sessionIndex The index of the session on which the partition
resides.
\param partitionIndex The partition index.
\param partitionInfo Pointer to a pre-allocated extended_partition_info
to be filled out by the function.
\param partitionMapName Pointer to a pre-allocated char buffer of minimal
size \c 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 \c NULL.
\return
- \c B_OK: Everything went fine.
- an error code: The contents of \a partitionInfo is undefined.
*/
status_t
get_nth_partition_info(int deviceFD, int32 sessionIndex, int32 partitionIndex,
extended_partition_info *partitionInfo,
char *partitionMapName)
{
if (partitionInfo == NULL)
return B_BAD_VALUE;
session_info sessionInfo;
disk_scanner_module_info *diskScanner = NULL;
// get the disk scanner module
status_t error = get_module(DISK_SCANNER_MODULE_NAME,
(module_info**)&diskScanner);
if (diskScanner == NULL)
return error;
// get the session info
error = diskScanner->get_nth_session_info(deviceFD, sessionIndex,
&sessionInfo, NULL);
// get the partition info
if (error == B_OK) {
partitionInfo->info.logical_block_size
= sessionInfo.logical_block_size;
partitionInfo->info.session = sessionIndex;
partitionInfo->info.partition = partitionIndex;
// NOTE: partitionInfo->info.device is not filled in!
// The user can this info via B_GET_PARTITION_INFO. We could get the dir
// of the raw device and construct the partition device name with session and
// partition ID.
// Update: No, we can neither get the name of the raw device nor of the
// directory it lives in. We only have a FD and I see no way to get a path
// from it. Since deviceFD might represent an image file, we can't even get
// the its path by recursively searching the /dev/disk directory.
partitionInfo->info.device[0] = '\0';
error = diskScanner->get_nth_partition_info(deviceFD, &sessionInfo,
partitionIndex, partitionInfo, partitionMapName, NULL);
}
// get the FS info
if (error == B_OK) {
bool hidden = (partitionInfo->flags & B_HIDDEN_PARTITION);
if (!hidden) {
error = diskScanner->get_partition_fs_info(deviceFD,
partitionInfo);
}
// in case the partition is no data partition or the FS is unknown,
// we fill in the respective fields
if (hidden || error == B_ENTRY_NOT_FOUND) {
error = B_OK;
partitionInfo->file_system_short_name[0] = '\0';
partitionInfo->file_system_long_name[0] = '\0';
partitionInfo->volume_name[0] = '\0';
// partitionInfo->mounted_at[0] = '\0';
partitionInfo->file_system_flags = 0;
}
// NOTE: Where do we get mounted_at from?
// Update: Actually, it looks, like it is really hard. We could traverse the
// list of mounted devices, build for each one the raw device path from its
// partition device path, check, if the raw device is the same one as deviceFD.
// Then, with the path of the raw device we have more options.
}
// put the partition scanner module
if (diskScanner)
put_module(diskScanner->module.name);
return error;
}
// get_partitioning_parameters
/*! \brief Returns parameters for partitioning a session.
The partitioning system (module) identified by \a identifier is asked to
return parameters for the session. If the session is already partitioned
using this system, 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 \c B_OK, but doesn't fill in the buffer; the required buffer
size is returned in \a actualSize. If the buffer is large enough,
\a actualSize is set to the actually used size. The size includes the
terminating null.
\param deviceFD The device the session to be partitioned resides on.
\param sessionIndex The index of the session to be partitioned.
\param identifier A string identifying the partitioning system to be used.
\param buffer Pointer to a pre-allocated buffer of size \a bufferSize.
\param bufferSize The size of \a buffer.
\param actualSize Pointer to a pre-allocated size_t to be set to the
actually needed buffer size.
\return
- \c B_OK: The parameters could be retrieved or the buffer is too
small. \a actualSize has to be checked!
- another error code, if something went wrong
*/
status_t
get_partitioning_parameters(int deviceFD, int32 sessionIndex,
const char *identifier, char *buffer,
size_t bufferSize, size_t *actualSize)
{
status_t error = (identifier && buffer && actualSize ? B_OK : B_BAD_VALUE);
disk_scanner_module_info *diskScanner = NULL;
session_info sessionInfo;
// get the disk scanner module
if (error == B_OK) {
error = get_module(DISK_SCANNER_MODULE_NAME,
(module_info**)&diskScanner);
}
// get the session info
if (error == B_OK) {
error = diskScanner->get_nth_session_info(deviceFD, sessionIndex,
&sessionInfo, NULL);
}
// get the parameters
if (error == B_OK) {
error = diskScanner->get_partitioning_params(deviceFD, &sessionInfo,
identifier, buffer, bufferSize, actualSize);
}
// put the partition scanner module
if (diskScanner)
put_module(diskScanner->module.name);
return error;
}
// get_fs_initialization_parameters
/*! \brief Returns parameters for initializing a volume.
The FS identified by \a fileSystem is asked to return parameters for
the volume. If the volume is already initialized with this FS, then the
parameters describing the current state will be returned, otherwise
default values.
If the supplied buffer is too small for the parameters, the function
returns \c B_OK, but doesn't fill in the buffer; the required buffer
size is returned in \a actualSize. If the buffer is large enough,
\a actualSize is set to the actually used size. The size includes the
terminating null.
\param deviceFD The device the partition to be initialized resides on.
\param sessionIndex The index of the session the partition to be
initialized resides on.
\param partitionIndex The index of the partition to be initialized.
\param fileSystem A string identifying the file system to be used.
\param buffer Pointer to a pre-allocated buffer of size \a bufferSize.
\param bufferSize The size of \a buffer.
\param actualSize Pointer to a pre-allocated size_t to be set to the
actually needed buffer size.
\return
- \c B_OK: The parameters could be retrieved or the buffer is too
small. \a actualSize has to be checked!
- another error code, if something went wrong
*/
status_t
get_fs_initialization_parameters(int deviceFD, int32 sessionIndex,
int32 partitionIndex, const char *fileSystem,
char *buffer, size_t bufferSize,
size_t *actualSize)
{
// not yet implemented
return B_UNSUPPORTED;
}
// partition_session
/*! \brief Partitions a specified session on a device using the paritioning
system identified by \a identifier and according to supplied
parameters.
\param deviceFD The device the session to be partitioned resides on.
\param sessionIndex The index of the session to be partitioned.
\param identifier A string identifying the partitioning system to be used.
\param parameters Parameters according to which the session shall be
partitioned. May be \c NULL, depending on the concerned partition
module.
\return \c B_OK, if everything went fine, an error code otherwise.
*/
status_t
partition_session(int deviceFD, int32 sessionIndex, const char *identifier,
const char *parameters)
{
status_t error = (identifier ? B_OK : B_BAD_VALUE);
disk_scanner_module_info *diskScanner = NULL;
session_info sessionInfo;
// get the disk scanner module
if (error == B_OK) {
error = get_module(DISK_SCANNER_MODULE_NAME,
(module_info**)&diskScanner);
}
// get the session info
if (error == B_OK) {
error = diskScanner->get_nth_session_info(deviceFD, sessionIndex,
&sessionInfo, NULL);
}
// partition the session
if (error == B_OK) {
error = diskScanner->partition(deviceFD, &sessionInfo, identifier,
parameters);
}
// put the partition scanner module
if (diskScanner)
put_module(diskScanner->module.name);
return error;
}
// initialize_volume
/*! \brief Initializes a specified device using a certain file system.
\param where The path to the device to be initialized.
\param fileSystem The identifier of the file system to be used for that
partition.
\param volumeName The name to be given to the initialized volume.
\param parameters Parameters according to which the session shall be
initialized.
\return \c B_OK, if everything went fine, an error code otherwise.
*/
status_t
initialize_volume(const char *where, const char *fileSystem,
const char *volumeName, const char *parameters)
{
// not yet implemented
return B_UNSUPPORTED;
}