2010-02-24 00:50:04     fstafs

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-02-24 00:50:04     fstafs

Karthikeyan Jeevanandam (INDIA)

Message: 86414   


Dear Mike,


We tried to use the statfs call to know the total size and total number of files present in the mounted device.




       struct statfs {

          long    f_type;     /* type of file system (see below) */

          long    f_bsize;    /* optimal transfer block size */

          long    f_blocks;   /* total data blocks in file system */

          long    f_bfree;    /* free blocks in fs */

          long    f_bavail;   /* free blocks avail to non-superuser */

          long    f_files;    /* total file nodes in file system */

          long    f_ffree;    /* free file nodes in fs */

          fsid_t  f_fsid;     /* file system id */

          long    f_namelen;  /* maximum length of filenames */



In the above we are getting proper values for bsize and f_blocks from which we could manipulate the size used.


But f_files and f_ffreee are returned "0" in case of uClinux but works properly in desktop linux .


We need to get the total number of files present in the device. Can you please provide info on this?


Is there any other way to achieve the same?








2010-02-24 08:34:42     Re: fstafs

Mike Frysinger (UNITED STATES)

Message: 86459   


you probably arent comparing apples to apples.  what file system exactly are you using statfs() on under the Blackfin system ?  and what file system on your desktop ?


i wouldnt be surprised if tmpfs/ramfs didnt maintain this information because it doesnt make sense -- the number of free entries depends entirely on the amount free memory and that changes on the fly.




2010-03-02 22:18:48     Re: fstafs

Karthikeyan Jeevanandam (INDIA)

Message: 86733   


Dear Mike,


We tired the same for a USB drive mounted to blackfin device. Filesystem is FAT