xref: /minix3/tests/fs/ffs/t_snapshot_v2.c (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /*	$NetBSD: t_snapshot_v2.c,v 1.2 2013/02/06 09:05:01 hannken Exp $	*/
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc #include <sys/types.h>
4*11be35a1SLionel Sambuc #include <sys/mount.h>
5*11be35a1SLionel Sambuc 
6*11be35a1SLionel Sambuc #include <rump/rump.h>
7*11be35a1SLionel Sambuc #include <rump/rump_syscalls.h>
8*11be35a1SLionel Sambuc 
9*11be35a1SLionel Sambuc #include <ufs/ufs/ufsmount.h>
10*11be35a1SLionel Sambuc 
11*11be35a1SLionel Sambuc #include <atf-c.h>
12*11be35a1SLionel Sambuc #include <fcntl.h>
13*11be35a1SLionel Sambuc #include <stdio.h>
14*11be35a1SLionel Sambuc #include <stdlib.h>
15*11be35a1SLionel Sambuc #include <string.h>
16*11be35a1SLionel Sambuc #include <unistd.h>
17*11be35a1SLionel Sambuc 
18*11be35a1SLionel Sambuc #include "../../h_macros.h"
19*11be35a1SLionel Sambuc 
20*11be35a1SLionel Sambuc #define IMGNAME "ffs.img"
21*11be35a1SLionel Sambuc #define NEWFS "newfs -F -s 10000 -O 2 " IMGNAME
22*11be35a1SLionel Sambuc #define FSCK "fsck_ffs -fn -F"
23*11be35a1SLionel Sambuc #define BAKNAME "/mnt/le_snapp"
24*11be35a1SLionel Sambuc 
25*11be35a1SLionel Sambuc static void
mount_diskfs(const char * fspec,const char * path)26*11be35a1SLionel Sambuc mount_diskfs(const char *fspec, const char *path)
27*11be35a1SLionel Sambuc {
28*11be35a1SLionel Sambuc 	struct ufs_args uargs;
29*11be35a1SLionel Sambuc 
30*11be35a1SLionel Sambuc 	uargs.fspec = __UNCONST(fspec);
31*11be35a1SLionel Sambuc 
32*11be35a1SLionel Sambuc 	if (rump_sys_mount(MOUNT_FFS, path, 0, &uargs, sizeof(uargs)) == -1)
33*11be35a1SLionel Sambuc 		atf_tc_fail_errno("mount ffs %s", path);
34*11be35a1SLionel Sambuc }
35*11be35a1SLionel Sambuc 
36*11be35a1SLionel Sambuc static void
begin(void)37*11be35a1SLionel Sambuc begin(void)
38*11be35a1SLionel Sambuc {
39*11be35a1SLionel Sambuc 
40*11be35a1SLionel Sambuc 	/* empty */
41*11be35a1SLionel Sambuc }
42*11be35a1SLionel Sambuc 
43*11be35a1SLionel Sambuc #include "../common/snapshot.c"
44