]>
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(). | |
19 | */ | |
20 | ||
21 | __BEGIN_DECLS | |
22 | ||
23 | #define GB * (1024 * 1024 * 1024ULL) | |
24 | #define TB * (1024 * 1024 * 1024 * 1024ULL) | |
25 | ||
26 | #define SHARED_PATH "/tmp/shared.sparseimage" | |
27 | #define SHARED_MOUNT "/tmp/mnt/shared" | |
28 | ||
29 | typedef struct disk_image { | |
30 | const char *mount_point; | |
31 | const char *disk; | |
32 | const char *path; | |
33 | } disk_image_t; | |
34 | ||
35 | typedef struct disk_image_opts { | |
36 | const char *partition_type; | |
37 | bool enable_owners; | |
38 | const char *mount_point; | |
39 | unsigned long long size; // in bytes | |
40 | } disk_image_opts_t; | |
41 | ||
42 | disk_image_t *disk_image_create(const char *path, disk_image_opts_t *opts); | |
43 | disk_image_t *disk_image_get(void); | |
44 | bool disk_image_cleanup(disk_image_t *di); | |
45 | ||
46 | __END_DECLS | |
47 | ||
48 | #endif /* disk_image_h_ */ |