xref: /netbsd/tests/fs/msdosfs/t_snapshot.c (revision 6550d01e)
1 /*	$NetBSD: t_snapshot.c,v 1.1 2010/04/13 10:21:47 pooka Exp $	*/
2 
3 #include <sys/types.h>
4 #include <sys/mount.h>
5 
6 #include <rump/rump.h>
7 #include <rump/rump_syscalls.h>
8 
9 #include <fs/tmpfs/tmpfs_args.h>
10 #include <msdosfs/msdosfsmount.h>
11 
12 #include <atf-c.h>
13 #include <err.h>
14 #include <fcntl.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <unistd.h>
19 
20 #include "../../h_macros.h"
21 
22 #define IMGNAME "msdosfs.img"
23 #define NEWFS "newfs_msdos -C 5M " IMGNAME
24 #define BAKNAME "/stor/snap"
25 
26 static void
27 mount_diskfs(const char *fspec, const char *path)
28 {
29 	struct msdosfs_args margs;
30 
31 	memset(&margs, 0, sizeof(margs));
32 	margs.fspec = __UNCONST(fspec);
33 	margs.version = MSDOSFSMNT_VERSION;
34 
35 	if (rump_sys_mount(MOUNT_MSDOS, path, 0, &margs, sizeof(margs)) == -1)
36 		err(1, "mount msdosfs %s", path);
37 }
38 
39 static void
40 begin(void)
41 {
42 	struct tmpfs_args targs;
43 
44 	targs.ta_version = TMPFS_ARGS_VERSION;
45 
46 	if (rump_sys_mkdir("/stor", 0777) == -1)
47 		atf_tc_fail_errno("mkdir /stor");
48 	if (rump_sys_mount(MOUNT_TMPFS, "/stor", 0, &targs,sizeof(targs)) == -1)
49 		atf_tc_fail_errno("mount storage");
50 }
51 
52 #include "../common/snapshot.c"
53