Home | History | Annotate | Line # | Download | only in msdosfs
      1 /*	$NetBSD: t_snapshot.c,v 1.4 2017/01/13 21:30:40 christos 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 FSCK "fsck_msdos -fn"
     25 #define BAKNAME "/stor/snap"
     26 
     27 static void
     28 mount_diskfs(const char *fspec, const char *path)
     29 {
     30 	struct msdosfs_args margs;
     31 
     32 	memset(&margs, 0, sizeof(margs));
     33 	margs.fspec = __UNCONST(fspec);
     34 	margs.version = MSDOSFSMNT_VERSION;
     35 
     36 	if (rump_sys_mount(MOUNT_MSDOS, path, 0, &margs, sizeof(margs)) == -1)
     37 		err(1, "mount msdosfs %s", path);
     38 }
     39 
     40 static void
     41 begin(void)
     42 {
     43 	struct tmpfs_args targs = { .ta_version = TMPFS_ARGS_VERSION, };
     44 
     45 	if (rump_sys_mkdir("/stor", 0777) == -1)
     46 		atf_tc_fail_errno("mkdir /stor");
     47 	if (rump_sys_mount(MOUNT_TMPFS, "/stor", 0, &targs,sizeof(targs)) == -1)
     48 		atf_tc_fail_errno("mount storage");
     49 }
     50 
     51 #include "../common/snapshot.c"
     52