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 and
getmntent() 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

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

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

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

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

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;