rump_nfs.c revision 1.4
11.4Spooka/* $NetBSD: rump_nfs.c,v 1.4 2008/12/12 19:59:00 pooka Exp $ */ 21.1Spooka 31.1Spooka/* 41.1Spooka * Copyright (c) 2008 Antti Kantee. All Rights Reserved. 51.1Spooka * 61.1Spooka * Redistribution and use in source and binary forms, with or without 71.1Spooka * modification, are permitted provided that the following conditions 81.1Spooka * are met: 91.1Spooka * 1. Redistributions of source code must retain the above copyright 101.1Spooka * notice, this list of conditions and the following disclaimer. 111.1Spooka * 2. Redistributions in binary form must reproduce the above copyright 121.1Spooka * notice, this list of conditions and the following disclaimer in the 131.1Spooka * documentation and/or other materials provided with the distribution. 141.1Spooka * 151.1Spooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 161.1Spooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 171.1Spooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 181.1Spooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 191.1Spooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 201.1Spooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 211.1Spooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 221.1Spooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 231.1Spooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 241.1Spooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 251.1Spooka * SUCH DAMAGE. 261.1Spooka */ 271.1Spooka 281.1Spooka#include <sys/types.h> 291.1Spooka#include <sys/mount.h> 301.1Spooka 311.1Spooka#include <nfs/nfsmount.h> 321.1Spooka 331.3Spooka#include <rump/rump.h> 341.1Spooka#include <rump/p2k.h> 351.1Spooka 361.1Spooka#include <err.h> 371.1Spooka#include <puffs.h> 381.1Spooka#include <stdlib.h> 391.1Spooka#include <string.h> 401.1Spooka 411.1Spooka#include "mount_nfs.h" 421.1Spooka 431.1Spookaint 441.1Spookamain(int argc, char *argv[]) 451.1Spooka{ 461.1Spooka struct nfs_args args; 471.1Spooka char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN]; 481.1Spooka int rv, mntflags; 491.4Spooka extern int nfs_niothreads; /* XXX */ 501.4Spooka char *thr; 511.3Spooka 521.4Spooka /* 531.4Spooka * XXX: but we can't call rump init before we detach (fork()) in 541.4Spooka * p2k_run_fs() lest we lose our threads. 551.4Spooka */ 561.4Spooka thr = getenv("RUMP_THREADS"); 571.4Spooka if (!thr || !*thr) 581.3Spooka nfs_niothreads = 0; 591.1Spooka 601.1Spooka setprogname(argv[0]); 611.1Spooka mount_nfs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir); 621.1Spooka 631.1Spooka rv = p2k_run_fs(MOUNT_NFS, canon_dev, canon_dir, mntflags, &args, 641.2Spooka sizeof(args), 0); 651.1Spooka if (rv == -1) 661.1Spooka err(1, "mount"); 671.1Spooka 681.1Spooka return 0; 691.1Spooka} 70