partition
Index
LONG AddBootFileSystem(
struct Node * handle );
Adds the specified filesystem to the system list of bootable
filesystems (actually FileSystem.resource).
handle - Filesystem handle obtained by FindFileSystemA()
Zero if everything went okay or common dos.library-compliant error code.
This function can be called during system startup before dos.library
is available. In this case filesystem loading will be delayed until
dos.library started up. Delayed loading will be handled automatically
without any caller's intervention.
struct PartitionHandle * AddPartition(
struct PartitionHandle * root,
const struct TagItem * taglist );
struct PartitionHandle * AddPartitionTags(
struct PartitionHandle * root,
TAG tag, ... );
root - PartitionHandle, where to add the new partition
taglist - tags that specify more information about the partition
unknown tags are ignored
PT_DOSENVEC - ptr to a DosEnvec
de_LowCyl and de_HighCyl specify start and end of cylinder
de_Reserved, de_Bootblocks, ...
de_Surfaces, de_BlocksPerTrack, ... are inherited from "root"
PT_TYPE - partition type (depends on PartitionTable type)
PT_POSITION - position number within the partition table (MBR->PC)
PT_ACTIVE - set this partition active (MBR->PC)
PT_NAME - set partition name (HD0, HD1, ...)
PartitionHandle of the new partition; 0 for an error
void ClosePartitionTable(
struct PartitionHandle * root );
Close a partition table (and discard all changes). All partitions
and subpartitions in root->list will be removed recursively.
root - partition table to close
void CloseRootPartition(
struct PartitionHandle * ph );
Close a root handle allocated by OpenRootPartition().
ph - root handle created by OpenRootPartition()
LONG CreatePartitionTable(
struct PartitionHandle * root,
ULONG type );
Create a new partition table.
root - partition to create table in
type - the type of the partition table to create
0 on success; an error code otherwise
After calling this function the state of the PartitionHandle will be
the same as when calling OpenPartitionTable(). Therefore before
closing the PartitionHandle you should call ClosePartitionTable().
void DeletePartition(
struct PartitionHandle * ph );
Delete a partition along with its subpartitions.
ph - PartitionHandle to delete
LONG DestroyPartitionTable(
struct PartitionHandle * root );
Destroy a partition table by immediately overwriting table data on
disk.
root - partition table to destroy
0 on success; an error code otherwise
After calling this function the state of the PartitionHandle will be
the same as before calling OpenPartitionTable(). Therefore do not
reference any child PartitionHandles any more.
struct Node * FindFileSystemA(
struct PartitionHandle * table,
const struct TagItem * taglist );
struct Node * FindFileSystem(
struct PartitionHandle * table,
TAG tag, ... );
Locate a filesystem handler in the partition.
ph - PartitionHandle to the table
taglist - Taglist specifying arguments. Possible tags are:
FST_ID - specify ID of the filesystem.
FST_NAME - specify name of the filesystem.
If more than one condition is specified for the search, logical
AND will be applied to them. Empty taglist will give you the
first filesystem in the list.
Abstract handle of a filesystem or NULL if the filesystem with the
given parameters was not located in the partition.
void GetFileSystemAttrsA(
struct Node * handle,
const struct TagItem * taglist );
void GetFileSystemAttrs(
struct Node * handle,
TAG tag, ... );
get attributes of a partition table
handle - Filesystem handle
taglist - list of attributes; unknown tags are ignored
FST_ID (ULONG *) - Get 4-character FS ID
FST_NAME (STRPTR *) - Get a pointer to FS name
FST_FSENTRY (struct FileSysEntry *) - Fill in given FileSysEntry.
Name is returned as a pointer to an internally allocated string. You
should copy it if you want to keep it after the filesystem's
partition table handle has been closed.
The following fields in struct FileSysEntry will not be filled in:
- Node name
- fse_Handler
- fse_SegList
You need to query for the filesystem's name separately and copy it
into a BSTR yourself, if you need to. Loading the handler is done by
the LoadFileSystem() function.
LONG GetPartitionAttrs(
struct PartitionHandle * ph,
const struct TagItem * taglist );
LONG GetPartitionAttrsTags(
struct PartitionHandle * ph,
TAG tag, ... );
Get attributes of a partition.
ph - PartitionHandle
taglist - list of attributes, unknown tags are ignored
PT_GEOMETRY (struct DriveGeometry *)
Fill in DriveGeometry structure
PT_DOSENVEC (struct DosEnvec *)
Fill in DosEnvec structure
PT_TYPE (struct PartitionType *)
Get partition type
PT_POSITION (ULONG *)
Get position (entry number) of partition within its table.
Returns -1 if there's no table (e.g. if used on disk root)
PT_ACTIVE (LONG *)
Get value of "active" flag (PC-MBR specific)
PT_BOOTABLE (LONG *)
Get value of "bootable" flag
PT_AUTOMOUNT (LONG *)
Get value of "automount" flag
PT_NAME (STRPTR)
Get name of partition (max 31 Bytes + NUL-byte)
PT_STARTBLOCK (UQUAD *)
Get number of starting block for the partition (V2)
PT_ENDBLOCK (UQUAD *)
Get number of ending block for the partition (V2)
Currently reserved, always zero.
Nested partition tables (e.g. RDB subpartitions on PC MBR drive) are
treated as virtual disks. In this case start and end block numbers are
relative to the beginning of the virtual disk (which is represented by
a parent partition containing the RDB itself), not absolute numbers.
The same applies to DriveGeomerty and geometry-related fields in the
DosEnvec structure.
Note that geometry data can be stored on disk in the partition table
ifself (RDB for example), and this way it may not match the physical
device's geometry (for example, if the disk was partitioned on
another operating system which used virtual geometry). In this case
you might need to adjust these data in order to mount the file system
correctly (if absolute start/end blocks are not cylinder-aligned).
Starting from V2, partition.library always provides default values
for all attributes, even for those not listed as readable in
QueryPartitionAttrs() results.
LONG GetPartitionTableAttrs(
struct PartitionHandle * root,
const struct TagItem * taglist );
LONG GetPartitionTableAttrsTags(
struct PartitionHandle * root,
TAG tag, ... );
Get attributes of a partition table.
ph - PartitionHandle of the partition table
taglist - list of attributes; unknown tags are ignored
PTT_TYPE (ULONG *)
Get partition table type
PTT_MAXLEADIN (LONG *)
PTT_RESERVED (ULONG *)
Get number of reserved blocks
LONG LoadBootFileSystems();
Perform a deferred loading of boot filesystems.
Zero if everything went okay or DOS error code in case of failure.
This function is actually private; it's called by dos.library during
the initialization process. There's no sense to call it from within
user software.
BPTR LoadFileSystem(
struct Node * handle );
Load the specified filesystem as a DOS segment list.
handle - Filesystem handle obtained by FindFileSystemA()
DOS seglist or NULL in case of failure.
LONG OpenPartitionTable(
struct PartitionHandle * root );
Open a partition table. On success root->list will be filled with a
list of PartitionHandles. If one partition contains more
subpartitions, the caller should call OpenPartitionTable() on the
PartitionHandle recursively.
0 for success; an error code otherwise.
struct PartitionHandle * OpenRootPartition(
CONST_STRPTR Device,
LONG Unit );
Create a root handle by opening a trackdisk-compatible device.
Device - name of the block device
Unit - unit of the block device
const struct PartitionAttribute * QueryPartitionAttrs(
struct PartitionHandle * table );
Query partition attributes.
ph - PartitionHandle to the table
List of NULL-terminated ULONGs with attributes.
const struct PartitionAttribute * QueryPartitionTableAttrs(
struct PartitionHandle * table );
Query partition table attributes.
ph - PartitionHandle of a partition table
List of NULL-terminated ULONGs with attributes.
LONG ReadPartitionDataQ(
struct PartitionHandle * Partition,
APTR Buffer,
ULONG DataSize,
UQUAD StartBlock );
Read raw data from the partition.
Partition - a handle to a partition to read from
Buffer - a pointer to a data buffer
DataSize - Size of data to read in bytes. This size must be a
multiple of block size in order to ensure correct
operation
StartBlock - Number of the first block to start reading from
Return code of DoIO() function which was used to read the data.
LONG SetPartitionAttrs(
struct PartitionHandle * ph,
const struct TagItem * taglist );
LONG SetPartitionAttrsTags(
struct PartitionHandle * ph,
TAG tag, ... );
Set attributes of a partition
ph - PartitionHandle
taglist - list of attributes; unknown tags are ignored
PT_DOSENVEC - set new DosEnvec values
PT_TYPE - change partition type (MBR-PC)
PT_POSITION - move partition to another position (MBR-PC)
PT_ACTIVE - set partition active
PT_NAME - change name of partition (max 31 Bytes + NULL-byte)
LONG SetPartitionTableAttrs(
struct PartitionHandle * root,
const struct TagItem * taglist );
LONG SetPartitionTableAttrsTags(
struct PartitionHandle * root,
TAG tag, ... );
Set attributes of a partition table.
ph - PartitionHandle of the partition table
taglist - list of attributes; unknown tags are ignored
LONG WritePartitionDataQ(
struct PartitionHandle * Partition,
APTR Buffer,
ULONG DataSize,
UQUAD StartBlock );
Write raw data to the partition.
Partition - a handle to a partition to read from
Buffer - a pointer to a data buffer
DataSize - Size of data to read in bytes. This size must be a
multiple of block size in order to ensure correct
operation.
StartBlock - Number of the first block to start writing from.
Return code of DoIO() function which was used to write the data.
LONG WritePartitionTable(
struct PartitionHandle * root );
Write a partition table; writing this partition table doesn't affect
subpartition tables.
root - partition table to write
0 for success; an error code otherwise
|
|