Nut/OS  4.10.3
API Reference
Volume Support

Dealing with volumes. More...

Collaboration diagram for Volume Support:

Data Structures

struct  _PHATVBR
 Volume boot record. More...
struct  _PHATSECTBUF
 Sector buffer structure. More...
struct  _PHATVOL
 Volume info structure. More...

Typedefs

typedef struct _PHATVBR PHATVBR
 Volume boot record.
typedef struct _PHATSECTBUF PHATSECTBUF
 Sector buffer structure.
typedef struct _PHATVOL PHATVOL
 Volume info structure.

Functions

int PhatVolMount (NUTDEVICE *dev, NUTFILE *blkmnt, uint8_t part_type)
 Mount a PHAT volume.
int PhatVolUnmount (NUTDEVICE *dev)
 Unmount a PHAT volume.
uint32_t PhatClusterSector (NUTFILE *nfp, uint32_t clust)

Detailed Description

Dealing with volumes.


Typedef Documentation

typedef struct _PHATVBR PHATVBR

Volume boot record.

typedef struct _PHATSECTBUF PHATSECTBUF

Sector buffer structure.

typedef struct _PHATVOL PHATVOL

Volume info structure.


Function Documentation

int PhatVolMount ( NUTDEVICE dev,
NUTFILE blkmnt,
uint8_t  part_type 
)

Mount a PHAT volume.

This routine is called by the block device driver while mounting a partition. It reads and verifies the volume boot record, which is located in the first sector of a volume.

The routine may also initializes any caching mechanism. Thus, it must be called before any other read or write access.

Parameters:
devSpecifies the file system device.
blkmntHandle of the block device's partition mount.
part_typePartition type:
  • PTYPE_FAT32
  • PTYPE_FAT32_LBA
  • PTYPE_FAT16
  • PTYPE_FAT16_BIG
  • PTYPE_FAT16_LBA
  • PTYPE_FAT12
Returns:
0 on success or -1 in case of an error.

Definition at line 186 of file phatvol.c.

References _PHATVBR::bios_clustsz, _PHATVBR::bios_media, _PHATVBR::bios_ntabs, _PHATVBR::bios_root_clust, _PHATVBR::bios_rootsz, _PHATVBR::bios_rsvd_sects, _PHATVBR::bios_sectsz, _PHATVBR::bios_tabsz, _PHATVBR::bios_tabsz_big, _PHATVBR::bios_volsz, _PHATVBR::bios_volsz_big, _PHATVBR::boot_drive, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _NUTDEVICE::dev_ioctl, ENODEV, errno, free(), malloc(), memcpy(), memset(), _NUTFILE::nf_dev, NUTBLKDEV_INFO, NutEventPost(), _BLKPAR_INFO::par_blkbp, _BLKPAR_INFO::par_blksz, _BLKPAR_INFO::par_nfp, PhatDbgVbr(), PhatSectorRead(), PhatVolUnmount(), printf, PTYPE_FAT12, PTYPE_FAT16, PTYPE_FAT16_BIG, PTYPE_FAT16_LBA, PTYPE_FAT32, PTYPE_FAT32_LBA, _PHATSECTBUF::sect_data, _PHATSECTBUF::sect_num, stdout, _PHATVOL::vol_buf, _PHATVOL::vol_clustsz, _PHATVOL::vol_data_sect, _PHATVOL::vol_fsmutex, _PHATVOL::vol_iomutex, _PHATVOL::vol_last_clust, _PHATVOL::vol_numfree, _PHATVOL::vol_root_clust, _PHATVOL::vol_root_sect, _PHATVOL::vol_rootsz, _PHATVOL::vol_sectsz, _PHATVOL::vol_tab_sect, _PHATVOL::vol_tabsz, and _PHATVOL::vol_type.

Here is the call graph for this function:

int PhatVolUnmount ( NUTDEVICE dev)

Unmount a PHAT volume.

This routine is called by the block device driver while unmounting a partition.

Parameters:
devSpecifies the file system device.
Returns:
0 on success or -1 in case of an error.

Definition at line 372 of file phatvol.c.

References _NUTDEVICE::dev_dcb, free(), _PHATSECTBUF::sect_data, and _PHATVOL::vol_buf.

Referenced by PhatVolMount().

Here is the call graph for this function:

uint32_t PhatClusterSector ( NUTFILE nfp,
uint32_t  clust 
)

Definition at line 397 of file phatvol.c.

References _NUTDEVICE::dev_dcb, IsFixedRootDir(), _NUTFILE::nf_dev, _PHATVOL::vol_clustsz, _PHATVOL::vol_data_sect, and _PHATVOL::vol_root_sect.

Referenced by PhatDirOpen(), PhatFileOpen(), PhatFileRead(), and PhatFileWrite().

Here is the call graph for this function: