cctools
Functions
host_disk_info.h File Reference

Query disk space properties. More...

#include "int_sizes.h"
#include <time.h>

Go to the source code of this file.

Functions

int host_disk_info_get (const char *path, UINT64_T *avail, UINT64_T *total)
 Get the total and available space on a disk. More...
 
int check_disk_space_for_filesize (char *path, INT64_T file_size, UINT64_T disk_avail_threshold)
 Return whether a file will fit in the given directory. More...
 

Detailed Description

Query disk space properties.

Function Documentation

int host_disk_info_get ( const char *  path,
UINT64_T *  avail,
UINT64_T *  total 
)

Get the total and available space on a disk.

Parameters
pathA filename on the disk to be examined.
availA pointer to an integer that will be filled with the available space in bytes.
totalA pointer to an integer that will be filled with the total space in bytes.
Returns
Greater than or equal to zero on success, less than zero otherwise.
int check_disk_space_for_filesize ( char *  path,
INT64_T  file_size,
UINT64_T  disk_avail_threshold 
)

Return whether a file will fit in the given directory.

Parameters
pathA filename of the disk to be measured.
file_sizeAn integer that describes how large the incoming file is.
disk_avail_thresholdAn unsigned integer that describes the minimum available space to leave.
Returns
0 if the file will not fit, 1 if the file fits.