]>
Commit | Line | Data |
---|---|---|
558d2836 A |
1 | // |
2 | // disk-image.h | |
3 | // hfs | |
4 | // | |
5 | // Created by Chris Suter on 8/12/15. | |
6 | // | |
7 | // | |
8 | ||
9 | #ifndef disk_image_h_ | |
10 | #define disk_image_h_ | |
11 | ||
12 | #include <stdbool.h> | |
13 | #include <TargetConditionals.h> | |
14 | ||
15 | /* | |
16 | * One 'shared' disk image is created for any test to use, if it wants. | |
17 | * To use this disk image, call disk_image_get(). To create a 'not-shared' | |
18 | * disk image for use just within your test, call disk_image_create(). | |
ec99dd30 A |
19 | * |
20 | * Callers of disk_image_create() and disk_image_get() should not free the pointer they receive, | |
21 | * as it is freed automatically. | |
558d2836 A |
22 | */ |
23 | ||
24 | __BEGIN_DECLS | |
25 | ||
26 | #define GB * (1024 * 1024 * 1024ULL) | |
27 | #define TB * (1024 * 1024 * 1024 * 1024ULL) | |
28 | ||
29 | #define SHARED_PATH "/tmp/shared.sparseimage" | |
30 | #define SHARED_MOUNT "/tmp/mnt/shared" | |
31 | ||
32 | typedef struct disk_image { | |
33 | const char *mount_point; | |
34 | const char *disk; | |
35 | const char *path; | |
36 | } disk_image_t; | |
37 | ||
38 | typedef struct disk_image_opts { | |
39 | const char *partition_type; | |
40 | bool enable_owners; | |
41 | const char *mount_point; | |
42 | unsigned long long size; // in bytes | |
43 | } disk_image_opts_t; | |
44 | ||
45 | disk_image_t *disk_image_create(const char *path, disk_image_opts_t *opts); | |
46 | disk_image_t *disk_image_get(void); | |
47 | bool disk_image_cleanup(disk_image_t *di); | |
48 | ||
49 | __END_DECLS | |
50 | ||
51 | #endif /* disk_image_h_ */ |