path_disk_size_info.h File Reference

Query disk space on the given directory. More...

`#include "int_sizes.h"`
`#include "list.h"`
`#include "hash_table.h"`

Go to the source code of this file.

## Data Structures

struct | path_disk_size_info

## Functions

int | path_disk_size_info_get (const char *path, int64_t *measured_size, int64_t *number_of_files, struct hash_table *exclude_paths)
| Get the total disk usage on path.
int | path_disk_size_info_get_r (const char *path, int64_t max_secs, struct path_disk_size_info **state, struct hash_table *exclude_paths)
| Get a (perhaps partial) disk usage on path, but measure by max_secs at a time.

## Detailed Description

Query disk space on the given directory.

## Function Documentation

## path_disk_size_info_get()

int path_disk_size_info_get | ( | const char * | path,
|  | int64_t * | measured_size,
|  | int64_t * | number_of_files,
|  | struct hash_table * | exclude_paths )

Get the total disk usage on path.

Parameters

  path | Directory to be measured.
  *measured_size | A pointer to an integer that will be filled with the total space in bytes.
  *number_of_files | A pointer to an integer that will be filled with the total number of files, directories, and symbolic links.
  exclude_paths | Hash table with strings of paths that should not be measured. Values of the hash table are ignored.

Returns
  zero on success, -1 if an error is encounterd (see errno).

## path_disk_size_info_get_r()

int path_disk_size_info_get_r | ( | const char * | path,
|  | int64_t | max_secs,
|  | struct path_disk_size_info ** | state,
|  | struct hash_table * | exclude_paths )

Get a (perhaps partial) disk usage on path, but measure by max_secs at a time.

If *state is NULL, start a new measurement, otherwise continue from the state recorded in state (see path_disk_size_info). When the function returns, if *state->complete_measurement is 1, then the measurement was completed before a timeout.

Parameters

  path | Directory to be measured.
  max_secs | Maximum number of seconds to spend in the measurement.
  *state | State of the measurement.
  exclude_paths | Hash table with strings of paths that should not be measured. Values of the hash table are ignored.

Returns
  zero on success, -1 if an error is encounterd (see errno).