| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: h_fsmacros.h,v 1.25 2011/01/07 10:45:45 pooka Exp $ */ | | 1 | /* $NetBSD: h_fsmacros.h,v 1.26 2011/01/07 11:36:27 pooka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Nicolas Joly. | | 8 | * by Nicolas Joly. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -123,27 +123,27 @@ do { \ | | | @@ -123,27 +123,27 @@ do { \ |
123 | ATF_TC_CLEANUP(fs##_##func,tc) \ | | 123 | ATF_TC_CLEANUP(fs##_##func,tc) \ |
124 | { \ | | 124 | { \ |
125 | if (!atf_check_fstype(tc, type)) \ | | 125 | if (!atf_check_fstype(tc, type)) \ |
126 | return; \ | | 126 | return; \ |
127 | if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \ | | 127 | if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \ |
128 | atf_tc_fail_errno("delfs failed"); \ | | 128 | atf_tc_fail_errno("delfs failed"); \ |
129 | } | | 129 | } |
130 | | | 130 | |
131 | #define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_) \ | | 131 | #define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_) \ |
132 | ATF_TC_WITH_CLEANUP(_fs_##_##_func_); \ | | 132 | ATF_TC_WITH_CLEANUP(_fs_##_##_func_); \ |
133 | ATF_TC_HEAD(_fs_##_##_func_,tc) \ | | 133 | ATF_TC_HEAD(_fs_##_##_func_,tc) \ |
134 | { \ | | 134 | { \ |
135 | atf_tc_set_md_var(tc, "descr",_type_" test for "_desc_);\ | | 135 | atf_tc_set_md_var(tc, "descr",_type_" test for "_desc_);\ |
136 | atf_tc_set_md_var(tc, "X-fs.type", _type_); \ | | 136 | atf_tc_set_md_var(tc, "X-fs.type", #_fs_); \ |
137 | } \ | | 137 | } \ |
138 | void *_fs_##_func_##tmp; \ | | 138 | void *_fs_##_func_##tmp; \ |
139 | \ | | 139 | \ |
140 | ATF_TC_BODY(_fs_##_##_func_,tc) \ | | 140 | ATF_TC_BODY(_fs_##_##_func_,tc) \ |
141 | { \ | | 141 | { \ |
142 | if (!atf_check_fstype(tc, _type_)) \ | | 142 | if (!atf_check_fstype(tc, _type_)) \ |
143 | atf_tc_skip("filesystem not selected"); \ | | 143 | atf_tc_skip("filesystem not selected"); \ |
144 | FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp); \ | | 144 | FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp); \ |
145 | _gen_(tc,FSTEST_MNTNAME); \ | | 145 | _gen_(tc,FSTEST_MNTNAME); \ |
146 | if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \ | | 146 | if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \ |
147 | atf_tc_fail_errno("unmount r/w failed"); \ | | 147 | atf_tc_fail_errno("unmount r/w failed"); \ |
148 | if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp, \ | | 148 | if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp, \ |
149 | FSTEST_MNTNAME, MNT_RDONLY) != 0) \ | | 149 | FSTEST_MNTNAME, MNT_RDONLY) != 0) \ |
| @@ -230,43 +230,47 @@ atf_check_fstype(const atf_tc_t *tc, con | | | @@ -230,43 +230,47 @@ atf_check_fstype(const atf_tc_t *tc, con |
230 | { | | 230 | { |
231 | const char *fstype; | | 231 | const char *fstype; |
232 | | | 232 | |
233 | if (!atf_tc_has_config_var(tc, "fstype")) | | 233 | if (!atf_tc_has_config_var(tc, "fstype")) |
234 | return true; | | 234 | return true; |
235 | | | 235 | |
236 | fstype = atf_tc_get_config_var(tc, "fstype"); | | 236 | fstype = atf_tc_get_config_var(tc, "fstype"); |
237 | if (strcmp(fstype, fs) == 0) | | 237 | if (strcmp(fstype, fs) == 0) |
238 | return true; | | 238 | return true; |
239 | return false; | | 239 | return false; |
240 | } | | 240 | } |
241 | | | 241 | |
242 | #define FSTYPE_EXT2FS(tc)\ | | 242 | #define FSTYPE_EXT2FS(tc)\ |
243 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_EXT2FS) == 0) | | 243 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0) |
244 | #define FSTYPE_FFS(tc)\ | | 244 | #define FSTYPE_FFS(tc)\ |
245 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_FFS) == 0) | | 245 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0) |
246 | #define FSTYPE_LFS(tc)\ | | 246 | #define FSTYPE_LFS(tc)\ |
247 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_LFS) == 0) | | 247 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0) |
248 | #define FSTYPE_MSDOS(tc)\ | | 248 | #define FSTYPE_MSDOS(tc)\ |
249 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_MSDOS) == 0) | | 249 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0) |
250 | #define FSTYPE_NFS(tc)\ | | 250 | #define FSTYPE_NFS(tc)\ |
251 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_NFS) == 0) | | 251 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0) |
| | | 252 | #define FSTYPE_NFSRO(tc)\ |
| | | 253 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0) |
| | | 254 | #define FSTYPE_P2K_FFS(tc)\ |
| | | 255 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0) |
252 | #define FSTYPE_PUFFS(tc)\ | | 256 | #define FSTYPE_PUFFS(tc)\ |
253 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_PUFFS) == 0) | | 257 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0) |
254 | #define FSTYPE_RUMPFS(tc)\ | | 258 | #define FSTYPE_RUMPFS(tc)\ |
255 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_RUMPFS) == 0) | | 259 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "rumpfs") == 0) |
256 | #define FSTYPE_SYSVBFS(tc)\ | | 260 | #define FSTYPE_SYSVBFS(tc)\ |
257 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_SYSVBFS) == 0) | | 261 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "sysvbfs") == 0) |
258 | #define FSTYPE_TMPFS(tc)\ | | 262 | #define FSTYPE_TMPFS(tc)\ |
259 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), MOUNT_TMPFS) == 0) | | 263 | (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "tmpfs") == 0) |
260 | | | 264 | |
261 | #define FSTEST_ENTER() \ | | 265 | #define FSTEST_ENTER() \ |
262 | if (rump_sys_chdir(FSTEST_MNTNAME) == -1) \ | | 266 | if (rump_sys_chdir(FSTEST_MNTNAME) == -1) \ |
263 | atf_tc_fail_errno("failed to cd into test mount") | | 267 | atf_tc_fail_errno("failed to cd into test mount") |
264 | | | 268 | |
265 | #define FSTEST_EXIT() \ | | 269 | #define FSTEST_EXIT() \ |
266 | if (rump_sys_chdir("/") == -1) \ | | 270 | if (rump_sys_chdir("/") == -1) \ |
267 | atf_tc_fail_errno("failed to cd out of test mount") | | 271 | atf_tc_fail_errno("failed to cd out of test mount") |
268 | | | 272 | |
269 | /* | | 273 | /* |
270 | * file system args structures | | 274 | * file system args structures |
271 | */ | | 275 | */ |
272 | | | 276 | |