]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/perf_index/ramdisk.c
8 int setup_ram_volume(const char* name
, char* path
) {
12 retval
= asprintf(&cmd
, "diskutil erasevolume HFS+ '%s' `hdiutil attach -nomount ram://1500000` >/dev/null", name
);
13 VERIFY(retval
> 0, "asprintf failed");
16 VERIFY(retval
== 0, "diskutil command failed");
18 snprintf(path
, MAXPATHLEN
, "/Volumes/%s", name
);
22 return PERFINDEX_SUCCESS
;
25 int cleanup_ram_volume(char* path
) {
29 retval
= asprintf(&cmd
, "umount -f '%s' >/dev/null", path
);
30 VERIFY(retval
> 0, "asprintf failed");
33 VERIFY(retval
== 0, "diskutil command failed");
37 return PERFINDEX_SUCCESS
;