]>
git.saurik.com Git - apple/hfs.git/blob - tests/cases/test-access.c
9 #include "test-utils.h"
10 #include "disk-image.h"
15 uint32_t flags
; /* IN: access requested (i.e. R_OK) */
16 uint32_t num_files
; /* IN: number of files to process */
17 uint32_t map_size
; /* IN: size of the bit map */
18 uint32_t *file_ids
; /* IN: Array of file ids */
19 char *bitmap
; /* OUT: hash-bitmap of interesting directory ids */
20 short *access
; /* OUT: access info for each file (0 for 'has access') */
21 uint32_t num_parents
; /* future use */
22 uint32_t *parents
; /* future use */
25 int run_access(__unused test_ctx_t
*ctx
)
27 disk_image_t
*di
= disk_image_get();
30 asprintf(&path
, "%s/acces_check.data", di
->mount_point
);
33 assert_with_errno((fd
= open(path
, O_RDWR
| O_CREAT
, 0666)) >= 0);
36 assert_no_err(fstat(fd
, &sb
));
38 assert_no_err(unlink(path
));
40 char dir_map
[1 << 16] = { 0 };
41 short access_vector
[1024] = { 0 };
43 struct ext_access_t params
= {
46 .map_size
= sizeof(dir_map
),
47 .file_ids
= (uint32_t[]){ (uint32_t)sb
.st_ino
},
49 .access
= access_vector
,
52 #define HFSIOC_EXT_BULKACCESS _IOW('h', 15, struct ext_access_t)
54 char *base_path
= strdup(path
);
55 base_path
= dirname(base_path
);
56 assert_no_err(fsctl(base_path
, HFSIOC_EXT_BULKACCESS
, ¶ms
, 0));
58 if (access_vector
[0] != ENOENT
)
59 assert_fail("access_vector[0] != ENOENT (== %u)!", access_vector
[0]);
62 assert_no_err (close(fd
));