2 * Copyright (c) 2015 Apple, Inc. All rights reserved.
4 * <rdar://problem/20565191> hfs_scan_range_size return 0 iosize unexpectedly.
7 #include <TargetConditionals.h>
11 #include <sys/ioctl.h>
12 #include <sys/ioccom.h>
13 #include <sys/param.h>
14 #include <sys/mount.h>
19 #include <sys/errno.h>
26 #include "../../core/hfs_fsctl.h"
28 #include "hfs-tests.h"
29 #include "test-utils.h"
31 #include "disk-image.h"
33 TEST(scan_range_size
, .run_as_root
= true)
35 static disk_image_t
*di
;
37 static hfs_fsinfo fsinfo
;
39 static void test_fsinfo_file_extent_size(void)
41 bzero(&fsinfo
, sizeof(fsinfo
));
42 fsinfo
.header
.request_type
= HFS_FSINFO_FILE_EXTENT_SIZE
;
43 fsinfo
.header
.version
= HFS_FSINFO_VERSION
;
44 assert_no_err(fsctl(di
->mount_point
, HFSIOC_GET_FSINFO
, &fsinfo
, 0));
47 static void test_fsinfo_free_extents(void)
49 bzero(&fsinfo
, sizeof(fsinfo
));
50 fsinfo
.header
.version
= HFS_FSINFO_VERSION
;
51 fsinfo
.header
.request_type
= HFS_FSINFO_FREE_EXTENTS
;
52 assert_no_err(fsctl(di
->mount_point
, HFSIOC_GET_FSINFO
, &fsinfo
, 0));
56 int run_scan_range_size(__unused test_ctx_t
*ctx
) {
58 di
= disk_image_get();
60 test_fsinfo_file_extent_size();
61 test_fsinfo_free_extents();
66 #endif // !TARGET_OS_IPHONE