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