- Set a default PCM volume so that something can be heard when driver is
[AROS.git] / test / clib / getfsstat.c
blob333f8ee63b8dbd32bebc8d12fe3f28840a4caf1d
1 #include <stdlib.h>
2 #include <sys/types.h>
3 #include <sys/mount.h>
4 #include <stdio.h>
5 #include "test.h"
7 struct statfs *buf = NULL;
9 int main()
11 int fscount, newfscount;
12 int i;
13 fscount = getfsstat(NULL, 0, 0);
14 TEST((fscount != -1));
15 printf("Number of filesystems: %d\n", fscount);
16 buf = malloc(sizeof(struct statfs) * fscount);
17 TEST(buf);
18 newfscount = getfsstat(buf, (long) sizeof(struct statfs) * fscount, 0);
19 TEST((newfscount != -1));
20 TEST((newfscount == fscount));
21 printf("Printing filesystem data:\n\n");
22 for(i = 0; i < newfscount; i++)
24 printf("Record number:\t\t%d\n", i+1);
25 printf("Name:\t\t\t%s\n", buf[i].f_mntonname);
26 printf("Fundamental block size:\t%ld\n", buf[i].f_fsize);
27 printf("Optimal block size:\t%ld\n", buf[i].f_bsize);
28 printf("Number of blocks:\t%ld\n", buf[i].f_blocks);
29 printf("Free blocks:\t\t%ld\n", buf[i].f_bfree);
30 printf("Available blocks:\t%ld\n", buf[i].f_bavail);
31 printf("\n");
33 newfscount = getfsstat(buf, 1, 0);
34 TEST((newfscount == 0));
35 cleanup();
37 return OK;
40 void cleanup()
42 if(buf)
43 free(buf);