1*0a6a1f1dSLionel Sambuc /* $NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $ */
211be35a1SLionel Sambuc
311be35a1SLionel Sambuc /*-
411be35a1SLionel Sambuc * Copyright (c) 2010 The NetBSD Foundation, Inc.
511be35a1SLionel Sambuc * All rights reserved.
611be35a1SLionel Sambuc *
711be35a1SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation
811be35a1SLionel Sambuc * by Nicolas Joly.
911be35a1SLionel Sambuc *
1011be35a1SLionel Sambuc * Redistribution and use in source and binary forms, with or without
1111be35a1SLionel Sambuc * modification, are permitted provided that the following conditions
1211be35a1SLionel Sambuc * are met:
1311be35a1SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
1411be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer.
1511be35a1SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
1611be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
1711be35a1SLionel Sambuc * documentation and/or other materials provided with the distribution.
1811be35a1SLionel Sambuc *
1911be35a1SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2011be35a1SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2111be35a1SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2211be35a1SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2311be35a1SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2411be35a1SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2511be35a1SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2611be35a1SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2711be35a1SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2811be35a1SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2911be35a1SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE.
3011be35a1SLionel Sambuc */
3111be35a1SLionel Sambuc
3211be35a1SLionel Sambuc #ifndef __H_FSMACROS_H_
3311be35a1SLionel Sambuc #define __H_FSMACROS_H_
3411be35a1SLionel Sambuc
3511be35a1SLionel Sambuc #include <sys/mount.h>
3611be35a1SLionel Sambuc
3711be35a1SLionel Sambuc #include <atf-c.h>
3811be35a1SLionel Sambuc #include <puffsdump.h>
3911be35a1SLionel Sambuc #include <string.h>
4011be35a1SLionel Sambuc
4111be35a1SLionel Sambuc #include <rump/rump.h>
4211be35a1SLionel Sambuc
4311be35a1SLionel Sambuc #include "../../h_macros.h"
4411be35a1SLionel Sambuc
4511be35a1SLionel Sambuc #define FSPROTOS(_fs_) \
4611be35a1SLionel Sambuc int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \
4711be35a1SLionel Sambuc off_t, void *); \
4811be35a1SLionel Sambuc int _fs_##_fstest_delfs(const atf_tc_t *, void *); \
4911be35a1SLionel Sambuc int _fs_##_fstest_mount(const atf_tc_t *, void *, const char *, int); \
5011be35a1SLionel Sambuc int _fs_##_fstest_unmount(const atf_tc_t *, const char *, int);
5111be35a1SLionel Sambuc
5211be35a1SLionel Sambuc FSPROTOS(ext2fs);
5311be35a1SLionel Sambuc FSPROTOS(ffs);
5411be35a1SLionel Sambuc FSPROTOS(ffslog);
5511be35a1SLionel Sambuc FSPROTOS(lfs);
5611be35a1SLionel Sambuc FSPROTOS(msdosfs);
5711be35a1SLionel Sambuc FSPROTOS(nfs);
5811be35a1SLionel Sambuc FSPROTOS(nfsro);
5911be35a1SLionel Sambuc FSPROTOS(p2k_ffs);
6011be35a1SLionel Sambuc FSPROTOS(puffs);
6111be35a1SLionel Sambuc FSPROTOS(rumpfs);
6211be35a1SLionel Sambuc FSPROTOS(sysvbfs);
6311be35a1SLionel Sambuc FSPROTOS(tmpfs);
6411be35a1SLionel Sambuc FSPROTOS(udf);
6511be35a1SLionel Sambuc FSPROTOS(v7fs);
6611be35a1SLionel Sambuc FSPROTOS(zfs);
6711be35a1SLionel Sambuc
6811be35a1SLionel Sambuc #ifndef FSTEST_IMGNAME
6911be35a1SLionel Sambuc #define FSTEST_IMGNAME "image.fs"
7011be35a1SLionel Sambuc #endif
7111be35a1SLionel Sambuc #ifndef FSTEST_IMGSIZE
7211be35a1SLionel Sambuc #define FSTEST_IMGSIZE (10000 * 512)
7311be35a1SLionel Sambuc #endif
7411be35a1SLionel Sambuc #ifndef FSTEST_MNTNAME
7511be35a1SLionel Sambuc #define FSTEST_MNTNAME "/mnt"
7611be35a1SLionel Sambuc #endif
7711be35a1SLionel Sambuc
7811be35a1SLionel Sambuc #define FSTEST_CONSTRUCTOR(_tc_, _fs_, _args_) \
7911be35a1SLionel Sambuc do { \
8011be35a1SLionel Sambuc if (_fs_##_fstest_newfs(_tc_, &_args_, \
8111be35a1SLionel Sambuc FSTEST_IMGNAME, FSTEST_IMGSIZE, NULL) != 0) \
8211be35a1SLionel Sambuc atf_tc_fail_errno("newfs failed"); \
8311be35a1SLionel Sambuc if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \
8411be35a1SLionel Sambuc atf_tc_fail_errno("mount failed"); \
8511be35a1SLionel Sambuc } while (/*CONSTCOND*/0);
8611be35a1SLionel Sambuc
8711be35a1SLionel Sambuc #define FSTEST_CONSTRUCTOR_FSPRIV(_tc_, _fs_, _args_, _privargs_) \
8811be35a1SLionel Sambuc do { \
8911be35a1SLionel Sambuc if (_fs_##_fstest_newfs(_tc_, &_args_, \
9011be35a1SLionel Sambuc FSTEST_IMGNAME, FSTEST_IMGSIZE, _privargs_) != 0) \
9111be35a1SLionel Sambuc atf_tc_fail_errno("newfs failed"); \
9211be35a1SLionel Sambuc if (_fs_##_fstest_mount(_tc_, _args_, FSTEST_MNTNAME, 0) != 0) \
9311be35a1SLionel Sambuc atf_tc_fail_errno("mount failed"); \
9411be35a1SLionel Sambuc } while (/*CONSTCOND*/0);
9511be35a1SLionel Sambuc
9611be35a1SLionel Sambuc #define FSTEST_DESTRUCTOR(_tc_, _fs_, _args_) \
9711be35a1SLionel Sambuc do { \
9811be35a1SLionel Sambuc if (_fs_##_fstest_unmount(_tc_, FSTEST_MNTNAME, 0) != 0) { \
9911be35a1SLionel Sambuc rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
10011be35a1SLionel Sambuc atf_tc_fail_errno("unmount failed"); \
10111be35a1SLionel Sambuc } \
10211be35a1SLionel Sambuc if (_fs_##_fstest_delfs(_tc_, _args_) != 0) \
10311be35a1SLionel Sambuc atf_tc_fail_errno("delfs failed"); \
10411be35a1SLionel Sambuc } while (/*CONSTCOND*/0);
10511be35a1SLionel Sambuc
10611be35a1SLionel Sambuc #define ATF_TC_FSADD(fs,type,func,desc) \
10711be35a1SLionel Sambuc ATF_TC(fs##_##func); \
10811be35a1SLionel Sambuc ATF_TC_HEAD(fs##_##func,tc) \
10911be35a1SLionel Sambuc { \
11011be35a1SLionel Sambuc atf_tc_set_md_var(tc, "descr", type " test for " desc); \
11111be35a1SLionel Sambuc atf_tc_set_md_var(tc, "X-fs.type", #fs); \
11211be35a1SLionel Sambuc atf_tc_set_md_var(tc, "X-fs.mntname", type); \
11311be35a1SLionel Sambuc } \
11411be35a1SLionel Sambuc void *fs##func##tmp; \
11511be35a1SLionel Sambuc \
11611be35a1SLionel Sambuc ATF_TC_BODY(fs##_##func,tc) \
11711be35a1SLionel Sambuc { \
11811be35a1SLionel Sambuc if (!atf_check_fstype(tc, #fs)) \
11911be35a1SLionel Sambuc atf_tc_skip("filesystem not selected"); \
12011be35a1SLionel Sambuc FSTEST_CONSTRUCTOR(tc,fs,fs##func##tmp); \
12111be35a1SLionel Sambuc func(tc,FSTEST_MNTNAME); \
12211be35a1SLionel Sambuc if (fs##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) { \
12311be35a1SLionel Sambuc rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
12411be35a1SLionel Sambuc atf_tc_fail_errno("unmount failed"); \
12511be35a1SLionel Sambuc } \
12611be35a1SLionel Sambuc }
12711be35a1SLionel Sambuc
12811be35a1SLionel Sambuc #define ATF_TC_FSADD_RO(_fs_,_type_,_func_,_desc_,_gen_) \
12911be35a1SLionel Sambuc ATF_TC(_fs_##_##_func_); \
13011be35a1SLionel Sambuc ATF_TC_HEAD(_fs_##_##_func_,tc) \
13111be35a1SLionel Sambuc { \
13211be35a1SLionel Sambuc atf_tc_set_md_var(tc, "descr",_type_" test for "_desc_);\
13311be35a1SLionel Sambuc atf_tc_set_md_var(tc, "X-fs.type", #_fs_); \
13411be35a1SLionel Sambuc atf_tc_set_md_var(tc, "X-fs.mntname", _type_); \
13511be35a1SLionel Sambuc } \
13611be35a1SLionel Sambuc void *_fs_##_func_##tmp; \
13711be35a1SLionel Sambuc \
13811be35a1SLionel Sambuc ATF_TC_BODY(_fs_##_##_func_,tc) \
13911be35a1SLionel Sambuc { \
14011be35a1SLionel Sambuc if (!atf_check_fstype(tc, #_fs_)) \
14111be35a1SLionel Sambuc atf_tc_skip("filesystem not selected"); \
14211be35a1SLionel Sambuc FSTEST_CONSTRUCTOR(tc,_fs_,_fs_##_func_##tmp); \
14311be35a1SLionel Sambuc _gen_(tc,FSTEST_MNTNAME); \
14411be35a1SLionel Sambuc if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) \
14511be35a1SLionel Sambuc atf_tc_fail_errno("unmount r/w failed"); \
14611be35a1SLionel Sambuc if (_fs_##_fstest_mount(tc, _fs_##_func_##tmp, \
14711be35a1SLionel Sambuc FSTEST_MNTNAME, MNT_RDONLY) != 0) \
14811be35a1SLionel Sambuc atf_tc_fail_errno("mount ro failed"); \
14911be35a1SLionel Sambuc _func_(tc,FSTEST_MNTNAME); \
15011be35a1SLionel Sambuc if (_fs_##_fstest_unmount(tc, FSTEST_MNTNAME, 0) != 0) {\
15111be35a1SLionel Sambuc rump_pub_vfs_mount_print(FSTEST_MNTNAME, 1); \
15211be35a1SLionel Sambuc atf_tc_fail_errno("unmount failed"); \
15311be35a1SLionel Sambuc } \
15411be35a1SLionel Sambuc }
15511be35a1SLionel Sambuc
15611be35a1SLionel Sambuc #define ATF_TP_FSADD(fs,func) \
15711be35a1SLionel Sambuc ATF_TP_ADD_TC(tp,fs##_##func)
15811be35a1SLionel Sambuc
15911be35a1SLionel Sambuc #define ATF_TC_FSAPPLY_NOZFS(func,desc) \
16011be35a1SLionel Sambuc ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc) \
16111be35a1SLionel Sambuc ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc) \
16211be35a1SLionel Sambuc ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc) \
16311be35a1SLionel Sambuc ATF_TC_FSADD(lfs,MOUNT_LFS,func,desc) \
16411be35a1SLionel Sambuc ATF_TC_FSADD(msdosfs,MOUNT_MSDOS,func,desc) \
16511be35a1SLionel Sambuc ATF_TC_FSADD(nfs,MOUNT_NFS,func,desc) \
16611be35a1SLionel Sambuc ATF_TC_FSADD(puffs,MOUNT_PUFFS,func,desc) \
16711be35a1SLionel Sambuc ATF_TC_FSADD(p2k_ffs,MOUNT_PUFFS,func,desc) \
16811be35a1SLionel Sambuc ATF_TC_FSADD(rumpfs,MOUNT_RUMPFS,func,desc) \
16911be35a1SLionel Sambuc ATF_TC_FSADD(sysvbfs,MOUNT_SYSVBFS,func,desc) \
17011be35a1SLionel Sambuc ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc) \
17111be35a1SLionel Sambuc ATF_TC_FSADD(udf,MOUNT_UDF,func,desc) \
17211be35a1SLionel Sambuc ATF_TC_FSADD(v7fs,MOUNT_V7FS,func,desc)
17311be35a1SLionel Sambuc
17411be35a1SLionel Sambuc #define ATF_TP_FSAPPLY_NOZFS(func) \
17511be35a1SLionel Sambuc ATF_TP_FSADD(ext2fs,func); \
17611be35a1SLionel Sambuc ATF_TP_FSADD(ffs,func); \
17711be35a1SLionel Sambuc ATF_TP_FSADD(ffslog,func); \
17811be35a1SLionel Sambuc ATF_TP_FSADD(lfs,func); \
17911be35a1SLionel Sambuc ATF_TP_FSADD(msdosfs,func); \
18011be35a1SLionel Sambuc ATF_TP_FSADD(nfs,func); \
18111be35a1SLionel Sambuc ATF_TP_FSADD(puffs,func); \
18211be35a1SLionel Sambuc ATF_TP_FSADD(p2k_ffs,func); \
18311be35a1SLionel Sambuc ATF_TP_FSADD(rumpfs,func); \
18411be35a1SLionel Sambuc ATF_TP_FSADD(sysvbfs,func); \
18511be35a1SLionel Sambuc ATF_TP_FSADD(tmpfs,func); \
18611be35a1SLionel Sambuc ATF_TP_FSADD(udf,func); \
18711be35a1SLionel Sambuc ATF_TP_FSADD(v7fs,func);
18811be35a1SLionel Sambuc
18911be35a1SLionel Sambuc /* XXX: this will not scale */
19011be35a1SLionel Sambuc #ifdef WANT_ZFS_TESTS
19111be35a1SLionel Sambuc #define ATF_TC_FSAPPLY(func,desc) \
19211be35a1SLionel Sambuc ATF_TC_FSAPPLY_NOZFS(func,desc) \
19311be35a1SLionel Sambuc ATF_TC_FSADD(zfs,MOUNT_ZFS,func,desc)
19411be35a1SLionel Sambuc #define ATF_TP_FSAPPLY(func) \
19511be35a1SLionel Sambuc ATF_TP_FSAPPLY_NOZFS(func) \
19611be35a1SLionel Sambuc ATF_TP_FSADD(zfs,func);
19711be35a1SLionel Sambuc
19811be35a1SLionel Sambuc #else /* !WANT_ZFS_TESTS */
19911be35a1SLionel Sambuc
20011be35a1SLionel Sambuc #define ATF_TC_FSAPPLY(func,desc) \
20111be35a1SLionel Sambuc ATF_TC_FSAPPLY_NOZFS(func,desc)
20211be35a1SLionel Sambuc #define ATF_TP_FSAPPLY(func) \
20311be35a1SLionel Sambuc ATF_TP_FSAPPLY_NOZFS(func)
20411be35a1SLionel Sambuc
20511be35a1SLionel Sambuc #endif /* WANT_ZFS_TESTS */
20611be35a1SLionel Sambuc
20711be35a1SLionel Sambuc /*
20811be35a1SLionel Sambuc * Same as above, but generate a file system image first and perform
20911be35a1SLionel Sambuc * tests for a r/o mount.
21011be35a1SLionel Sambuc *
21111be35a1SLionel Sambuc * Missing the following file systems:
21211be35a1SLionel Sambuc * + lfs (fstest_lfs routines cannot handle remount. FIXME!)
21311be35a1SLionel Sambuc * + tmpfs (memory backend)
21411be35a1SLionel Sambuc * + rumpfs (memory backend)
21511be35a1SLionel Sambuc * + puffs (memory backend, but could be run in theory)
21611be35a1SLionel Sambuc */
21711be35a1SLionel Sambuc
21811be35a1SLionel Sambuc #define ATF_TC_FSAPPLY_RO(func,desc,gen) \
21911be35a1SLionel Sambuc ATF_TC_FSADD_RO(ext2fs,MOUNT_EXT2FS,func,desc,gen) \
22011be35a1SLionel Sambuc ATF_TC_FSADD_RO(ffs,MOUNT_FFS,func,desc,gen) \
22111be35a1SLionel Sambuc ATF_TC_FSADD_RO(ffslog,MOUNT_FFS,func,desc,gen) \
22211be35a1SLionel Sambuc ATF_TC_FSADD_RO(msdosfs,MOUNT_MSDOS,func,desc,gen) \
22311be35a1SLionel Sambuc ATF_TC_FSADD_RO(nfs,MOUNT_NFS,func,desc,gen) \
22411be35a1SLionel Sambuc ATF_TC_FSADD_RO(nfsro,MOUNT_NFS,func,desc,gen) \
22511be35a1SLionel Sambuc ATF_TC_FSADD_RO(sysvbfs,MOUNT_SYSVBFS,func,desc,gen) \
22611be35a1SLionel Sambuc ATF_TC_FSADD_RO(udf,MOUNT_UDF,func,desc,gen) \
22711be35a1SLionel Sambuc ATF_TC_FSADD_RO(v7fs,MOUNT_V7FS,func,desc,gen)
22811be35a1SLionel Sambuc
22911be35a1SLionel Sambuc #define ATF_TP_FSAPPLY_RO(func) \
23011be35a1SLionel Sambuc ATF_TP_FSADD(ext2fs,func); \
23111be35a1SLionel Sambuc ATF_TP_FSADD(ffs,func); \
23211be35a1SLionel Sambuc ATF_TP_FSADD(ffslog,func); \
23311be35a1SLionel Sambuc ATF_TP_FSADD(msdosfs,func); \
23411be35a1SLionel Sambuc ATF_TP_FSADD(nfs,func); \
23511be35a1SLionel Sambuc ATF_TP_FSADD(nfsro,func); \
23611be35a1SLionel Sambuc ATF_TP_FSADD(sysvbfs,func); \
23711be35a1SLionel Sambuc ATF_TP_FSADD(udf,func); \
23811be35a1SLionel Sambuc ATF_TP_FSADD(v7fs,func);
23911be35a1SLionel Sambuc
24011be35a1SLionel Sambuc #define ATF_FSAPPLY(func,desc) \
24111be35a1SLionel Sambuc ATF_TC_FSAPPLY(func,desc); \
24211be35a1SLionel Sambuc ATF_TP_ADD_TCS(tp) \
24311be35a1SLionel Sambuc { \
24411be35a1SLionel Sambuc ATF_TP_FSAPPLY(func); \
24511be35a1SLionel Sambuc return atf_no_error(); \
24611be35a1SLionel Sambuc }
24711be35a1SLionel Sambuc
24811be35a1SLionel Sambuc static __inline bool
atf_check_fstype(const atf_tc_t * tc,const char * fs)24911be35a1SLionel Sambuc atf_check_fstype(const atf_tc_t *tc, const char *fs)
25011be35a1SLionel Sambuc {
25111be35a1SLionel Sambuc const char *fstype;
25211be35a1SLionel Sambuc
25311be35a1SLionel Sambuc if (!atf_tc_has_config_var(tc, "fstype"))
25411be35a1SLionel Sambuc return true;
25511be35a1SLionel Sambuc
25611be35a1SLionel Sambuc fstype = atf_tc_get_config_var(tc, "fstype");
25711be35a1SLionel Sambuc if (strcmp(fstype, fs) == 0)
25811be35a1SLionel Sambuc return true;
25911be35a1SLionel Sambuc return false;
26011be35a1SLionel Sambuc }
26111be35a1SLionel Sambuc
26211be35a1SLionel Sambuc #define FSTYPE_EXT2FS(tc)\
26311be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ext2fs") == 0)
26411be35a1SLionel Sambuc #define FSTYPE_FFS(tc)\
26511be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffs") == 0)
26611be35a1SLionel Sambuc #define FSTYPE_FFSLOG(tc)\
26711be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "ffslog") == 0)
26811be35a1SLionel Sambuc #define FSTYPE_LFS(tc)\
26911be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "lfs") == 0)
27011be35a1SLionel Sambuc #define FSTYPE_MSDOS(tc)\
27111be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "msdosfs") == 0)
27211be35a1SLionel Sambuc #define FSTYPE_NFS(tc)\
27311be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfs") == 0)
27411be35a1SLionel Sambuc #define FSTYPE_NFSRO(tc)\
27511be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "nfsro") == 0)
27611be35a1SLionel Sambuc #define FSTYPE_P2K_FFS(tc)\
27711be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "p2k_ffs") == 0)
27811be35a1SLionel Sambuc #define FSTYPE_PUFFS(tc)\
27911be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "puffs") == 0)
28011be35a1SLionel Sambuc #define FSTYPE_RUMPFS(tc)\
28111be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "rumpfs") == 0)
28211be35a1SLionel Sambuc #define FSTYPE_SYSVBFS(tc)\
28311be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "sysvbfs") == 0)
28411be35a1SLionel Sambuc #define FSTYPE_TMPFS(tc)\
28511be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "tmpfs") == 0)
28611be35a1SLionel Sambuc #define FSTYPE_UDF(tc)\
28711be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "udf") == 0)
28811be35a1SLionel Sambuc #define FSTYPE_V7FS(tc)\
28911be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "v7fs") == 0)
29011be35a1SLionel Sambuc #define FSTYPE_ZFS(tc)\
29111be35a1SLionel Sambuc (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "zfs") == 0)
29211be35a1SLionel Sambuc
29311be35a1SLionel Sambuc #define FSTEST_ENTER() \
29411be35a1SLionel Sambuc if (rump_sys_chdir(FSTEST_MNTNAME) == -1) \
29511be35a1SLionel Sambuc atf_tc_fail_errno("failed to cd into test mount")
29611be35a1SLionel Sambuc
29711be35a1SLionel Sambuc #define FSTEST_EXIT() \
29811be35a1SLionel Sambuc if (rump_sys_chdir("/") == -1) \
29911be35a1SLionel Sambuc atf_tc_fail_errno("failed to cd out of test mount")
30011be35a1SLionel Sambuc
30111be35a1SLionel Sambuc /*
30211be35a1SLionel Sambuc * file system args structures
30311be35a1SLionel Sambuc */
30411be35a1SLionel Sambuc
30511be35a1SLionel Sambuc struct nfstestargs {
30611be35a1SLionel Sambuc pid_t ta_childpid;
30711be35a1SLionel Sambuc char ta_ethername[MAXPATHLEN];
30811be35a1SLionel Sambuc };
30911be35a1SLionel Sambuc
31011be35a1SLionel Sambuc struct puffstestargs {
31111be35a1SLionel Sambuc uint8_t *pta_pargs;
31211be35a1SLionel Sambuc size_t pta_pargslen;
31311be35a1SLionel Sambuc
31411be35a1SLionel Sambuc int pta_pflags;
31511be35a1SLionel Sambuc pid_t pta_childpid;
31611be35a1SLionel Sambuc
31711be35a1SLionel Sambuc int pta_rumpfd;
31811be35a1SLionel Sambuc int pta_servfd;
31911be35a1SLionel Sambuc
32011be35a1SLionel Sambuc char pta_dev[MAXPATHLEN];
32111be35a1SLionel Sambuc char pta_dir[MAXPATHLEN];
32211be35a1SLionel Sambuc
32311be35a1SLionel Sambuc int pta_mntflags;
32411be35a1SLionel Sambuc
32511be35a1SLionel Sambuc int pta_vfs_toserv_ops[PUFFS_VFS_MAX];
32611be35a1SLionel Sambuc int pta_vn_toserv_ops[PUFFS_VN_MAX];
32711be35a1SLionel Sambuc };
32811be35a1SLionel Sambuc
32911be35a1SLionel Sambuc #endif /* __H_FSMACROS_H_ */
330