Fri Jan 7 11:58:22 2011 UTC ()
antipasto


(pooka)
diff -r1.28 -r1.29 src/tests/fs/common/h_fsmacros.h

cvs diff -r1.28 -r1.29 src/tests/fs/common/h_fsmacros.h (switch to unified diff)

--- src/tests/fs/common/h_fsmacros.h 2011/01/07 11:52:59 1.28
+++ src/tests/fs/common/h_fsmacros.h 2011/01/07 11:58:21 1.29
@@ -1,308 +1,308 @@ @@ -1,308 +1,308 @@
1/* $NetBSD: h_fsmacros.h,v 1.28 2011/01/07 11:52:59 pooka Exp $ */ 1/* $NetBSD: h_fsmacros.h,v 1.29 2011/01/07 11:58:21 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.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef __H_FSMACROS_H_ 32#ifndef __H_FSMACROS_H_
33#define __H_FSMACROS_H_ 33#define __H_FSMACROS_H_
34 34
35#include <sys/mount.h> 35#include <sys/mount.h>
36 36
37#include <atf-c.h> 37#include <atf-c.h>
38#include <puffsdump.h> 38#include <puffsdump.h>
39#include <string.h> 39#include <string.h>
40 40
41#include <rump/rump.h> 41#include <rump/rump.h>
42 42
43#include "../../h_macros.h" 43#include "../../h_macros.h"
44 44
45#define FSPROTOS(_fs_) \ 45#define FSPROTOS(_fs_) \
46int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \ 46int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \
47 off_t, void *); \ 47 off_t, void *); \
48int _fs_##_fstest_delfs(const atf_tc_t *, void *); \ 48int _fs_##_fstest_delfs(const atf_tc_t *, void *); \
49int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int); \ 49int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int); \
50int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int); 50int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int);
51 51
52FSPROTOS(ext2fs); 52FSPROTOS(ext2fs);
53FSPROTOS(ffs); 53FSPROTOS(ffs);
54FSPROTOS(ffslog); 54FSPROTOS(ffslog);
55FSPROTOS(lfs); 55FSPROTOS(lfs);
56FSPROTOS(msdosfs); 56FSPROTOS(msdosfs);
57FSPROTOS(nfs); 57FSPROTOS(nfs);
58FSPROTOS(nfsro); 58FSPROTOS(nfsro);
59FSPROTOS(p2k_ffs); 59FSPROTOS(p2k_ffs);
60FSPROTOS(puffs); 60FSPROTOS(puffs);
61FSPROTOS(rumpfs); 61FSPROTOS(rumpfs);
62FSPROTOS(sysvbfs); 62FSPROTOS(sysvbfs);
63FSPROTOS(tmpfs); 63FSPROTOS(tmpfs);
64 64
65#ifndef FSTEST_IMGNAME 65#ifndef FSTEST_IMGNAME
66#define FSTEST_IMGNAME "image.fs" 66#define FSTEST_IMGNAME "image.fs"
67#endif 67#endif
68#ifndef FSTEST_IMGSIZE 68#ifndef FSTEST_IMGSIZE
69#define FSTEST_IMGSIZE (10000 * 512) 69#define FSTEST_IMGSIZE (10000 * 512)
70#endif 70#endif
71#ifndef FSTEST_MNTNAME 71#ifndef FSTEST_MNTNAME
72#define FSTEST_MNTNAME "/mnt" 72#define FSTEST_MNTNAME "/mnt"
73#endif 73#endif
74 74
75#define FSTEST_CONSTRUCTOR(_tc_, _fs_, _args_) \ 75#define FSTEST_CONSTRUCTOR(_tc_, _fs_, _args_) \
76do { \ 76do { \
77 if (_fs_##_fstest_newfs(_tc_, &_args_, \ 77 if (_fs_##_fstest_newfs(_tc_, &_args_, \
78 FSTEST_IMGNAME, FSTEST_IMGSIZE, NULL) != 0) \ 78 FSTEST_IMGNAME, FSTEST_IMGSIZE, NULL) != 0) \
79 atf_tc_fail_errno("newfs failed"); \ 79 atf_tc_fail_errno("newfs failed"); \
80 if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \ 80 if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \
81 atf_tc_fail_errno("mount failed"); \ 81 atf_tc_fail_errno("mount failed"); \
82} while (/*CONSTCOND*/0); 82} while (/*CONSTCOND*/0);
83 83
84#define FSTEST_CONSTRUCTOR_FSPRIV(_tc_, _fs_, _args_, _privargs_) \ 84#define FSTEST_CONSTRUCTOR_FSPRIV(_tc_, _fs_, _args_, _privargs_) \
85do { \ 85do { \
86 if (_fs_##_fstest_newfs(_tc_, &_args_, \ 86 if (_fs_##_fstest_newfs(_tc_, &_args_, \
87 FSTEST_IMGNAME, FSTEST_IMGSIZE, _privargs_) != 0) \ 87 FSTEST_IMGNAME, FSTEST_IMGSIZE, _privargs_) != 0) \
88 atf_tc_fail_errno("newfs failed"); \ 88 atf_tc_fail_errno("newfs failed"); \
89 if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \ 89 if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \
90 atf_tc_fail_errno("mount failed"); \ 90 atf_tc_fail_errno("mount failed"); \
91} while (/*CONSTCOND*/0); 91} while (/*CONSTCOND*/0);
92 92
93#define FSTEST_DESTRUCTOR(_tc_, _fs_, _args_) \ 93#define FSTEST_DESTRUCTOR(_tc_, _fs_, _args_) \
94do { \ 94do { \
95 if (_fs_##_fstest_unmount(_tc_, FSTEST_MNTNAME, 0) != 0) { \ 95 if (_fs_##_fstest_unmount(_tc_, FSTEST_MNTNAME, 0) != 0) { \
96 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \ 96 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
97 atf_tc_fail_errno("unmount failed"); \ 97 atf_tc_fail_errno("unmount failed"); \
98 } \ 98 } \
99 if (_fs_##_fstest_delfs(_tc_, _args_) != 0) \ 99 if (_fs_##_fstest_delfs(_tc_, _args_) != 0) \
100 atf_tc_fail_errno("delfs failed"); \ 100 atf_tc_fail_errno("delfs failed"); \
101} while (/*CONSTCOND*/0); 101} while (/*CONSTCOND*/0);
102 102
103#define ATF_TC_FSADD(fs,type,func,desc) \ 103#define ATF_TC_FSADD(fs,type,func,desc) \
104 ATF_TC_WITH_CLEANUP(fs##_##func); \ 104 ATF_TC_WITH_CLEANUP(fs##_##func); \
105 ATF_TC_HEAD(fs##_##func,tc) \ 105 ATF_TC_HEAD(fs##_##func,tc) \
106 { \ 106 { \
107 atf_tc_set_md_var(tc, "descr", type " test for " desc); \ 107 atf_tc_set_md_var(tc, "descr", type " test for " desc); \
108 atf_tc_set_md_var(tc, "X-fs.type", #fs); \ 108 atf_tc_set_md_var(tc, "X-fs.type", #fs); \
109 } \ 109 } \
110 void *fs##func##tmp; \ 110 void *fs##func##tmp; \
111 \ 111 \
112 ATF_TC_BODY(fs##_##func,tc) \ 112 ATF_TC_BODY(fs##_##func,tc) \
113 { \ 113 { \
114 if (!atf_check_fstype(tc, type)) \ 114 if (!atf_check_fstype(tc, type)) \
115 atf_tc_skip("filesystem not selected"); \ 115 atf_tc_skip("filesystem not selected"); \
116 FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp); \ 116 FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp); \
117 func(tc,FSTEST_MNTNAME); \ 117 func(tc,FSTEST_MNTNAME); \
118 if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) { \ 118 if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) { \
119 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \ 119 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
120 atf_tc_fail_errno("unmount failed"); \ 120 atf_tc_fail_errno("unmount failed"); \
121 } \ 121 } \
122 } \ 122 } \
123 \ 123 \
124 ATF_TC_CLEANUP(fs##_##func,tc) \ 124 ATF_TC_CLEANUP(fs##_##func,tc) \
125 { \ 125 { \
126 if (!atf_check_fstype(tc, type)) \ 126 if (!atf_check_fstype(tc, type)) \
127 return; \ 127 return; \
128 if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \ 128 if (fs##_fstest_delfs(tc, fs##func##tmp) != 0) \
129 atf_tc_fail_errno("delfs failed"); \ 129 atf_tc_fail_errno("delfs failed"); \
130 } 130 }
131 131
132#define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_) \ 132#define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_) \
133 ATF_TC_WITH_CLEANUP(_fs_##_##_func_); \ 133 ATF_TC_WITH_CLEANUP(_fs_##_##_func_); \
134 ATF_TC_HEAD(_fs_##_##_func_,tc) \ 134 ATF_TC_HEAD(_fs_##_##_func_,tc) \
135 { \ 135 { \
136 atf_tc_set_md_var(tc, "descr",_type_" test for "_desc_);\ 136 atf_tc_set_md_var(tc, "descr",_type_" test for "_desc_);\
137 atf_tc_set_md_var(tc, "X-fs.type", #_fs_); \ 137 atf_tc_set_md_var(tc, "X-fs.type", #_fs_); \
138 } \ 138 } \
139 void *_fs_##_func_##tmp; \ 139 void *_fs_##_func_##tmp; \
140 \ 140 \
141 ATF_TC_BODY(_fs_##_##_func_,tc) \ 141 ATF_TC_BODY(_fs_##_##_func_,tc) \
142 { \ 142 { \
143 if (!atf_check_fstype(tc, _type_)) \ 143 if (!atf_check_fstype(tc, _type_)) \
144 atf_tc_skip("filesystem not selected"); \ 144 atf_tc_skip("filesystem not selected"); \
145 FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp); \ 145 FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp); \
146 _gen_(tc,FSTEST_MNTNAME); \ 146 _gen_(tc,FSTEST_MNTNAME); \
147 if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \ 147 if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \
148 atf_tc_fail_errno("unmount r/w failed"); \ 148 atf_tc_fail_errno("unmount r/w failed"); \
149 if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp, \ 149 if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp, \
150 FSTEST_MNTNAME, MNT_RDONLY) != 0) \ 150 FSTEST_MNTNAME, MNT_RDONLY) != 0) \
151 atf_tc_fail_errno("mount ro failed"); \ 151 atf_tc_fail_errno("mount ro failed"); \
152 _func_(tc,FSTEST_MNTNAME); \ 152 _func_(tc,FSTEST_MNTNAME); \
153 if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {\ 153 if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {\
154 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \ 154 rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
155 atf_tc_fail_errno("unmount failed"); \ 155 atf_tc_fail_errno("unmount failed"); \
156 } \ 156 } \
157 } \ 157 } \
158 \ 158 \
159 ATF_TC_CLEANUP(_fs_##_##_func_,tc) \ 159 ATF_TC_CLEANUP(_fs_##_##_func_,tc) \
160 { \ 160 { \
161 if (!atf_check_fstype(tc, _type_)) \ 161 if (!atf_check_fstype(tc, _type_)) \
162 return; \ 162 return; \
163 if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0) \ 163 if (_fs_##_fstest_delfs(tc, _fs_##_func_##tmp) != 0) \
164 atf_tc_fail_errno("delfs failed"); \ 164 atf_tc_fail_errno("delfs failed"); \
165 } 165 }
166 166
167#define ATF_TP_FSADD(fs,func) \ 167#define ATF_TP_FSADD(fs,func) \
168 ATF_TP_ADD_TC(tp,fs##_##func) 168 ATF_TP_ADD_TC(tp,fs##_##func)
169 169
170#define ATF_TC_FSAPPLY(func,desc) \ 170#define ATF_TC_FSAPPLY(func,desc) \
171 ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \ 171 ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \
172 ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \ 172 ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
173 ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc) \ 173 ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc) \
174 ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \ 174 ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
175 ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \ 175 ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
176 ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \ 176 ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
177 ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \ 177 ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \
178 ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \ 178 ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
179 ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \ 179 ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
180 ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \ 180 ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
181 ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc) 181 ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)
182 182
183#define ATF_TP_FSAPPLY(func) \ 183#define ATF_TP_FSAPPLY(func) \
184 ATF_TP_FSADD(ext2fs,func); \ 184 ATF_TP_FSADD(ext2fs,func); \
185 ATF_TP_FSADD(ffs,func); \ 185 ATF_TP_FSADD(ffs,func); \
186 ATF_TP_FSADD(ffslog,func); \ 186 ATF_TP_FSADD(ffslog,func); \
187 ATF_TP_FSADD(lfs,func); \ 187 ATF_TP_FSADD(lfs,func); \
188 ATF_TP_FSADD(msdosfs,func); \ 188 ATF_TP_FSADD(msdosfs,func); \
189 ATF_TP_FSADD(nfs,func); \ 189 ATF_TP_FSADD(nfs,func); \
190 ATF_TP_FSADD(p2k_ffs,func); \ 190 ATF_TP_FSADD(p2k_ffs,func); \
191 ATF_TP_FSADD(puffs,func); \ 191 ATF_TP_FSADD(puffs,func); \
192 ATF_TP_FSADD(rumpfs,func); \ 192 ATF_TP_FSADD(rumpfs,func); \
193 ATF_TP_FSADD(sysvbfs,func); \ 193 ATF_TP_FSADD(sysvbfs,func); \
194 ATF_TP_FSADD(tmpfs,func); 194 ATF_TP_FSADD(tmpfs,func);
195 195
196/* 196/*
197 * Same as above, but generate a file system image first and perform 197 * Same as above, but generate a file system image first and perform
198 * tests for a r/o mount. 198 * tests for a r/o mount.
199 * 199 *
200 * Missing the following file systems: 200 * Missing the following file systems:
201 * + lfs (fstest_lfs routines cannot handle remount. FIXME!) 201 * + lfs (fstest_lfs routines cannot handle remount. FIXME!)
202 * + tmpfs (memory backend) 202 * + tmpfs (memory backend)
203 * + rumpfs (memory backend) 203 * + rumpfs (memory backend)
204 * + puffs (memory backend, but could be run in theory) 204 * + puffs (memory backend, but could be run in theory)
205 */ 205 */
206 206
207#define ATF_TC_FSAPPLY_RO(func,desc,gen) \ 207#define ATF_TC_FSAPPLY_RO(func,desc,gen) \
208 ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen) \ 208 ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen) \
209 ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen) \ 209 ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen) \
210 ATF_TC_FSADD_RO(ffslog,MOUNT_FFS,func,desc,gen) \ 210 ATF_TC_FSADD_RO(ffslog,MOUNT_FFS,func,desc,gen) \
211 ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen) \ 211 ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen) \
212 ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen) \ 212 ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen) \
213 ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen) \ 213 ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen) \
214 ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen) 214 ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen)
215 215
216#define ATF_TP_FSAPPLY_RO(func) \ 216#define ATF_TP_FSAPPLY_RO(func) \
217 ATF_TP_FSADD(ext2fs,func); \ 217 ATF_TP_FSADD(ext2fs,func); \
218 ATF_TP_FSADD(ffs,func); \ 218 ATF_TP_FSADD(ffs,func); \
219 ATF_TP_FSADD(ffslog,func); \ 219 ATF_TP_FSADD(ffslog,func); \
220 ATF_TP_FSADD(msdosfs,func); \ 220 ATF_TP_FSADD(msdosfs,func); \
221 ATF_TP_FSADD(nfs,func); \ 221 ATF_TP_FSADD(nfs,func); \
222 ATF_TP_FSADD(nfsro,func); \ 222 ATF_TP_FSADD(nfsro,func); \
223 ATF_TP_FSADD(sysvbfs,func); 223 ATF_TP_FSADD(sysvbfs,func);
224 224
225#define ATF_FSAPPLY(func,desc) \ 225#define ATF_FSAPPLY(func,desc) \
226 ATF_TC_FSAPPLY(func,desc); \ 226 ATF_TC_FSAPPLY(func,desc); \
227 ATF_TP_ADD_TCS(tp) \ 227 ATF_TP_ADD_TCS(tp) \
228 { \ 228 { \
229 ATF_TP_FSAPPLY(func); \ 229 ATF_TP_FSAPPLY(func); \
230 return atf_no_error(); \ 230 return atf_no_error(); \
231 } 231 }
232 232
233static __inline bool 233static __inline bool
234atf_check_fstype(const atf_tc_t *tc, const char *fs) 234atf_check_fstype(const atf_tc_t *tc, const char *fs)
235{ 235{
236 const char *fstype; 236 const char *fstype;
237 237
238 if (!atf_tc_has_config_var(tc, "fstype")) 238 if (!atf_tc_has_config_var(tc, "fstype"))
239 return true; 239 return true;
240 240
241 fstype = atf_tc_get_config_var(tc, "fstype"); 241 fstype = atf_tc_get_config_var(tc, "fstype");
242 if (strcmp(fstype, fs) == 0) 242 if (strcmp(fstype, fs) == 0)
243 return true; 243 return true;
244 return false; 244 return false;
245} 245}
246 246
247#define FSTYPE_EXT2FS(tc)\ 247#define FSTYPE_EXT2FS(tc)\
248 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0) 248 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0)
249#define FSTYPE_FFS(tc)\ 249#define FSTYPE_FFS(tc)\
250 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0) 250 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0)
251#define FSTYPE_FFSLOG(tc)\ 251#define FSTYPE_FFSLOG(tc)\
252 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0) 252 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffslog") == 0)
253#define FSTYPE_LFS(tc)\ 253#define FSTYPE_LFS(tc)\
254 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0) 254 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0)
255#define FSTYPE_MSDOS(tc)\ 255#define FSTYPE_MSDOS(tc)\
256 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0) 256 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0)
257#define FSTYPE_NFS(tc)\ 257#define FSTYPE_NFS(tc)\
258 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0) 258 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0)
259#define FSTYPE_NFSRO(tc)\ 259#define FSTYPE_NFSRO(tc)\
260 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0) 260 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0)
261#define FSTYPE_P2K_FFS(tc)\ 261#define FSTYPE_P2K_FFS(tc)\
262 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0) 262 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0)
263#define FSTYPE_PUFFS(tc)\ 263#define FSTYPE_PUFFS(tc)\
264 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0) 264 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0)
265#define FSTYPE_RUMPFS(tc)\ 265#define FSTYPE_RUMPFS(tc)\
266 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "rumpfs") == 0) 266 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "rumpfs") == 0)
267#define FSTYPE_SYSVBFS(tc)\ 267#define FSTYPE_SYSVBFS(tc)\
268 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "sysvbfs") == 0) 268 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "sysvbfs") == 0)
269#define FSTYPE_TMPFS(tc)\ 269#define FSTYPE_TMPFS(tc)\
270 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "tmpfs") == 0) 270 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "tmpfs") == 0)
271 271
272#define FSTEST_ENTER() \ 272#define FSTEST_ENTER() \
273 if (rump_sys_chdir(FSTEST_MNTNAME) == -1) \ 273 if (rump_sys_chdir(FSTEST_MNTNAME) == -1) \
274 atf_tc_fail_errno("failed to cd into test mount") 274 atf_tc_fail_errno("failed to cd into test mount")
275 275
276#define FSTEST_EXIT() \ 276#define FSTEST_EXIT() \
277 if (rump_sys_chdir("/") == -1) \ 277 if (rump_sys_chdir("/") == -1) \
278 atf_tc_fail_errno("failed to cd out of test mount") 278 atf_tc_fail_errno("failed to cd out of test mount")
279 279
280/* 280/*
281 * file system args structures 281 * file system args structures
282 */ 282 */
283 283
284struct nfstestargs { 284struct nfstestargs {
285 pid_t ta_childpid; 285 pid_t ta_childpid;
286 char ta_ethername[MAXPATHLEN]; 286 char ta_ethername[MAXPATHLEN];
287}; 287};
288 288
289struct puffstestargs { 289struct puffstestargs {
290 uint8_t *pta_pargs; 290 uint8_t *pta_pargs;
291 size_t pta_pargslen; 291 size_t pta_pargslen;
292 292
293 int pta_pflags; 293 int pta_pflags;
294 pid_t pta_childpid; 294 pid_t pta_childpid;
295 295
296 int pta_rumpfd; 296 int pta_rumpfd;
297 int pta_servfd; 297 int pta_servfd;
298 298
299 char pta_dev[MAXPATHLEN]; 299 char pta_dev[MAXPATHLEN];
300 char pta_dir[MAXPATHLEN]; 300 char pta_dir[MAXPATHLEN];
301 301
302 int pta_mntflags; 302 int pta_mntflags;
303 303
304 int pta_vfs_toserv_ops[PUFFS_VFS_MAX]; 304 int pta_vfs_toserv_ops[PUFFS_VFS_MAX];
305 int pta_vn_toserv_ops[PUFFS_VN_MAX]; 305 int pta_vn_toserv_ops[PUFFS_VN_MAX];
306}; 306};
307 307
308#endif /* __H_FSMACROS_H_ */ 308#endif /* __H_FSMACROS_H_ */