|
| int | afprun (char *cmd, int *outfd) |
| | run a command
|
| static long long int | get_tm_bandsize (const char *path) |
| | Read band-size info from Info.plist XML file of an TM sparsebundle.
|
| static long long int | get_tm_bands (const char *path) |
| | Return number on entries in a directory.
|
| static int | get_tm_used (struct vol *vol) |
| | Calculate used size of a TimeMachine volume.
|
| static int | getvolspace (const AFPObj *obj, struct vol *vol, uint32_t *bfree, uint32_t *btotal, VolSpace *xbfree, VolSpace *xbtotal, uint32_t *bsize) |
| static void | vol_setdate (uint16_t id, struct adouble *adp, time_t date) |
| | set volume creation date
|
| static int | getvolparams (const AFPObj *obj, uint16_t bitmap, struct vol *vol, struct stat *st, char *buf, size_t *buflen) |
| static int | stat_vol (const AFPObj *obj, uint16_t bitmap, struct vol *vol, char *rbuf, size_t *rbuflen) |
| int | afp_getsrvrparms (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| static int | volume_codepage (AFPObj *obj, struct vol *volume) |
| static int | volume_openDB (const AFPObj *obj, struct vol *volume) |
| static void | server_ipc_volumes (AFPObj *obj) |
| int | afp_openvol (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| void | closevol (const AFPObj *obj, struct vol *vol) |
| void | close_all_vol (const AFPObj *obj) |
| int | afp_closevol (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| int | pollvoltime (AFPObj *obj) |
| | poll if a volume is changed by other processes.
|
| void | setvoltime (AFPObj *obj, struct vol *vol) |
| int | afp_getvolparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| int | afp_setvolparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| int get_tm_used |
( |
struct vol * | vol | ) |
|
|
static |
Calculate used size of a TimeMachine volume.
This assumes that the volume is used only for TimeMachine.
- readdir(path of volume)
- for every element that matches regex "\(.*\)\.sparsebundle$" :
- parse "\1.sparsebundle/Info.plist" and read the band-size XML key integer value
- readdir "\1.sparsebundle/bands/" counting files
- calculate used size as: (file_count - 1) * band-size
The result of the calculation is returned in "volume->v_tm_used". "volume->v_appended" gets reset to 0. "volume->v_tm_cachetime" is updated with the current time from time(NULL).
"volume->v_tm_used" is cached for TM_USED_CACHETIME seconds and updated by "volume->v_appended". The latter is increased by X every time the client appends X bytes to a file (in fork.c).
- Parameters
-
| vol | (rw) volume to calculate |
- Returns
- 0 on success, -1 on error