mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-23 02:19:15 +01:00
patch applied from https://sourceforge.net/tracker/?func=detail&aid=2721592&group_id=114505&atid=668551
This commit is contained in:
parent
116092466a
commit
52def810fc
@ -463,12 +463,12 @@ int _FAT_statvfs_r (struct _reent *r, const char *path, struct statvfs *buf)
|
|||||||
buf->f_bsize = partition->bytesPerCluster; // File system block size.
|
buf->f_bsize = partition->bytesPerCluster; // File system block size.
|
||||||
buf->f_frsize = partition->bytesPerCluster; // Fundamental file system block size.
|
buf->f_frsize = partition->bytesPerCluster; // Fundamental file system block size.
|
||||||
|
|
||||||
buf->f_blocks = partition->fat.lastCluster - CLUSTER_FIRST; // Total number of blocks on file system in units of f_frsize.
|
buf->f_blocks = partition->fat.lastCluster - CLUSTER_FIRST + 1; // Total number of blocks on file system in units of f_frsize.
|
||||||
buf->f_bfree = freeClusterCount; // Total number of free blocks.
|
buf->f_bfree = freeClusterCount; // Total number of free blocks.
|
||||||
buf->f_bavail = freeClusterCount; // Number of free blocks available to non-privileged process.
|
buf->f_bavail = freeClusterCount; // Number of free blocks available to non-privileged process.
|
||||||
|
|
||||||
// Treat requests for info on inodes as clusters
|
// Treat requests for info on inodes as clusters
|
||||||
buf->f_files = partition->fat.lastCluster - CLUSTER_FIRST; // Total number of file serial numbers.
|
buf->f_files = partition->fat.lastCluster - CLUSTER_FIRST + 1; // Total number of file serial numbers.
|
||||||
buf->f_ffree = freeClusterCount; // Total number of free file serial numbers.
|
buf->f_ffree = freeClusterCount; // Total number of free file serial numbers.
|
||||||
buf->f_favail = freeClusterCount; // Number of file serial numbers available to non-privileged process.
|
buf->f_favail = freeClusterCount; // Number of file serial numbers available to non-privileged process.
|
||||||
|
|
||||||
|
@ -195,12 +195,13 @@ PARTITION* _FAT_partition_constructor (const DISC_INTERFACE* disc, uint32_t cach
|
|||||||
partition->totalSize = ((uint64_t)partition->numberOfSectors - (partition->dataStart - startSector)) * (uint64_t)partition->bytesPerSector;
|
partition->totalSize = ((uint64_t)partition->numberOfSectors - (partition->dataStart - startSector)) * (uint64_t)partition->bytesPerSector;
|
||||||
|
|
||||||
// Store info about FAT
|
// Store info about FAT
|
||||||
partition->fat.lastCluster = (partition->numberOfSectors - (uint32_t)(partition->dataStart - startSector)) / partition->sectorsPerCluster;
|
uint32_t clusterCount = (partition->numberOfSectors - (uint32_t)(partition->dataStart - startSector)) / partition->sectorsPerCluster;
|
||||||
|
partition->fat.lastCluster = clusterCount + CLUSTER_FIRST - 1;
|
||||||
partition->fat.firstFree = CLUSTER_FIRST;
|
partition->fat.firstFree = CLUSTER_FIRST;
|
||||||
|
|
||||||
if (partition->fat.lastCluster < CLUSTERS_PER_FAT12) {
|
if (clusterCount < CLUSTERS_PER_FAT12) {
|
||||||
partition->filesysType = FS_FAT12; // FAT12 volume
|
partition->filesysType = FS_FAT12; // FAT12 volume
|
||||||
} else if (partition->fat.lastCluster < CLUSTERS_PER_FAT16) {
|
} else if (clusterCount < CLUSTERS_PER_FAT16) {
|
||||||
partition->filesysType = FS_FAT16; // FAT16 volume
|
partition->filesysType = FS_FAT16; // FAT16 volume
|
||||||
} else {
|
} else {
|
||||||
partition->filesysType = FS_FAT32; // FAT32 volume
|
partition->filesysType = FS_FAT32; // FAT32 volume
|
||||||
|
Loading…
Reference in New Issue
Block a user