6 #include <TargetConditionals.h>
8 #import <Foundation/Foundation.h>
10 #include "hfs-tests.h"
11 #include "test-utils.h"
12 #include "disk-image.h"
16 static disk_image_t *di;
18 int run_log2phys(__unused test_ctx_t *ctx)
20 di = disk_image_get();
22 asprintf(&file, "%s/log2phys.data", di->mount_point);
24 int fd = open(file, O_RDWR | O_CREAT, 0666);
26 struct log2phys l2p = {
27 .l2p_contigbytes = OFF_MAX,
30 assert_no_err(ftruncate(fd, 1000));
31 assert_no_err(fcntl(fd, F_LOG2PHYS_EXT, &l2p));
33 l2p.l2p_contigbytes = -1;
34 assert_with_errno(fcntl(fd, F_LOG2PHYS_EXT, &l2p) == -1 && errno == EINVAL);
36 assert_no_err(close(fd));