int path_disk_size_info_get(const char *path, int64_t *measured_size, int64_t *number_of_files) { struct path_disk_size_info *state = NULL; int result = path_disk_size_info_get_r(path, -1, &state); *measured_size = state->last_byte_size_complete; *number_of_files = state->last_file_count_complete; path_disk_size_info_delete_state(state); return result; }
int work_queue_process_measure_disk(struct work_queue_process *p, int max_time_on_measurement) { /* we can't have pointers to struct members, thus we create temp variables here */ struct path_disk_size_info *state = p->disk_measurement_state; int result = path_disk_size_info_get_r(p->sandbox, max_time_on_measurement, &state); /* not a memory leak... Either disk_measurement_state was NULL or the same as state. */ p->disk_measurement_state = state; if(state->last_byte_size_complete >= 0) { p->sandbox_size = (int64_t) ceil(state->last_byte_size_complete/(1.0*MEGA)); } else { p->sandbox_size = -1; } p->sandbox_file_count = state->last_file_count_complete; return result; }