]> git.proxmox.com Git - qemu.git/blame - hw/file-op-9p.h
virtio-9p: Add fidtype so that we can do type specific operation
[qemu.git] / hw / file-op-9p.h
CommitLineData
74db920c
GS
1/*
2 * Virtio 9p
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13#ifndef _FILEOP_H
14#define _FILEOP_H
15#include <sys/types.h>
16#include <dirent.h>
17#include <sys/time.h>
18#include <utime.h>
19#include <sys/stat.h>
20#include <sys/uio.h>
758e8e38
VJJ
21#include <sys/vfs.h>
22#define SM_LOCAL_MODE_BITS 0600
23#define SM_LOCAL_DIR_MODE_BITS 0700
24
25typedef enum
26{
27 SM_PASSTHROUGH = 1, /* uid/gid set on fileserver files */
28 SM_MAPPED, /* uid/gid part of xattr */
29} SecModel;
30
31typedef struct FsCred
32{
33 uid_t fc_uid;
34 gid_t fc_gid;
35 mode_t fc_mode;
36 dev_t fc_rdev;
37} FsCred;
74db920c
GS
38
39typedef struct FsContext
40{
41 char *fs_root;
758e8e38 42 SecModel fs_sm;
74db920c
GS
43 uid_t uid;
44} FsContext;
45
758e8e38
VJJ
46extern void cred_init(FsCred *);
47
74db920c
GS
48typedef struct FileOperations
49{
131dcb25
AL
50 int (*lstat)(FsContext *, const char *, struct stat *);
51 ssize_t (*readlink)(FsContext *, const char *, char *, size_t);
e95ead32 52 int (*chmod)(FsContext *, const char *, FsCred *);
f7613bee 53 int (*chown)(FsContext *, const char *, FsCred *);
1c293312 54 int (*mknod)(FsContext *, const char *, FsCred *);
74bc02b2 55 int (*utimensat)(FsContext *, const char *, const struct timespec *);
5bae1900 56 int (*remove)(FsContext *, const char *);
879c2813 57 int (*symlink)(FsContext *, const char *, const char *, FsCred *);
c494dd6f 58 int (*link)(FsContext *, const char *, const char *);
131dcb25
AL
59 int (*setuid)(FsContext *, uid_t);
60 int (*close)(FsContext *, int);
61 int (*closedir)(FsContext *, DIR *);
a6568fe2
AL
62 DIR *(*opendir)(FsContext *, const char *);
63 int (*open)(FsContext *, const char *, int);
4750a96f 64 int (*open2)(FsContext *, const char *, int, FsCred *);
a9231555
AL
65 void (*rewinddir)(FsContext *, DIR *);
66 off_t (*telldir)(FsContext *, DIR *);
67 struct dirent *(*readdir)(FsContext *, DIR *);
68 void (*seekdir)(FsContext *, DIR *, off_t);
69 ssize_t (*readv)(FsContext *, int, const struct iovec *, int);
8449360c 70 ssize_t (*writev)(FsContext *, int, const struct iovec *, int);
a9231555 71 off_t (*lseek)(FsContext *, int, off_t, int);
00ec5c37 72 int (*mkdir)(FsContext *, const char *, FsCred *);
c494dd6f 73 int (*fstat)(FsContext *, int, struct stat *);
8cf89e00
AL
74 int (*rename)(FsContext *, const char *, const char *);
75 int (*truncate)(FsContext *, const char *, off_t);
76 int (*fsync)(FsContext *, int);
be940c87 77 int (*statfs)(FsContext *s, const char *path, struct statfs *stbuf);
74db920c
GS
78 void *opaque;
79} FileOperations;
80#endif