Statistics
| Branch: | Revision:

root / hw / file-op-9p.h @ c494dd6f

History | View | Annotate | Download (1.7 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 c494dd6f Anthony Liguori
    int (*mknod)(FsContext *, const char *, mode_t, dev_t);
34 c494dd6f Anthony Liguori
    int (*mksock)(FsContext *, const char *);
35 c494dd6f Anthony Liguori
    int (*symlink)(FsContext *, const char *, const char *);
36 c494dd6f Anthony Liguori
    int (*link)(FsContext *, const char *, const char *);
37 131dcb25 Anthony Liguori
    int (*setuid)(FsContext *, uid_t);
38 131dcb25 Anthony Liguori
    int (*close)(FsContext *, int);
39 131dcb25 Anthony Liguori
    int (*closedir)(FsContext *, DIR *);
40 a6568fe2 Anthony Liguori
    DIR *(*opendir)(FsContext *, const char *);
41 a6568fe2 Anthony Liguori
    int (*open)(FsContext *, const char *, int);
42 c494dd6f Anthony Liguori
    int (*open2)(FsContext *, const char *, int, mode_t);
43 a9231555 Anthony Liguori
    void (*rewinddir)(FsContext *, DIR *);
44 a9231555 Anthony Liguori
    off_t (*telldir)(FsContext *, DIR *);
45 a9231555 Anthony Liguori
    struct dirent *(*readdir)(FsContext *, DIR *);
46 a9231555 Anthony Liguori
    void (*seekdir)(FsContext *, DIR *, off_t);
47 a9231555 Anthony Liguori
    ssize_t (*readv)(FsContext *, int, const struct iovec *, int);
48 8449360c Anthony Liguori
    ssize_t (*writev)(FsContext *, int, const struct iovec *, int);
49 a9231555 Anthony Liguori
    off_t (*lseek)(FsContext *, int, off_t, int);
50 c494dd6f Anthony Liguori
    int (*mkdir)(FsContext *, const char *, mode_t);
51 c494dd6f Anthony Liguori
    int (*fstat)(FsContext *, int, struct stat *);
52 74db920c Gautham R Shenoy
    void *opaque;
53 74db920c Gautham R Shenoy
} FileOperations;
54 74db920c Gautham R Shenoy
#endif