2 Copyright © 2008-2019, The AROS Development Team. All rights reserved.
9 #include <proto/exec.h>
10 #include <proto/dos.h>
14 short getnixfilesystemtype(LONG id_DiskType
);
16 /*****************************************************************************
19 #include <sys/mount.h>
28 Gets information about mounted filesystem.
31 path - path to any file in the filesystem we want to know about
32 buf - pointer to statfs structures where information about filesystem
36 Information about filesystem is stored in statfs structure
43 f_flags, f_files, f_ffree and f_fsid.val are always set to 0
44 f_mntfromname is set to an empty string
50 ******************************************************************************/
63 apath
= __path_u2a(path
);
70 /* Get filesystem data from lock */
71 if(((lock
= Lock(apath
, SHARED_LOCK
))))
75 /* Fill statfs structure */
76 buf
->f_type
= getnixfilesystemtype(data
.id_DiskType
);
78 buf
->f_fsize
= data
.id_BytesPerBlock
;
79 buf
->f_bsize
= data
.id_BytesPerBlock
;
80 buf
->f_blocks
= data
.id_NumBlocks
;
81 buf
->f_bfree
= data
.id_NumBlocks
- data
.id_NumBlocksUsed
;
82 buf
->f_bavail
= data
.id_NumBlocks
- data
.id_NumBlocksUsed
;
85 buf
->f_fsid
.val
[0] = 0;
86 buf
->f_fsid
.val
[1] = 0;
87 CopyMem(__path_a2u(AROS_BSTR_ADDR(((struct DeviceList
*)BADDR(data
.id_VolumeNode
))->dl_Name
)), buf
->f_mntonname
, MNAMELEN
);
88 buf
->f_mntonname
[MNAMELEN
-1] = '\0';
89 buf
->f_mntfromname
[0] = '\0';
103 errno
= __stdc_ioerr2errno(ioerr
);