regops.c revision ca2147b86c2f429cd01519ad5daa31694c9bc639
/** @file
*
* vboxvfs -- VirtualBox Guest Additions for Linux:
* Regular file inode and file operations
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
/*
* Limitations: only COW memory mapping is supported
*/
#include "vfsmod.h"
#define CHUNK_SIZE 4096
/* fops */
static int
{
if (VBOX_FAILURE (rc)) {
LogFunc(("vboxCallRead failed. caller=%s, rc=%Vrc\n",
return -EPROTO;
}
return 0;
}
static ssize_t
{
int err;
void *tmp;
ssize_t total_bytes_read = 0;
TRACE ();
return -EINVAL;
}
if (!size) {
return 0;
}
if (!tmp) {
return -ENOMEM;
}
while (left) {
}
if (err) {
goto fail;
}
goto fail;
}
break;
}
}
*off += total_bytes_read;
return total_bytes_read;
fail:
return err;
}
static ssize_t
{
int err;
void *tmp;
TRACE ();
return -EINVAL;
}
if (!size) {
return 0;
}
if (!tmp) {
return -ENOMEM;
}
while (left) {
int rc;
}
goto fail;
}
if (VBOX_FAILURE (rc)) {
LogFunc(("vboxCallWrite(%s) failed rc=%Vrc\n",
goto fail;
}
break;
}
}
#if 1 /* XXX: which way is correct? */
*off += total_bytes_written;
#else
#endif
return total_bytes_written;
fail:
return err;
}
static int
{
struct sf_reg_info *sf_r;
TRACE ();
if (!sf_r) {
LogRelFunc(("could not allocate reg info\n"));
return -ENOMEM;
}
params.CreateFlags = 0;
/* We check this afterwards to find out if the call succeeded
or failed, as the API does not seem to cleanly distinguish
error and informational messages. */
LogFunc(("O_CREAT set\n"));
/* We ignore O_EXCL, as the Linux kernel seems to call create
beforehand itself, so O_EXCL should always fail. */
LogFunc(("O_TRUNC set\n"));
}
else {
}
}
else {
LogFunc(("O_TRUNC set\n"));
}
}
case O_RDONLY:
break;
case O_WRONLY:
break;
case O_RDWR:
break;
default:
BUG ();
}
}
LogFunc(("sf_reg_open: calling vboxCallCreate, file %s, flags=%d, %#x\n",
if (VBOX_FAILURE (rc)) {
LogFunc(("vboxCallCreate failed flags=%d,%#x rc=%Vrc\n",
return -RTErrConvertToErrno(rc);
}
case SHFL_PATH_NOT_FOUND:
case SHFL_FILE_NOT_FOUND:
break;
case SHFL_FILE_EXISTS:
break;
default:
break;
}
}
return rc_linux;
}
static int
{
int rc;
struct sf_reg_info *sf_r;
struct sf_glob_info *sf_g;
TRACE ();
if (VBOX_FAILURE (rc)) {
}
return 0;
}
static struct page *
#define SET_TYPE(t)
#else
#endif
{
char *buf;
int err;
TRACE ();
return NOPAGE_SIGBUS;
}
if (!page) {
LogRelFunc(("failed to allocate page\n"));
return NOPAGE_OOM;
}
if (err) {
return NOPAGE_SIGBUS;
}
if (!nread) {
#else
#endif
}
else {
}
return page;
}
static struct vm_operations_struct sf_vma_ops = {
};
static int
{
TRACE ();
LogFunc(("shared mmapping not available\n"));
return -EINVAL;
}
return 0;
}
struct file_operations sf_reg_fops = {
.read = sf_reg_read,
.open = sf_reg_open,
.write = sf_reg_write,
.mmap = sf_reg_mmap,
# else
# endif
#endif
};
struct inode_operations sf_reg_iops = {
#else
#endif
};
static int
{
int ret;
TRACE ();
if (ret) {
return ret;
}
if (PageLocked(page))
return 0;
}
struct address_space_operations sf_reg_aops = {
.readpage = sf_readpage,
# else
# endif
};
#endif