vboxfs_vnode.c revision 2084a447d1acb619df7c393fac41b79d517e4b3d
4c221b0da1816acf2ca302b10092df059484468dvboxsync * VirtualBox File System for Solaris Guests, vnode implementation.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
4c221b0da1816acf2ca302b10092df059484468dvboxsync * available from http://www.virtualbox.org. This file is free software;
4c221b0da1816acf2ca302b10092df059484468dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
4c221b0da1816acf2ca302b10092df059484468dvboxsync * General Public License (GPL) as published by the Free Software
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
4c221b0da1816acf2ca302b10092df059484468dvboxsync * additional information or have any questions.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * Shared Folder File System is used from Solaris when run as a guest operating
4c221b0da1816acf2ca302b10092df059484468dvboxsync * system on VirtualBox, though is meant to be usable with any hypervisor that
4c221b0da1816acf2ca302b10092df059484468dvboxsync * can provide similar functionality. The sffs code handles all the Solaris
4c221b0da1816acf2ca302b10092df059484468dvboxsync * specific semantics and relies on a provider module to actually access
4c221b0da1816acf2ca302b10092df059484468dvboxsync * directories, files, etc. The provider interfaces are described in
4c221b0da1816acf2ca302b10092df059484468dvboxsync * "vboxfs_prov.h" and the module implementing them is shipped as part of the
4c221b0da1816acf2ca302b10092df059484468dvboxsync * VirtualBox Guest Additions for Solaris.
4c221b0da1816acf2ca302b10092df059484468dvboxsync * The shared folder file system is similar to a networked file system,
4c221b0da1816acf2ca302b10092df059484468dvboxsync * but with some caveats. The sffs code caches minimal information and proxies
4c221b0da1816acf2ca302b10092df059484468dvboxsync * out to the provider whenever possible. Here are some things that are
4c221b0da1816acf2ca302b10092df059484468dvboxsync * handled in this code and not by the proxy:
4c221b0da1816acf2ca302b10092df059484468dvboxsync * - a way to open ".." from any already open directory
4c221b0da1816acf2ca302b10092df059484468dvboxsync * - st_ino numbers
4c221b0da1816acf2ca302b10092df059484468dvboxsync * - detecting directory changes that happened on the host.
#if !defined(VBOX_VFS_SOLARIS_10U6)
#include "vboxfs_prov.h"
#include "vboxfs_vnode.h"
#include "vboxfs_vfs.h"
char *sffs_buffer;
sfnode_compare(const void *a, const void *b)
int diff;
if (x->sf_is_stale) {
if (diff == 0)
if (diff == 0)
if (diff < 0)
if (diff > 0)
int error;
if (error == 0)
vnode_t *
sfnode_t *
char *path,
if (parent)
return (node);
top:
goto top;
sfnode_t *n;
int len;
n = node;
sfnode_destroy(n);
n->sf_path);
sfnode_t *n;
int old_len;
char *new_path;
char *tail;
if (n != NULL)
KM_SLEEP);
n->sf_path);
n->sf_path);
static sfnode_t *
int error;
int type;
char *fullpath;
return (dir);
return (NULL);
return (node);
mode_t m;
error =
if (error != 0)
else if (S_ISDIR(m))
else if (S_ISREG(m))
if (error) {
return (NULL);
return (node);
mode_t m;
int shift = 0;
int error;
if (error != 0) {
if (mode == 0) {
error = 0;
return (error);
int *eofp,
int flags)
int dummy_eof;
int error = 0;
int namelen;
char **names;
return (EINVAL);
return (ENOTDIR);
*eofp = 0;
if (error != 0)
goto done;
goto done;
if (error != 0)
done:
return (error);
#if defined(VBOX_VFS_SOLARIS_10U6)
int cmd,
int cmd,
int flags,
uint64_t x;
int error;
if (error != 0)
goto done;
if (error != 0)
goto done;
error =
if (error != 0)
goto done;
error =
if (error != 0)
goto done;
error =
if (error != 0)
goto done;
done:
return (error);
int ioflag,
int error = 0;
return (EISDIR);
return (EINVAL);
return (EINVAL);
if (total == 0)
return (EINVAL);
error = 0;
return (error);
int ioflag,
int error = 0;
return (EISDIR);
return (EINVAL);
return (EINVAL);
if (error != 0) {
return (error);
return (EINVAL);
p, RCA_UNSAFE_SIGINFO);
return (EFBIG);
return (EFBIG);
if (total == 0) {
if (error != 0)
if (error == 0)
error = 0;
return (error);
int error;
return (error);
int flags,
int *direntflags,
int error;
return (ENOTDIR);
if (error) {
return (error);
char *name,
int mode,
int flag,
int error;
return (EISDIR);
return (EINVAL);
else if (error != 0)
return (error);
return (EEXIST);
return (EISDIR);
if (error != 0) {
return (error);
if (error) {
return (error);
return (EEXIST);
return (EINVAL);
char *nm,
int flags,
int error;
if (error == 0) {
return (EEXIST);
return (error);
if (error) {
return (error);
return (EACCES);
char *nm,
int flags)
int error;
return (EINVAL);
return (EEXIST);
if (error)
return (error);
return (ENOTDIR);
return (EBUSY);
if (error)
goto done;
goto done;
done:
return (error);
char *name,
int flags)
int error;
if (error)
return (error);
if (error)
goto done;
goto done;
done:
return (error);
char *old_nm,
char *new_nm,
int flags)
char *newpath;
int error;
return (EINVAL);
if (error)
goto done;
goto done;
if (error == 0)
done:
return (error);
int flag,
int count,
return (EINVAL);
return (ENOTSUP);
#if defined(VBOX_VFS_SOLARIS_10U6)
sffs_vnode_init(void)
int err;
if (err)
return (err);
sffs_vnode_fini(void)
if (sffs_ops)
done:
sfnode_t *n;
sfnode_print(n);
sfnode_print(n);