Statistics
| Branch: | Revision:

root / hw / file-op-9p.h @ 8cf89e00

History | View | Annotate | Download (1.9 kB)

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>
21

    
22
typedef struct FsContext
23
{
24
    char *fs_root;
25
    uid_t uid;
26
} FsContext;
27

    
28
typedef struct FileOperations
29
{
30
    int (*lstat)(FsContext *, const char *, struct stat *);
31
    ssize_t (*readlink)(FsContext *, const char *, char *, size_t);
32
    int (*chmod)(FsContext *, const char *, mode_t);
33
    int (*chown)(FsContext *, const char *, uid_t, gid_t);
34
    int (*mknod)(FsContext *, const char *, mode_t, dev_t);
35
    int (*mksock)(FsContext *, const char *);
36
    int (*utime)(FsContext *, const char *, const struct utimbuf *);
37
    int (*symlink)(FsContext *, const char *, const char *);
38
    int (*link)(FsContext *, const char *, const char *);
39
    int (*setuid)(FsContext *, uid_t);
40
    int (*close)(FsContext *, int);
41
    int (*closedir)(FsContext *, DIR *);
42
    DIR *(*opendir)(FsContext *, const char *);
43
    int (*open)(FsContext *, const char *, int);
44
    int (*open2)(FsContext *, const char *, int, mode_t);
45
    void (*rewinddir)(FsContext *, DIR *);
46
    off_t (*telldir)(FsContext *, DIR *);
47
    struct dirent *(*readdir)(FsContext *, DIR *);
48
    void (*seekdir)(FsContext *, DIR *, off_t);
49
    ssize_t (*readv)(FsContext *, int, const struct iovec *, int);
50
    ssize_t (*writev)(FsContext *, int, const struct iovec *, int);
51
    off_t (*lseek)(FsContext *, int, off_t, int);
52
    int (*mkdir)(FsContext *, const char *, mode_t);
53
    int (*fstat)(FsContext *, int, struct stat *);
54
    int (*rename)(FsContext *, const char *, const char *);
55
    int (*truncate)(FsContext *, const char *, off_t);
56
    int (*fsync)(FsContext *, int);
57
    void *opaque;
58
} FileOperations;
59
#endif