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