FSInfo
Gets information on mounted filesystems.
Note that unlike other HIObject subsystems, filesystems are not forming a hierarchy:
if mountpoint resides on other filesystem, it wont be set as child to it.
Since usually filesystems reside on disk devices, FSInfo object contains reference
to corresponding DiskInfo object, and FSInfo probing causes DiskInfo probing as well.
POSIX
Uses statvfs()
syscall to gather statistics on file systems andgetmntent()
function to iterate over mounted filesystems in file/etc/mtab
(Linux) or /etc/mnttab
(Solaris).
Windows
Local filesystems are added by DiskInfo code while iterating over volumes.
FSInfo adds network drives to them by using WNetOpenEnum()
API call
Windows implementation doesn't support number of files
Functions
HI_FSINFO_FROM_OBJ, HI_FSINFO_TO_OBJ
Conversion macros
#define HI_FSINFO_FROM_OBJ(object) #define HI_FSINFO_TO_OBJ(fsi)
hi_fsinfo_find_bypath
public
Find corresponding fsinfo object by path of file
by comparing mountpoints with file path
ARGUMENTS
-
path - absolute path to file
RETURN VALUES
NULL if not found or fsinfo object
LIBEXPORT hi_fsinfo_t* hi_fsinfo_find_bypath(const char* path)
hi_fsinfo_find_bydev
public
Find corresponding fsinfo object by device
LIBEXPORT hi_fsinfo_t* hi_fsinfo_find_bydev(hi_dsk_info_t* di)
hi_fsinfo_bind_dev
Find appropriate device in disks hiobject hierarchy and
bind it to filesystem information object.
ARGUMENTS
-
fsi - filesystem information object
-
disks - list of disks received from
hi_dsk_list()
NOTES
call it from hi_fsinfo_probe_impl()
context
void hi_fsinfo_bind_dev(hi_fsinfo_t* fsi, list_head_t* disks)
hi_fsinfo_add
public
Add filesystem information to global list
STATIC_INLINE void hi_fsinfo_add(hi_fsinfo_t* fsi)
hi_fsinfo_find
public
Find filesystem by it's mountpoint
ARGUMENTS
-
name - - name of disk
RETURN VALUES
filesystem information or NULL if it wasn't found
STATIC_INLINE hi_fsinfo_t* hi_fsinfo_find(const char* mntpt)
hi_fsinfo_list
public
Probe system's filesystems (if needed) and return pointer
to global filesystem info list.
ARGUMENTS
-
reprobe - Probe system's filesystems again
RETURN VALUES
pointer to head or NULL if probe failed
NOTES
May call hi_dsk_list()
with reprobe = B_FALSE
STATIC_INLINE list_head_t* hi_fsinfo_list(boolean_t reprobe)
Types
typedef struct hi_fsinfo
File system information descriptor
MEMBERS
-
fs_hdr - HIObject header
-
fs_mountpoint - alias to
fs_hdr.name
- absolute path where filesystem is mounted -
fs_type - type of filesystem
-
fs_devpath - path to device that holds filesystem. Not necessary a name or
d_path
in DiskInfo hierarchy -
fs_device - corresponding DiskInfo device
-
fs_host - (not supported) hostname for network filesystem
-
fs_block_size - maximum size of filesystem block
-
fs_frag_size - fragments size or minimum size of block
-
fs_ino_count - (optional) total number of file entries that created or can be created
-
fs_ino_free - (optional) number of file entries that can be created
-
fs_space - filesystem total space in bytes
-
fs_space_free - filesystem free space in bytes
-
fs_readonly - is file system mounted in readonly mode?
-
fs_namemax - maximum length of filesystem name
typedef struct hi_fsinfo { hi_object_header_t fs_hdr; #define fs_mountpoint fs_hdr.name char fs_type[FSTYPELEN]; AUTOSTRING char* fs_devpath; hi_dsk_info_t* fs_device; AUTOSTRING char* fs_host; /* Stats */ unsigned long fs_block_size; unsigned long fs_frag_size; uint64_t fs_ino_count; uint64_t fs_ino_free; uint64_t fs_space; uint64_t fs_space_free; boolean_t fs_readonly; unsigned long fs_namemax; } hi_fsinfo_t;