statvfs and cdrom problem

Christian Costa titan.costa at wanadoo.fr
Tue Apr 13 18:40:06 CDT 2004


Hi,

I'm trying to make GetFreeDiskSpace working with CDROM because a game 
needs it.
However, I'm experiencing problem with statvfs...
Indeed, statvfs always returns f_frsize = 0 and f_blocks = 0.
If I cd to /mnt/cdrom or edit a file in it, this does not help however 
if I run a grep or launch Konqueror in that directory,
statvfs magically works.
I suspect supermount is responsible because statvfs needs the cdrom to 
be "physically" mounted.

Is it a know issue? (I am on a Mandrake 9.1 base)
Or the only solution is to keep a fd opened during the statvfs call so 
the drive stays mounted...

Thanks in advance,
Christian

PS: I used the attached code for testing

-------------- next part --------------
#include <sys/types.h>
#include <sys/statvfs.h>
#include <sys/statfs.h>

int main()
{
  struct statvfs info;
  struct statfs inf;

  if (statfs("/mnt/cdrom", &inf) < 0)
  {
    printf("cannot do statfs\n");
    return 0;
  }
  printf("size = %ld - %ld\n", inf.f_bsize, inf.f_blocks);
  
  
  if (statvfs("/mnt/cdrom", &info ) < 0)
  {
    printf("cannot do statvfs\n");
    return 0;
  }
  printf("size = %ld - %ld - %ld\n", info.f_bsize, info.f_frsize, info.f_blocks);
  return 1;
}



More information about the wine-devel mailing list