PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches

FAT12, FAT16, FAT32 and, with CONFIG_FATFS_EXFAT, exFAT file systems on disks. More...

Functions

int pbl_fs_fat_mkfs (const struct pbl_disk *disk, const char *label)
 Create an empty FAT file system on a disk that is not mounted.
 

Variables

const struct pbl_fs_ops pbl_fs_fat_ops
 FAT format, for struct pbl_fs_mount::ops.
 

Detailed Description

FAT12, FAT16, FAT32 and, with CONFIG_FATFS_EXFAT, exFAT file systems on disks.

A mount takes the disk in struct pbl_fs_mount::fs_data; the disk holds the file system on its own, without a partition table; pbl_fs_mount() fails with -ENODEV when it holds none, and with -ENOTSUP when its sectors are larger than CONFIG_FATFS_MAX_SECTOR_SIZE. Paths below a mount are at most 255 bytes.

static struct pbl_fs_mount s_mnt = {
.mnt_point = "/disk",
.ops = &pbl_fs_fat_ops,
.fs_data = (void *)&pbl_disk_ram,
};
ret = pbl_fs_fat_mkfs(&pbl_disk_ram, "DISK");
if (ret == 0) {
ret = pbl_fs_mount(&s_mnt);
}
const struct pbl_disk pbl_disk_ram
A disk in RAM, of CONFIG_DISK_RAM_SIZE KiB in 512-byte sectors, zeroed at boot.
int pbl_fs_fat_mkfs(const struct pbl_disk *disk, const char *label)
Create an empty FAT file system on a disk that is not mounted.
const struct pbl_fs_ops pbl_fs_fat_ops
FAT format, for struct pbl_fs_mount::ops.
const char * mnt_point
Mount point: "/", or an absolute path without a trailing '/', such as "/sdcard".
Definition fs_sys.h:86
A mounted file system.
Definition fs_sys.h:84

Function Documentation

◆ pbl_fs_fat_mkfs()

int pbl_fs_fat_mkfs ( const struct pbl_disk *  disk,
const char *  label 
)

Create an empty FAT file system on a disk that is not mounted.

The type and cluster size follow from the size of the disk. pbl_fs_format() does the same on a mounted disk, without a label. Requires CONFIG_FATFS_MKFS.

Parameters
diskDisk.
labelVolume label, or NULL for none.
Return values
-EBUSYThe disk is mounted.
-EINVALThe disk is too small or too large, or label is not a valid label.
-ENOTSUPThe sectors of the disk are larger than CONFIG_FATFS_MAX_SECTOR_SIZE.
-EROFSThe disk is read-only.
Returns
Other negative errno on failure.

Variable Documentation

◆ pbl_fs_fat_ops

const struct pbl_fs_ops pbl_fs_fat_ops
extern

FAT format, for struct pbl_fs_mount::ops.