1*0ab737e1Spooka /* $NetBSD: rump_tmpfs.c,v 1.4 2009/12/17 14:06:38 pooka Exp $ */
2bdf6e0b0Spooka
3bdf6e0b0Spooka /*
4d559e459Spooka * Copyright (c) 2008 Antti Kantee. All Rights Reserved.
5bdf6e0b0Spooka *
6bdf6e0b0Spooka * Redistribution and use in source and binary forms, with or without
7bdf6e0b0Spooka * modification, are permitted provided that the following conditions
8bdf6e0b0Spooka * are met:
9bdf6e0b0Spooka * 1. Redistributions of source code must retain the above copyright
10bdf6e0b0Spooka * notice, this list of conditions and the following disclaimer.
11bdf6e0b0Spooka * 2. Redistributions in binary form must reproduce the above copyright
12bdf6e0b0Spooka * notice, this list of conditions and the following disclaimer in the
13bdf6e0b0Spooka * documentation and/or other materials provided with the distribution.
14bdf6e0b0Spooka *
15bdf6e0b0Spooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16bdf6e0b0Spooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17bdf6e0b0Spooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18bdf6e0b0Spooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19bdf6e0b0Spooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20bdf6e0b0Spooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21bdf6e0b0Spooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22bdf6e0b0Spooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23bdf6e0b0Spooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24bdf6e0b0Spooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25bdf6e0b0Spooka * SUCH DAMAGE.
26bdf6e0b0Spooka */
27bdf6e0b0Spooka
28bdf6e0b0Spooka #include <sys/types.h>
29bdf6e0b0Spooka #include <sys/mount.h>
30bdf6e0b0Spooka
31bdf6e0b0Spooka #include <fs/tmpfs/tmpfs_args.h>
32bdf6e0b0Spooka
33bdf6e0b0Spooka #include <err.h>
34bdf6e0b0Spooka #include <puffs.h>
35bdf6e0b0Spooka #include <stdlib.h>
36bdf6e0b0Spooka #include <unistd.h>
37bdf6e0b0Spooka
38bdf6e0b0Spooka #include <rump/p2k.h>
39bdf6e0b0Spooka
4099fed726Spooka #include "mount_tmpfs.h"
41bdf6e0b0Spooka
42*0ab737e1Spooka /*
43*0ab737e1Spooka * tmpfs has a slight "issue" with file content storage. Since it
44*0ab737e1Spooka * stores data in memory, we will end up using 2x the RAM for
45*0ab737e1Spooka * storage if we cache in puffs vfs. If we don't, we need to take
46*0ab737e1Spooka * the slow path from the kernel to the file server every time the
47*0ab737e1Spooka * file is accessed. It's either suck or suck. However, rump_tmpfs
48*0ab737e1Spooka * will not be used in real life, so this is hardly a release-stopping
49*0ab737e1Spooka * issue of catastrophic proportions. For now we opt for un-double
50*0ab737e1Spooka * storage (PUFFS_KFLAG_NOCACHE_PAGE).
51*0ab737e1Spooka */
52*0ab737e1Spooka
53bdf6e0b0Spooka int
main(int argc,char * argv[])54bdf6e0b0Spooka main(int argc, char *argv[])
55bdf6e0b0Spooka {
56bdf6e0b0Spooka struct tmpfs_args args;
5799fed726Spooka char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
5899fed726Spooka int mntflags;
5999fed726Spooka int rv;
60bdf6e0b0Spooka
61bdf6e0b0Spooka setprogname(argv[0]);
62bdf6e0b0Spooka
6399fed726Spooka mount_tmpfs_parseargs(argc, argv, &args, &mntflags,
6499fed726Spooka canon_dev, canon_dir);
6599fed726Spooka rv = p2k_run_fs(MOUNT_TMPFS, canon_dev, canon_dir, mntflags,
6699fed726Spooka &args, sizeof(args), PUFFS_KFLAG_NOCACHE_PAGE);
67bdf6e0b0Spooka if (rv)
68bdf6e0b0Spooka err(1, "mount");
69bdf6e0b0Spooka
70bdf6e0b0Spooka return 0;
71bdf6e0b0Spooka }
72