vboxfs_vfs.c revision e64031e20c39650a7bc902a3e1aba613b9415dee
/** @file
* VirtualBox File System for Solaris Guests, VFS implementation.
*/
/*
* Copyright (C) 2009 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.
*/
#include <sys/sysmacros.h>
#if !defined(VBOX_VFS_SOLARIS_10U6)
#include <sys/vfs_opreg.h>
#endif
#include <sys/pathname.h>
#include "vboxfs_prov.h"
#include "vboxfs_vnode.h"
#include "vboxfs_vfs.h"
#ifdef u
#undef u
#endif
#define VBOXSOLQUOTE2(x) #x
#define VBOXSOLQUOTE(x) VBOXSOLQUOTE2(x)
/** The module name. */
#define DEVICE_NAME "vboxfs"
/** The module description as seen in 'modinfo'. */
#define DEVICE_DESC "VirtualBox ShrdFS"
/*
* Shared Folders filesystem implementation of the Solaris VFS interfaces.
* Much of this is cookie cutter code for Solaris filesystem implementation.
*/
/* forward declarations */
static mntopt_t sffs_options[] = {
/* Option Cancels Opt Arg Flags Data */
};
static mntopts_t sffs_options_table = {
sizeof (sffs_options) / sizeof (mntopt_t),
};
static vfsdef_t sffs_vfsdef = {
};
static int sffs_fstype;
static int sffs_major; /* major number for device */
int sffs_minor; /* minor number for device */
/*
* Module linkage information
*/
};
static struct modlinkage modlinkage = {
};
int
_init()
{
return (mod_install(&modlinkage));
}
int
{
}
int
_fini()
{
int error;
if (error)
return (error);
/*
* Tear down the operations vectors
*/
(void) vfs_freevfsops_by_type(sffs_fstype);
/*
* close connection to the provider
*/
return (0);
}
static int
{
#if defined(VBOX_VFS_SOLARIS_10U6)
static const fs_operation_def_t sffs_vfsops_template[] = {
};
#else
static const fs_operation_def_t sffs_vfsops_template[] = {
};
#endif
int error;
/*
* This may seem a silly way to do things for now. But the code
* is structured to easily allow it to be used on other hypervisors
* which would have a different implementation of the provider.
* Hopefully that'll never happen. :)
*/
return (ENODEV);
}
if (error != 0) {
return (error);
}
error = sffs_vnode_init();
if (error != 0) {
(void) vfs_freevfsops_by_type(fstype);
return (error);
}
sffs_major = 0;
}
return (0);
}
/*
* wrapper for pn_get
*/
static int
{
int error;
UIO_USERSPACE, &path);
if (error) {
return (error);
}
return (0);
}
static int
{
char *mount_point = NULL;
char *share_name = NULL;
int error;
char *optval;
long val;
char *path;
/*
* check we have permission to do the mount
*/
LogFlowFunc(("sffs_mount() started\n"));
if (error != 0)
return (error);
/*
* Mount point must be a directory
*/
return (ENOTDIR);
/*
* no support for remount (what is it?)
*/
return (ENOTSUP);
/*
*/
return (EBUSY);
}
/*
* check for read only has to be done early
*/
}
/*
* UID to use for all files
*/
/*
* GID to use for all files
*/
/*
* Any unknown options are an error
*/
return (EINVAL);
}
/*
* get the mount point pathname
*/
if (error)
return (error);
/*
* find what we are mounting
*/
if (error) {
return (error);
}
/*
* Invoke Hypervisor mount interface before proceeding
*/
if (error) {
return (error);
}
/*
* find an available minor device number for this mount
*/
do {
} while (vfs_devismounted(dev));
/*
* allocate and fill in the sffs structure
*/
/*
* fill in the vfs structure
*/
/*
* create the root vnode.
* XXX JOE What should the path be here? is "/" really right?
* other options?
*/
return (error);
}
static int
{
int error;
/*
* generic securty check
*/
return (error);
/*
* forced unmount is not supported by this file system
* and thus, ENOTSUP, is being returned.
*/
return (ENOTSUP);
/*
* Make sure nothing is still in use.
*/
if (sffs_purge(sffs) != 0)
return (EBUSY);
/*
* Invoke Hypervisor unmount interface before proceeding
*/
if (error != 0) {
/* TBD anything here? */
}
LogFlowFunc(("sffs_unmount() done\n"));
return (0);
}
/*
* return the vnode for the root of the mounted file system
*/
static int
{
return (0);
}
/*
* get some stats.. fake up the rest
*/
static int
{
uint64_t x;
uint32_t u;
int error;
if (error != 0)
return (error);
if (error != 0)
return (error);
if (error != 0)
return (error);
if (error != 0)
return (error);
if (u)
if (error != 0)
return (error);
return (0);
}
{
}