Hi everyone,
df command can help to print out various disk space information for each file system and its underlying implementation relies on the statfs function.
I do not know why, in its implementation, the way of getting the available size of a file system is :
And, why not useCode:f_bavail x f_bsize / 1024 ; // free blocks available to non-super user x block size of the file system / 1 Kbyte
As the struct statfs defined, the f_bavail is the free block available to non-super user, and in the embedded (linux) world, most of the time, the system/program runs under the super user mode on the device. In this case, should we use f_bfree instead if we want to find out the total free space available of a file system?Code:f_bfree x f_bsize / 1024 // total free blocks of the file system x a block size of the file system / 1 Kbyte
Thanks~



LinkBack URL
About LinkBacks



