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,
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
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().
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,
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,
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-characters filesystem ID
FST_NAME (STRPTR *) - Get a pointer to filesystem name
FST_FSENTRY (struct FileSysEntry *) - Fill in the given struct FileSysEntry.
Name is returned as a pointer to internally allocated string. You should copy
it if you want to keep it after filesystem's partition table had been closed.
The following fields in struct FileSysEntry will not be filled in:
- Node name
- fse_Handler
- fse_SegList
You need to query for filesystem's name separately and copy it into BSTR
yourself, if you need to. Loading the handler is done by LoadFileSystem()
function.
LONG GetPartitionAttrs(
struct PartitionHandle * ph,
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 is 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 + NULL-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 parent partition containing the RDB itself), not absolute numbers.
The same applies to DriveGeomerty and geometry-related fields in DosEnvec structure.
Note that geometry data can be stored on disk in the partition table ifself (RDB for example), and
this way it can not match 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,
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 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.
A return code of DoIO() function which was used to read the data
LONG SetPartitionAttrs(
struct PartitionHandle * ph,
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 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.
A return code of DoIO() function which was used to write the data