/* $Id$ */
/** @file
* VirtualBox File System Mount Helper, Solaris host.
* Userspace mount wrapper that parses mount (or user-specified) options
* and passes it to mount(2) syscall
*/
/*
* Copyright (C) 2009-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "vboxfs.h"
/*******************************************************************************
* Global Variables *
*******************************************************************************/
static const int g_RetOK = 0;
{
"Mount the VirtualBox shared folder NAME from the host system to MOUNTPOINT.\n"
"\n"
" -w mount the shared folder writable (the default)\n"
" -r mount the shared folder read-only\n"
" -o OPTION[,OPTION...] use the mount options specified\n"
"\n", pszName);
"\n"
" rw mount writable (the default)\n"
" ro mount read only\n"
" uid=UID set the default file owner user id to UID\n"
" gid=GID set the default file owner group id to GID\n");
" dmode=MODE override the mode for all directories (octal) to MODE\n"
" fmode=MODE override the mode for all regular files (octal) to MODE\n"
" umask=UMASK set the umask (bitmask of permissions not present) in (octal) UMASK\n"
" dmask=UMASK set the umask applied to directories only in (octal) UMASK\n"
" fmask=UMASK set the umask applied to regular files only in (octal) UMASK\n"
" stat_ttl=TTL set the \"time to live\" (in ms) for the stat caches (default %d)\n", DEF_STAT_TTL_MS);
" fsync honor fsync calls instead of ignoring them\n"
" ttl=TTL set the \"time to live\" to TID for the dentry\n"
" iocharset CHARSET use the character set CHARSET for i/o operations (default utf8)\n"
" convertcp CHARSET convert the shared folder name from the character set CHARSET to utf8\n\n"
"Less common used options:\n"
" noexec,exec,nodev,dev,nosuid,suid\n");
exit(1);
}
{
int c = '?';
int parseError = 0;
int mntFlags = 0;
int quietFlag = 0;
{
switch (c)
{
case '?':
{
parseError = 1;
break;
}
case 'q':
{
quietFlag = 1;
break;
}
case 'r':
{
break;
}
case 'O':
{
mntFlags |= MS_OVERLAY;
break;
}
case 'm':
{
mntFlags |= MS_NOMNTTAB;
break;
}
case 'o':
{
{
return g_RetMagic;
}
break;
}
default:
{
break;
}
}
}
|| parseError)
{
}
rc = mount(pszSpecial, pszMount, mntFlags | MS_OPTIONSTR, DEVICE_NAME, NULL, 0, g_achOptBuf, sizeof(g_achOptBuf));
if (rc)
{
return g_RetErr;
}
return g_RetOK;
}