Statistics
| Branch: | Revision:

root / hw / file-op-9p.h @ 1d914fa0

History | View | Annotate | Download (2 kB)

1 74db920c Gautham R Shenoy
/*
2 74db920c Gautham R Shenoy
 * Virtio 9p
3 74db920c Gautham R Shenoy
 *
4 74db920c Gautham R Shenoy
 * Copyright IBM, Corp. 2010
5 74db920c Gautham R Shenoy
 *
6 74db920c Gautham R Shenoy
 * Authors:
7 74db920c Gautham R Shenoy
 *  Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
8 74db920c Gautham R Shenoy
 *
9 74db920c Gautham R Shenoy
 * This work is licensed under the terms of the GNU GPL, version 2.  See
10 74db920c Gautham R Shenoy
 * the COPYING file in the top-level directory.
11 74db920c Gautham R Shenoy
 *
12 74db920c Gautham R Shenoy
 */
13 74db920c Gautham R Shenoy
#ifndef _FILEOP_H
14 74db920c Gautham R Shenoy
#define _FILEOP_H
15 74db920c Gautham R Shenoy
#include <sys/types.h>
16 74db920c Gautham R Shenoy
#include <dirent.h>
17 74db920c Gautham R Shenoy
#include <sys/time.h>
18 74db920c Gautham R Shenoy
#include <utime.h>
19 74db920c Gautham R Shenoy
#include <sys/stat.h>
20 74db920c Gautham R Shenoy
#include <sys/uio.h>
21 74db920c Gautham R Shenoy
22 74db920c Gautham R Shenoy
typedef struct FsContext
23 74db920c Gautham R Shenoy
{
24 74db920c Gautham R Shenoy
    char *fs_root;
25 74db920c Gautham R Shenoy
    uid_t uid;
26 74db920c Gautham R Shenoy
} FsContext;
27 74db920c Gautham R Shenoy
28 74db920c Gautham R Shenoy
typedef struct FileOperations
29 74db920c Gautham R Shenoy
{
30 131dcb25 Anthony Liguori
    int (*lstat)(FsContext *, const char *, struct stat *);
31 131dcb25 Anthony Liguori
    ssize_t (*readlink)(FsContext *, const char *, char *, size_t);
32 c494dd6f Anthony Liguori
    int (*chmod)(FsContext *, const char *, mode_t);
33 8cf89e00 Anthony Liguori
    int (*chown)(FsContext *, const char *, uid_t, gid_t);
34 c494dd6f Anthony Liguori
    int (*mknod)(FsContext *, const char *, mode_t, dev_t);
35 c494dd6f Anthony Liguori
    int (*mksock)(FsContext *, const char *);
36 8cf89e00 Anthony Liguori
    int (*utime)(FsContext *, const char *, const struct utimbuf *);
37 5bae1900 Anthony Liguori
    int (*remove)(FsContext *, const char *);
38 c494dd6f Anthony Liguori
    int (*symlink)(FsContext *, const char *, const char *);
39 c494dd6f Anthony Liguori
    int (*link)(FsContext *, const char *, const char *);
40 131dcb25 Anthony Liguori
    int (*setuid)(FsContext *, uid_t);
41 131dcb25 Anthony Liguori
    int (*close)(FsContext *, int);
42 131dcb25 Anthony Liguori
    int (*closedir)(FsContext *, DIR *);
43 a6568fe2 Anthony Liguori
    DIR *(*opendir)(FsContext *, const char *);
44 a6568fe2 Anthony Liguori
    int (*open)(FsContext *, const char *, int);
45 c494dd6f Anthony Liguori
    int (*open2)(FsContext *, const char *, int, mode_t);
46 a9231555 Anthony Liguori
    void (*rewinddir)(FsContext *, DIR *);
47 a9231555 Anthony Liguori
    off_t (*telldir)(FsContext *, DIR *);
48 a9231555 Anthony Liguori
    struct dirent *(*readdir)(FsContext *, DIR *);
49 a9231555 Anthony Liguori
    void (*seekdir)(FsContext *, DIR *, off_t);
50 a9231555 Anthony Liguori
    ssize_t (*readv)(FsContext *, int, const struct iovec *, int);
51 8449360c Anthony Liguori
    ssize_t (*writev)(FsContext *, int, const struct iovec *, int);
52 a9231555 Anthony Liguori
    off_t (*lseek)(FsContext *, int, off_t, int);
53 c494dd6f Anthony Liguori
    int (*mkdir)(FsContext *, const char *, mode_t);
54 c494dd6f Anthony Liguori
    int (*fstat)(FsContext *, int, struct stat *);
55 8cf89e00 Anthony Liguori
    int (*rename)(FsContext *, const char *, const char *);
56 8cf89e00 Anthony Liguori
    int (*truncate)(FsContext *, const char *, off_t);
57 8cf89e00 Anthony Liguori
    int (*fsync)(FsContext *, int);
58 74db920c Gautham R Shenoy
    void *opaque;
59 74db920c Gautham R Shenoy
} FileOperations;
60 74db920c Gautham R Shenoy
#endif