1*11be35a1SLionel Sambuc /* $NetBSD: t_snapshot.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 <fs/tmpfs/tmpfs_args.h> 10*11be35a1SLionel Sambuc #include <msdosfs/msdosfsmount.h> 11*11be35a1SLionel Sambuc 12*11be35a1SLionel Sambuc #include <atf-c.h> 13*11be35a1SLionel Sambuc #include <err.h> 14*11be35a1SLionel Sambuc #include <fcntl.h> 15*11be35a1SLionel Sambuc #include <stdio.h> 16*11be35a1SLionel Sambuc #include <stdlib.h> 17*11be35a1SLionel Sambuc #include <string.h> 18*11be35a1SLionel Sambuc #include <unistd.h> 19*11be35a1SLionel Sambuc 20*11be35a1SLionel Sambuc #include "../../h_macros.h" 21*11be35a1SLionel Sambuc 22*11be35a1SLionel Sambuc #define IMGNAME "msdosfs.img" 23*11be35a1SLionel Sambuc #define NEWFS "newfs_msdos -C 5M " IMGNAME 24*11be35a1SLionel Sambuc #define FSCK "fsck_msdos -fn" 25*11be35a1SLionel Sambuc #define BAKNAME "/stor/snap" 26*11be35a1SLionel Sambuc 27*11be35a1SLionel Sambuc static void 28*11be35a1SLionel Sambuc mount_diskfs(const char *fspec, const char *path) 29*11be35a1SLionel Sambuc { 30*11be35a1SLionel Sambuc struct msdosfs_args margs; 31*11be35a1SLionel Sambuc 32*11be35a1SLionel Sambuc memset(&margs, 0, sizeof(margs)); 33*11be35a1SLionel Sambuc margs.fspec = __UNCONST(fspec); 34*11be35a1SLionel Sambuc margs.version = MSDOSFSMNT_VERSION; 35*11be35a1SLionel Sambuc 36*11be35a1SLionel Sambuc if (rump_sys_mount(MOUNT_MSDOS, path, 0, &margs, sizeof(margs)) == -1) 37*11be35a1SLionel Sambuc err(1, "mount msdosfs %s", path); 38*11be35a1SLionel Sambuc } 39*11be35a1SLionel Sambuc 40*11be35a1SLionel Sambuc static void 41*11be35a1SLionel Sambuc begin(void) 42*11be35a1SLionel Sambuc { 43*11be35a1SLionel Sambuc struct tmpfs_args targs; 44*11be35a1SLionel Sambuc 45*11be35a1SLionel Sambuc targs.ta_version = TMPFS_ARGS_VERSION; 46*11be35a1SLionel Sambuc 47*11be35a1SLionel Sambuc if (rump_sys_mkdir("/stor", 0777) == -1) 48*11be35a1SLionel Sambuc atf_tc_fail_errno("mkdir /stor"); 49*11be35a1SLionel Sambuc if (rump_sys_mount(MOUNT_TMPFS, "/stor", 0, &targs,sizeof(targs)) == -1) 50*11be35a1SLionel Sambuc atf_tc_fail_errno("mount storage"); 51*11be35a1SLionel Sambuc } 52*11be35a1SLionel Sambuc 53*11be35a1SLionel Sambuc #include "../common/snapshot.c" 54