ntfs_fuse_statfs(): fix free inodes available for non-privileged processes
parent
42444cdd94
commit
3502cdc3fb
|
|
@ -245,7 +245,7 @@ static long ntfs_get_nr_free_clusters(ntfs_volume *vol)
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
|
static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
|
||||||
struct statvfs *sfs)
|
struct statvfs *sfs)
|
||||||
{
|
{
|
||||||
s64 size;
|
s64 size;
|
||||||
int delta_bits;
|
int delta_bits;
|
||||||
|
|
@ -255,22 +255,23 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
|
||||||
if (!vol)
|
if (!vol)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* Optimal transfer block size. */
|
/* File system block size, used for optimal transfer block size. */
|
||||||
sfs->f_bsize = vol->cluster_size;
|
sfs->f_bsize = vol->cluster_size;
|
||||||
|
|
||||||
|
/* Fundamental file system block size, used as the unit. */
|
||||||
sfs->f_frsize = vol->cluster_size;
|
sfs->f_frsize = vol->cluster_size;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Total data blocks in file system in units of f_bsize and since
|
* Total number of blocks on file system in units of f_frsize.
|
||||||
* inodes are also stored in data blocs ($MFT is a file) this is just
|
* Since inodes are also stored in blocks ($MFT is a file) hence
|
||||||
* the total clusters.
|
* this is the number of clusters on the volume.
|
||||||
*/
|
*/
|
||||||
sfs->f_blocks = vol->nr_clusters;
|
sfs->f_blocks = vol->nr_clusters;
|
||||||
|
|
||||||
/* Free data blocks in file system in units of f_bsize. */
|
/* Free blocks available for all and for non-privileged processes. */
|
||||||
size = vol->free_clusters;
|
size = vol->free_clusters;
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
/* Free blocks avail to non-superuser, same as above on NTFS. */
|
|
||||||
sfs->f_bavail = sfs->f_bfree = size;
|
sfs->f_bavail = sfs->f_bfree = size;
|
||||||
|
|
||||||
/* Free inodes on the free space */
|
/* Free inodes on the free space */
|
||||||
|
|
@ -280,15 +281,14 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
|
||||||
else
|
else
|
||||||
size >>= -delta_bits;
|
size >>= -delta_bits;
|
||||||
|
|
||||||
/* Number of inodes in file system (at this point in time). */
|
/* Number of inodes at this point in time. */
|
||||||
sfs->f_files = (vol->mftbmp_na->allocated_size << 3) + size;
|
sfs->f_files = (vol->mftbmp_na->allocated_size << 3) + size;
|
||||||
|
|
||||||
/* Free inodes in fs (based on current total count). */
|
/* Free inodes available for all and for non-privileged processes. */
|
||||||
size += vol->free_mft_records;
|
size += vol->free_mft_records;
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
size = 0;
|
size = 0;
|
||||||
sfs->f_ffree = size;
|
sfs->f_ffree = sfs->f_favail = size;
|
||||||
sfs->f_favail = 0;
|
|
||||||
|
|
||||||
/* Maximum length of filenames. */
|
/* Maximum length of filenames. */
|
||||||
sfs->f_namemax = NTFS_MAX_NAME_LEN;
|
sfs->f_namemax = NTFS_MAX_NAME_LEN;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue