aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-9p.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2010-04-29 17:44:47 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-05-03 12:17:38 -0500
commit131dcb2521bff704424cdb2ce065dc776fbc89b9 (patch)
tree3770e2bfc608251686e2a4d3fc1f27e3145d0007 /hw/virtio-9p.c
parenta03f7874396c909562d35931d03eca79c5c7f708 (diff)
virtio-9p: Add minimal set of FileOperations
Add minimal set of FileOperations and the corresponding implementations for local fstype. These will be required for the FID management patches later on. [aneesh.kumar@linux.vnet.ibm.com: rpath fix ] Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-9p.c')
-rw-r--r--hw/virtio-9p.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index 97e9b04a60..7668e52586 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -21,6 +21,41 @@
int dotu = 1;
int debug_9p_pdu;
+static int v9fs_do_lstat(V9fsState *s, V9fsString *path, struct stat *stbuf)
+{
+ return s->ops->lstat(&s->ctx, path->data, stbuf);
+}
+
+static int v9fs_do_setuid(V9fsState *s, uid_t uid)
+{
+ return s->ops->setuid(&s->ctx, uid);
+}
+
+static ssize_t v9fs_do_readlink(V9fsState *s, V9fsString *path, V9fsString *buf)
+{
+ ssize_t len;
+
+ buf->data = qemu_malloc(1024);
+
+ len = s->ops->readlink(&s->ctx, path->data, buf->data, 1024 - 1);
+ if (len > -1) {
+ buf->size = len;
+ buf->data[len] = 0;
+ }
+
+ return len;
+}
+
+static int v9fs_do_close(V9fsState *s, int fd)
+{
+ return s->ops->close(&s->ctx, fd);
+}
+
+static int v9fs_do_closedir(V9fsState *s, DIR *dir)
+{
+ return s->ops->closedir(&s->ctx, dir);
+}
+
static void v9fs_string_init(V9fsString *str)
{
str->data = NULL;
@@ -437,9 +472,13 @@ static void v9fs_dummy(V9fsState *s, V9fsPDU *pdu)
(void) v9fs_string_sprintf;
(void) v9fs_string_copy;
(void) v9fs_string_size;
-
-
+ (void) v9fs_do_lstat;
+ (void) v9fs_do_setuid;
+ (void) v9fs_do_readlink;
+ (void) v9fs_do_close;
+ (void) v9fs_do_closedir;
}
+
static void v9fs_version(V9fsState *s, V9fsPDU *pdu)
{
if (debug_9p_pdu) {