|
int | afprun (char *cmd, int *outfd) |
static long long int | get_tm_bandsize (const char *path) |
static long long int | get_tm_bands (const char *path) |
static int | get_tm_used (struct vol *restrict vol) |
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) |
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 _U_, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
static int | volume_codepage (AFPObj *obj, struct vol *volume) |
static int | volume_openDB (const AFPObj *obj _U_, struct vol *volume) |
static void | server_ipc_volumes (AFPObj *obj) |
int | afp_openvol (AFPObj *obj, char *ibuf, size_t ibuflen _U_, 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 _U_, char *rbuf _U_, size_t *rbuflen) |
int | pollvoltime (AFPObj *obj) |
void | setvoltime (AFPObj *obj, struct vol *vol) |
int | afp_getvolparams (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) |
int | afp_setvolparams (AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen) |
int get_tm_used |
( |
struct vol *restrict | vol | ) |
|
|
static |
Calculate used size of a TimeMachine volume
This assumes that the volume is used only for TimeMachine.
1) readdir(path of volume) 2) for every element that matches regex "\(.*\)\.sparsebundle$" : 3) parse "\1.sparsebundle/Info.plist" and read the band-size XML key integer value 4) readdir "\1.sparsebundle/bands/" counting files 5) 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