[BACK]Return to t_snapshot.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / fs / msdosfs

File: [cvs.NetBSD.org] / src / tests / fs / msdosfs / t_snapshot.c (download)

Revision 1.1, Tue Apr 13 10:21:47 2010 UTC (12 years, 1 month ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: yamt-pagecache, tls-maxphys

Add msdosfs snapshot test.  This one just slightly different from
the ffs test because msdosfs doesn't support VFS_SNAPSHOT, only
VFS_SUSPEND, i.e. we need external storage for the snapshot instead
of internal storage.

/*	$NetBSD: t_snapshot.c,v 1.1 2010/04/13 10:21:47 pooka Exp $	*/

#include <sys/types.h>
#include <sys/mount.h>

#include <rump/rump.h>
#include <rump/rump_syscalls.h>

#include <fs/tmpfs/tmpfs_args.h>
#include <msdosfs/msdosfsmount.h>

#include <atf-c.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "../../h_macros.h"

#define IMGNAME "msdosfs.img"
#define NEWFS "newfs_msdos -C 5M " IMGNAME
#define BAKNAME "/stor/snap"

static void
mount_diskfs(const char *fspec, const char *path)
	struct msdosfs_args margs;

	memset(&margs, 0, sizeof(margs));
	margs.fspec = __UNCONST(fspec);
	margs.version = MSDOSFSMNT_VERSION;

	if (rump_sys_mount(MOUNT_MSDOS, path, 0, &margs, sizeof(margs)) == -1)
		err(1, "mount msdosfs %s", path);

static void
	struct tmpfs_args targs;

	targs.ta_version = TMPFS_ARGS_VERSION;

	if (rump_sys_mkdir("/stor", 0777) == -1)
		atf_tc_fail_errno("mkdir /stor");
	if (rump_sys_mount(MOUNT_TMPFS, "/stor", 0, &targs,sizeof(targs)) == -1)
		atf_tc_fail_errno("mount storage");

#include "../common/snapshot.c"