void work_queue_process_delete(struct work_queue_process *p) { if(p->task) work_queue_task_delete(p->task); if(p->output_fd) { close(p->output_fd); } if(p->output_file_name) { unlink(p->output_file_name); free(p->output_file_name); } if(p->sandbox) { if(p->loop_mount == 1) { disk_alloc_delete(p->sandbox); } else { delete_dir(p->sandbox); } free(p->sandbox); } if(p->tmpdir) free(p->tmpdir); free(p); }
int main(int argc, char *argv[]) { char *func = argv[1]; char *loc = argv[2]; int result; if(strstr(func, "create") != NULL) { int64_t size = (string_metric_parse(argv[3]) / 1024); result = disk_alloc_create(loc, size); if(result != 0) { printf("Could not create allocation.\n"); return -1; } printf("Allocation complete.\n"); return 0; } else if(strstr(func, "delete") != NULL) { result = disk_alloc_delete(loc); if(result != 0) { printf("Could not delete allocation.\n"); return -1; } printf("Deallocation complete.\n"); return 0; } else { printf("Invalid parameters defined.\n"); return -1; } }