filesystem.h (1245B)
1 #ifndef FILESYSTEM_H 2 #define FILESYSTEM_H 3 4 #include <stddef.h> 5 #include <sys/types.h> 6 7 struct FilesystemStatus { 8 unsigned long long block_size; 9 unsigned long long total_blocks; 10 unsigned long long free_blocks; 11 }; 12 13 struct FilesystemMount { 14 char *source; 15 char *type; 16 char *path; 17 }; 18 19 /* a filesystem as stat -f shows it. type is the kernel's number for the 20 * kind of filesystem, 0 where it has none */ 21 struct FilesystemInfo { 22 unsigned long long id; 23 long namelen; 24 long type; 25 long bsize; 26 long frsize; 27 unsigned long long blocks; 28 unsigned long long bfree; 29 unsigned long long bavail; 30 unsigned long long files; 31 unsigned long long ffree; 32 }; 33 34 int fs_get_status(const char *, struct FilesystemStatus *); 35 int fs_get_mounts(struct FilesystemMount **, size_t *); 36 void fs_free_mounts(struct FilesystemMount *, size_t); 37 /* the filesystem path is on, or fd's when path is null */ 38 int fs_get_info(const char *, int, struct FilesystemInfo *); 39 const char *fs_type_name(long); 40 41 /* each kernel packs the two numbers of a device its own way */ 42 unsigned int fs_devmajor(dev_t); 43 unsigned int fs_devminor(dev_t); 44 dev_t fs_makedev(unsigned int, unsigned int); 45 46 #endif