regops.c revision bfbd5e7ef5828bb796fb1070611b906bcb87c08d
/** @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 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
*/
#define CHUNK_SIZE 4096
/* fops */
static int
{
if (VBOX_FAILURE (rc)) {
elog3 ("%s: %s: vboxCallRead failed rc=%d\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) {
elog ("could not allocate bounce buffer memory %u bytes\n",
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) {
elog ("could not allocate bounce buffer memory %u bytes\n",
return -ENOMEM;
}
while (left) {
int rc;
}
goto fail;
}
if (VBOX_FAILURE (rc)) {
elog ("vboxCallWrite(%s) failed rc=%d\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
{
int rc;
struct sf_reg_info *sf_r;
TRACE ();
if (!sf_r) {
elog2 ("could not allocate reg info\n");
return -ENOMEM;
}
#if 0
#endif
params.CreateFlags = 0;
}
else {
}
else {
}
}
}
else {
}
else {
}
}
case O_RDONLY:
break;
case O_WRONLY:
break;
case O_RDWR:
break;
default:
BUG ();
}
}
/* XXX: here i probably should check rc and convert some values to
EEXISTS ENOENT etc */
if (VBOX_FAILURE (rc)) {
elog ("vboxCallCreate failed flags=%d,%#x rc=%d\n",
return -EPROTO;
}
return 0;
}
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) {
elog2 ("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 ();
elog2 ("shared mmapping not available\n");
return -EINVAL;
}
return 0;
}
static struct file_operations sf_reg_fops = {
.read = sf_reg_read,
.open = sf_reg_open,
.write = sf_reg_write,
.mmap = sf_reg_mmap
};
/* iops */
static struct inode_operations sf_reg_iops = {
#else
#endif
};