http://www.aros.org AROS-Exec AROS-Exec Archives Power2People
kitty mascottop logo menu

partition

Index


AddBootFileSystem() AddPartition() ClosePartitionTable() CloseRootPartition()
CreatePartitionTable() DeletePartition() DestroyPartitionTable() FindFileSystemA()
GetFileSystemAttrsA() GetPartitionAttrs() GetPartitionTableAttrs() LoadBootFileSystems()
LoadFileSystem() OpenPartitionTable() OpenRootPartition() QueryPartitionAttrs()
QueryPartitionTableAttrs() ReadPartitionDataQ() SetPartitionAttrs() SetPartitionTableAttrs()
WritePartitionDataQ() WritePartitionTable()    

AddBootFileSystem()

Synopsis

LONG AddBootFileSystem(
         struct Node * handle );

Function

Adds the specified filesystem to the system list of bootable
filesystems (actually FileSystem.resource).

Inputs

handle - Filesystem handle obtained by FindFileSystemA()

Result

Zero if everything went okay or common dos.library-compliant error code.

Notes

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.

AddPartition()

Synopsis

struct PartitionHandle * AddPartition(
         struct PartitionHandle * root,
         const struct TagItem * taglist );

struct PartitionHandle * AddPartitionTags(
         struct PartitionHandle * root,
         TAG tag, ... );

Function

Add a new partition.

Inputs

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, ...)

Result

PartitionHandle of the new partition; 0 for an error

ClosePartitionTable()

Synopsis

void ClosePartitionTable(
         struct PartitionHandle * root );

Function

Close a partition table (and discard all changes). All partitions
and subpartitions in root->list will be removed recursively.

Inputs

root - partition table to close

CloseRootPartition()

Synopsis

void CloseRootPartition(
         struct PartitionHandle * ph );

Function

Close a root handle allocated by OpenRootPartition().

Inputs

ph - root handle created by OpenRootPartition()

CreatePartitionTable()

Synopsis

LONG CreatePartitionTable(
         struct PartitionHandle * root,
         ULONG type );

Function

Create a new partition table.

Inputs

root - partition to create table in
type - the type of the partition table to create

Result

0 on success; an error code otherwise

Notes

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().

DeletePartition()

Synopsis

void DeletePartition(
         struct PartitionHandle * ph );

Function

Delete a partition along with its subpartitions.

Inputs

ph - PartitionHandle to delete

DestroyPartitionTable()

Synopsis

LONG DestroyPartitionTable(
         struct PartitionHandle * root );

Function

Destroy a partition table by immediately overwriting table data on
disk.

Inputs

root - partition table to destroy

Result

0 on success; an error code otherwise

Notes

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.

FindFileSystemA()

Synopsis

struct Node * FindFileSystemA(
         struct PartitionHandle * table,
         const struct TagItem * taglist );

struct Node * FindFileSystem(
         struct PartitionHandle * table,
         TAG tag, ... );

Function

Locate a filesystem handler in the partition.

Inputs

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.

Result

Abstract handle of a filesystem or NULL if the filesystem with the
given parameters was not located in the partition.

GetFileSystemAttrsA()

Synopsis

void GetFileSystemAttrsA(
         struct Node * handle,
         const struct TagItem * taglist );

void GetFileSystemAttrs(
         struct Node * handle,
         TAG tag, ... );

Function

get attributes of a partition table

Inputs

handle      - Filesystem handle
taglist - list of attributes; unknown tags are ignored

Tags

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.

Result

None.

Notes

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.

GetPartitionAttrs()

Synopsis

LONG GetPartitionAttrs(
         struct PartitionHandle * ph,
         const struct TagItem * taglist );

LONG GetPartitionAttrsTags(
         struct PartitionHandle * ph,
         TAG tag, ... );

Function

Get attributes of a partition.

Inputs

ph      - PartitionHandle
taglist - list of attributes, unknown tags are ignored

Tags

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)

Result

Currently reserved, always zero.

Notes

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.

GetPartitionTableAttrs()

Synopsis

LONG GetPartitionTableAttrs(
         struct PartitionHandle * root,
         const struct TagItem * taglist );

LONG GetPartitionTableAttrsTags(
         struct PartitionHandle * root,
         TAG tag, ... );

Function

Get attributes of a partition table.

Inputs

ph      - PartitionHandle of the partition table
taglist - list of attributes; unknown tags are ignored

Tags

PTT_TYPE (ULONG *)
    Get partition table type
PTT_MAXLEADIN (LONG *)
PTT_RESERVED (ULONG *)
    Get number of reserved blocks

LoadBootFileSystems()

Synopsis

LONG LoadBootFileSystems();

Function

Perform a deferred loading of boot filesystems.

Inputs

None.

Result

Zero if everything went okay or DOS error code in case of failure.

Notes

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.

LoadFileSystem()

Synopsis

BPTR LoadFileSystem(
         struct Node * handle );

Function

Load the specified filesystem as a DOS segment list.

Inputs

handle - Filesystem handle obtained by FindFileSystemA()

Result

DOS seglist or NULL in case of failure.

OpenPartitionTable()

Synopsis

LONG OpenPartitionTable(
         struct PartitionHandle * root );

Function

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.

Inputs

root - root partition

Result

0 for success; an error code otherwise.

OpenRootPartition()

Synopsis

struct PartitionHandle * OpenRootPartition(
         CONST_STRPTR Device,
         LONG Unit );

Function

Create a root handle by opening a trackdisk-compatible device.

Inputs

Device - name of the block device
Unit - unit of the block device

Result

Handle to the device

QueryPartitionAttrs()

Synopsis

const struct PartitionAttribute * QueryPartitionAttrs(
         struct PartitionHandle * table );

Function

Query partition attributes.

Inputs

ph      - PartitionHandle to the table

Result

List of NULL-terminated ULONGs with attributes.

QueryPartitionTableAttrs()

Synopsis

const struct PartitionAttribute * QueryPartitionTableAttrs(
         struct PartitionHandle * table );

Function

Query partition table attributes.

Inputs

ph - PartitionHandle of a partition table

Result

List of NULL-terminated ULONGs with attributes.

ReadPartitionDataQ()

Synopsis

LONG ReadPartitionDataQ(
         struct PartitionHandle * Partition,
         APTR Buffer,
         ULONG DataSize,
         UQUAD StartBlock );

Function

Read raw data from the partition.

Inputs

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

Result

Return code of DoIO() function which was used to read the data.

SetPartitionAttrs()

Synopsis

LONG SetPartitionAttrs(
         struct PartitionHandle * ph,
         const struct TagItem * taglist );

LONG SetPartitionAttrsTags(
         struct PartitionHandle * ph,
         TAG tag, ... );

Function

Set attributes of a partition

Inputs

ph      - PartitionHandle
taglist - list of attributes; unknown tags are ignored

Tags

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)

SetPartitionTableAttrs()

Synopsis

LONG SetPartitionTableAttrs(
         struct PartitionHandle * root,
         const struct TagItem * taglist );

LONG SetPartitionTableAttrsTags(
         struct PartitionHandle * root,
         TAG tag, ... );

Function

Set attributes of a partition table.

Inputs

ph      - PartitionHandle of the partition table
taglist - list of attributes; unknown tags are ignored

WritePartitionDataQ()

Synopsis

LONG WritePartitionDataQ(
         struct PartitionHandle * Partition,
         APTR Buffer,
         ULONG DataSize,
         UQUAD StartBlock );

Function

Write raw data to the partition.

Inputs

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.

Result

Return code of DoIO() function which was used to write the data.

WritePartitionTable()

Synopsis

LONG WritePartitionTable(
         struct PartitionHandle * root );

Function

Write a partition table; writing this partition table doesn't affect
subpartition tables.

Inputs

root - partition table to write

Result

0 for success; an error code otherwise

Direitos de Cópia © 1995-2024, A Equipa de Desenvolvimento AROS. Todos Os Direitos Reservados.
Amiga®, AmigaOS®, Workbench e Intuition são marcas registadas de Amiga Inc. Todas as outras marcas comerciais pertencem aos seus respectivos proprietários.