Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 1 | /* |
Wei Liu | 3b9ca04 | 2015-11-18 18:03:14 +0000 | [diff] [blame] | 2 | * 9p handle callback |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 3 | * |
| 4 | * Copyright IBM, Corp. 2011 |
| 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 | |
Peter Maydell | fbc0412 | 2016-01-26 18:17:10 +0000 | [diff] [blame] | 14 | #include "qemu/osdep.h" |
Wei Liu | ebe74f8 | 2016-01-07 18:18:02 +0000 | [diff] [blame] | 15 | #include "9p.h" |
Wei Liu | 267ae09 | 2015-11-18 18:31:52 +0000 | [diff] [blame] | 16 | #include "9p-xattr.h" |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 17 | #include <arpa/inet.h> |
| 18 | #include <pwd.h> |
| 19 | #include <grp.h> |
| 20 | #include <sys/socket.h> |
| 21 | #include <sys/un.h> |
Paolo Bonzini | 1de7afc | 2012-12-17 18:20:00 +0100 | [diff] [blame] | 22 | #include "qemu/xattr.h" |
Veronia Bahaa | f348b6d | 2016-03-20 19:16:19 +0200 | [diff] [blame] | 23 | #include "qemu/cutils.h" |
Greg Kurz | 63325b1 | 2016-01-22 15:12:17 +0100 | [diff] [blame] | 24 | #include "qemu/error-report.h" |
Markus Armbruster | 922a01a | 2018-02-01 12:18:46 +0100 | [diff] [blame] | 25 | #include "qemu/option.h" |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 26 | #include <linux/fs.h> |
| 27 | #ifdef CONFIG_LINUX_MAGIC_H |
| 28 | #include <linux/magic.h> |
| 29 | #endif |
| 30 | #include <sys/ioctl.h> |
| 31 | |
| 32 | #ifndef XFS_SUPER_MAGIC |
| 33 | #define XFS_SUPER_MAGIC 0x58465342 |
| 34 | #endif |
| 35 | #ifndef EXT2_SUPER_MAGIC |
| 36 | #define EXT2_SUPER_MAGIC 0xEF53 |
| 37 | #endif |
| 38 | #ifndef REISERFS_SUPER_MAGIC |
| 39 | #define REISERFS_SUPER_MAGIC 0x52654973 |
| 40 | #endif |
| 41 | #ifndef BTRFS_SUPER_MAGIC |
| 42 | #define BTRFS_SUPER_MAGIC 0x9123683E |
| 43 | #endif |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 44 | |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 45 | typedef struct HandleData { |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 46 | int mountfd; |
| 47 | int handle_bytes; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 48 | } HandleData; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 49 | |
Aneesh Kumar K.V | d204237 | 2011-10-12 19:11:24 +0530 | [diff] [blame] | 50 | static inline int name_to_handle(int dirfd, const char *name, |
| 51 | struct file_handle *fh, int *mnt_id, int flags) |
| 52 | { |
| 53 | return name_to_handle_at(dirfd, name, fh, mnt_id, flags); |
| 54 | } |
| 55 | |
| 56 | static inline int open_by_handle(int mountfd, const char *fh, int flags) |
| 57 | { |
| 58 | return open_by_handle_at(mountfd, (struct file_handle *)fh, flags); |
| 59 | } |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 60 | |
| 61 | static int handle_update_file_cred(int dirfd, const char *name, FsCred *credp) |
| 62 | { |
| 63 | int fd, ret; |
Dong Xu Wang | 3a93113 | 2011-11-29 16:52:38 +0800 | [diff] [blame] | 64 | fd = openat(dirfd, name, O_NONBLOCK | O_NOFOLLOW); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 65 | if (fd < 0) { |
| 66 | return fd; |
| 67 | } |
M. Mohan Kumar | 2d40564 | 2012-01-19 12:21:12 +0530 | [diff] [blame] | 68 | ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 69 | if (ret < 0) { |
| 70 | goto err_out; |
| 71 | } |
M. Mohan Kumar | 2d40564 | 2012-01-19 12:21:12 +0530 | [diff] [blame] | 72 | ret = fchmod(fd, credp->fc_mode & 07777); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 73 | err_out: |
| 74 | close(fd); |
| 75 | return ret; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | static int handle_lstat(FsContext *fs_ctx, V9fsPath *fs_path, |
| 80 | struct stat *stbuf) |
| 81 | { |
| 82 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 83 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 84 | |
| 85 | fd = open_by_handle(data->mountfd, fs_path->data, O_PATH); |
| 86 | if (fd < 0) { |
| 87 | return fd; |
| 88 | } |
| 89 | ret = fstatat(fd, "", stbuf, AT_EMPTY_PATH); |
| 90 | close(fd); |
| 91 | return ret; |
| 92 | } |
| 93 | |
| 94 | static ssize_t handle_readlink(FsContext *fs_ctx, V9fsPath *fs_path, |
| 95 | char *buf, size_t bufsz) |
| 96 | { |
| 97 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 98 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 99 | |
| 100 | fd = open_by_handle(data->mountfd, fs_path->data, O_PATH); |
| 101 | if (fd < 0) { |
| 102 | return fd; |
| 103 | } |
| 104 | ret = readlinkat(fd, "", buf, bufsz); |
| 105 | close(fd); |
| 106 | return ret; |
| 107 | } |
| 108 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 109 | static int handle_close(FsContext *ctx, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 110 | { |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 111 | return close(fs->fd); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 112 | } |
| 113 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 114 | static int handle_closedir(FsContext *ctx, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 115 | { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 116 | return closedir(fs->dir.stream); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 117 | } |
| 118 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 119 | static int handle_open(FsContext *ctx, V9fsPath *fs_path, |
| 120 | int flags, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 121 | { |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 122 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 123 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 124 | fs->fd = open_by_handle(data->mountfd, fs_path->data, flags); |
| 125 | return fs->fd; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 126 | } |
| 127 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 128 | static int handle_opendir(FsContext *ctx, |
| 129 | V9fsPath *fs_path, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 130 | { |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 131 | int ret; |
| 132 | ret = handle_open(ctx, fs_path, O_DIRECTORY, fs); |
| 133 | if (ret < 0) { |
| 134 | return -1; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 135 | } |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 136 | fs->dir.stream = fdopendir(ret); |
| 137 | if (!fs->dir.stream) { |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 138 | return -1; |
| 139 | } |
| 140 | return 0; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 141 | } |
| 142 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 143 | static void handle_rewinddir(FsContext *ctx, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 144 | { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 145 | rewinddir(fs->dir.stream); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 146 | } |
| 147 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 148 | static off_t handle_telldir(FsContext *ctx, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 149 | { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 150 | return telldir(fs->dir.stream); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 151 | } |
| 152 | |
Greg Kurz | 635324e | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 153 | static struct dirent *handle_readdir(FsContext *ctx, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 154 | { |
Greg Kurz | 635324e | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 155 | return readdir(fs->dir.stream); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 156 | } |
| 157 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 158 | static void handle_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 159 | { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 160 | seekdir(fs->dir.stream, off); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 161 | } |
| 162 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 163 | static ssize_t handle_preadv(FsContext *ctx, V9fsFidOpenState *fs, |
| 164 | const struct iovec *iov, |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 165 | int iovcnt, off_t offset) |
| 166 | { |
| 167 | #ifdef CONFIG_PREADV |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 168 | return preadv(fs->fd, iov, iovcnt, offset); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 169 | #else |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 170 | int err = lseek(fs->fd, offset, SEEK_SET); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 171 | if (err == -1) { |
| 172 | return err; |
| 173 | } else { |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 174 | return readv(fs->fd, iov, iovcnt); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 175 | } |
| 176 | #endif |
| 177 | } |
| 178 | |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 179 | static ssize_t handle_pwritev(FsContext *ctx, V9fsFidOpenState *fs, |
| 180 | const struct iovec *iov, |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 181 | int iovcnt, off_t offset) |
| 182 | { |
Aneesh Kumar K.V | d3ab98e | 2011-10-12 19:11:23 +0530 | [diff] [blame] | 183 | ssize_t ret; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 184 | #ifdef CONFIG_PREADV |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 185 | ret = pwritev(fs->fd, iov, iovcnt, offset); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 186 | #else |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 187 | int err = lseek(fs->fd, offset, SEEK_SET); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 188 | if (err == -1) { |
| 189 | return err; |
| 190 | } else { |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 191 | ret = writev(fs->fd, iov, iovcnt); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 192 | } |
| 193 | #endif |
Aneesh Kumar K.V | d3ab98e | 2011-10-12 19:11:23 +0530 | [diff] [blame] | 194 | #ifdef CONFIG_SYNC_FILE_RANGE |
| 195 | if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) { |
| 196 | /* |
| 197 | * Initiate a writeback. This is not a data integrity sync. |
| 198 | * We want to ensure that we don't leave dirty pages in the cache |
| 199 | * after write when writeout=immediate is sepcified. |
| 200 | */ |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 201 | sync_file_range(fs->fd, offset, ret, |
Aneesh Kumar K.V | d3ab98e | 2011-10-12 19:11:23 +0530 | [diff] [blame] | 202 | SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); |
| 203 | } |
| 204 | #endif |
| 205 | return ret; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | static int handle_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) |
| 209 | { |
| 210 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 211 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 212 | |
| 213 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 214 | if (fd < 0) { |
| 215 | return fd; |
| 216 | } |
| 217 | ret = fchmod(fd, credp->fc_mode); |
| 218 | close(fd); |
| 219 | return ret; |
| 220 | } |
| 221 | |
| 222 | static int handle_mknod(FsContext *fs_ctx, V9fsPath *dir_path, |
| 223 | const char *name, FsCred *credp) |
| 224 | { |
| 225 | int dirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 226 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 227 | |
| 228 | dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH); |
| 229 | if (dirfd < 0) { |
| 230 | return dirfd; |
| 231 | } |
| 232 | ret = mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); |
| 233 | if (!ret) { |
| 234 | ret = handle_update_file_cred(dirfd, name, credp); |
| 235 | } |
| 236 | close(dirfd); |
| 237 | return ret; |
| 238 | } |
| 239 | |
| 240 | static int handle_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, |
| 241 | const char *name, FsCred *credp) |
| 242 | { |
| 243 | int dirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 244 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 245 | |
| 246 | dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH); |
| 247 | if (dirfd < 0) { |
| 248 | return dirfd; |
| 249 | } |
| 250 | ret = mkdirat(dirfd, name, credp->fc_mode); |
| 251 | if (!ret) { |
| 252 | ret = handle_update_file_cred(dirfd, name, credp); |
| 253 | } |
| 254 | close(dirfd); |
| 255 | return ret; |
| 256 | } |
| 257 | |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 258 | static int handle_fstat(FsContext *fs_ctx, int fid_type, |
| 259 | V9fsFidOpenState *fs, struct stat *stbuf) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 260 | { |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 261 | int fd; |
| 262 | |
| 263 | if (fid_type == P9_FID_DIR) { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 264 | fd = dirfd(fs->dir.stream); |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 265 | } else { |
| 266 | fd = fs->fd; |
| 267 | } |
| 268 | return fstat(fd, stbuf); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | static int handle_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 272 | int flags, FsCred *credp, V9fsFidOpenState *fs) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 273 | { |
| 274 | int ret; |
| 275 | int dirfd, fd; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 276 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 277 | |
| 278 | dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH); |
| 279 | if (dirfd < 0) { |
| 280 | return dirfd; |
| 281 | } |
| 282 | fd = openat(dirfd, name, flags | O_NOFOLLOW, credp->fc_mode); |
| 283 | if (fd >= 0) { |
| 284 | ret = handle_update_file_cred(dirfd, name, credp); |
| 285 | if (ret < 0) { |
| 286 | close(fd); |
| 287 | fd = ret; |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 288 | } else { |
| 289 | fs->fd = fd; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 290 | } |
| 291 | } |
| 292 | close(dirfd); |
| 293 | return fd; |
| 294 | } |
| 295 | |
| 296 | |
| 297 | static int handle_symlink(FsContext *fs_ctx, const char *oldpath, |
| 298 | V9fsPath *dir_path, const char *name, FsCred *credp) |
| 299 | { |
| 300 | int fd, dirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 301 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 302 | |
| 303 | dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH); |
| 304 | if (dirfd < 0) { |
| 305 | return dirfd; |
| 306 | } |
| 307 | ret = symlinkat(oldpath, dirfd, name); |
| 308 | if (!ret) { |
| 309 | fd = openat(dirfd, name, O_PATH | O_NOFOLLOW); |
| 310 | if (fd < 0) { |
| 311 | ret = fd; |
| 312 | goto err_out; |
| 313 | } |
| 314 | ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH); |
| 315 | close(fd); |
| 316 | } |
| 317 | err_out: |
| 318 | close(dirfd); |
| 319 | return ret; |
| 320 | } |
| 321 | |
| 322 | static int handle_link(FsContext *ctx, V9fsPath *oldpath, |
| 323 | V9fsPath *dirpath, const char *name) |
| 324 | { |
| 325 | int oldfd, newdirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 326 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 327 | |
| 328 | oldfd = open_by_handle(data->mountfd, oldpath->data, O_PATH); |
| 329 | if (oldfd < 0) { |
| 330 | return oldfd; |
| 331 | } |
| 332 | newdirfd = open_by_handle(data->mountfd, dirpath->data, O_PATH); |
| 333 | if (newdirfd < 0) { |
| 334 | close(oldfd); |
| 335 | return newdirfd; |
| 336 | } |
| 337 | ret = linkat(oldfd, "", newdirfd, name, AT_EMPTY_PATH); |
| 338 | close(newdirfd); |
| 339 | close(oldfd); |
| 340 | return ret; |
| 341 | } |
| 342 | |
| 343 | static int handle_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) |
| 344 | { |
| 345 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 346 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 347 | |
| 348 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK | O_WRONLY); |
| 349 | if (fd < 0) { |
| 350 | return fd; |
| 351 | } |
| 352 | ret = ftruncate(fd, size); |
| 353 | close(fd); |
| 354 | return ret; |
| 355 | } |
| 356 | |
| 357 | static int handle_rename(FsContext *ctx, const char *oldpath, |
| 358 | const char *newpath) |
| 359 | { |
| 360 | errno = EOPNOTSUPP; |
| 361 | return -1; |
| 362 | } |
| 363 | |
| 364 | static int handle_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) |
| 365 | { |
| 366 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 367 | HandleData *data = (HandleData *) fs_ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 368 | |
| 369 | fd = open_by_handle(data->mountfd, fs_path->data, O_PATH); |
| 370 | if (fd < 0) { |
| 371 | return fd; |
| 372 | } |
| 373 | ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH); |
| 374 | close(fd); |
| 375 | return ret; |
| 376 | } |
| 377 | |
| 378 | static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path, |
| 379 | const struct timespec *buf) |
| 380 | { |
Aneesh Kumar K.V | d204237 | 2011-10-12 19:11:24 +0530 | [diff] [blame] | 381 | int ret; |
Aneesh Kumar K.V | d204237 | 2011-10-12 19:11:24 +0530 | [diff] [blame] | 382 | int fd; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 383 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 384 | |
| 385 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 386 | if (fd < 0) { |
| 387 | return fd; |
| 388 | } |
| 389 | ret = futimens(fd, buf); |
| 390 | close(fd); |
| 391 | return ret; |
| 392 | } |
| 393 | |
| 394 | static int handle_remove(FsContext *ctx, const char *path) |
| 395 | { |
| 396 | errno = EOPNOTSUPP; |
| 397 | return -1; |
| 398 | } |
| 399 | |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 400 | static int handle_fsync(FsContext *ctx, int fid_type, |
| 401 | V9fsFidOpenState *fs, int datasync) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 402 | { |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 403 | int fd; |
| 404 | |
| 405 | if (fid_type == P9_FID_DIR) { |
Greg Kurz | f314ea4 | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 406 | fd = dirfd(fs->dir.stream); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 407 | } else { |
Aneesh Kumar K.V | 8b88827 | 2011-12-04 22:35:28 +0530 | [diff] [blame] | 408 | fd = fs->fd; |
| 409 | } |
| 410 | |
| 411 | if (datasync) { |
| 412 | return qemu_fdatasync(fd); |
| 413 | } else { |
| 414 | return fsync(fd); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 415 | } |
| 416 | } |
| 417 | |
| 418 | static int handle_statfs(FsContext *ctx, V9fsPath *fs_path, |
| 419 | struct statfs *stbuf) |
| 420 | { |
| 421 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 422 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 423 | |
| 424 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 425 | if (fd < 0) { |
| 426 | return fd; |
| 427 | } |
| 428 | ret = fstatfs(fd, stbuf); |
| 429 | close(fd); |
| 430 | return ret; |
| 431 | } |
| 432 | |
| 433 | static ssize_t handle_lgetxattr(FsContext *ctx, V9fsPath *fs_path, |
| 434 | const char *name, void *value, size_t size) |
| 435 | { |
| 436 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 437 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 438 | |
| 439 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 440 | if (fd < 0) { |
| 441 | return fd; |
| 442 | } |
| 443 | ret = fgetxattr(fd, name, value, size); |
| 444 | close(fd); |
| 445 | return ret; |
| 446 | } |
| 447 | |
| 448 | static ssize_t handle_llistxattr(FsContext *ctx, V9fsPath *fs_path, |
| 449 | void *value, size_t size) |
| 450 | { |
| 451 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 452 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 453 | |
| 454 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 455 | if (fd < 0) { |
| 456 | return fd; |
| 457 | } |
| 458 | ret = flistxattr(fd, value, size); |
| 459 | close(fd); |
| 460 | return ret; |
| 461 | } |
| 462 | |
| 463 | static int handle_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, |
| 464 | void *value, size_t size, int flags) |
| 465 | { |
| 466 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 467 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 468 | |
| 469 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 470 | if (fd < 0) { |
| 471 | return fd; |
| 472 | } |
| 473 | ret = fsetxattr(fd, name, value, size, flags); |
| 474 | close(fd); |
| 475 | return ret; |
| 476 | } |
| 477 | |
| 478 | static int handle_lremovexattr(FsContext *ctx, V9fsPath *fs_path, |
| 479 | const char *name) |
| 480 | { |
| 481 | int fd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 482 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 483 | |
| 484 | fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); |
| 485 | if (fd < 0) { |
| 486 | return fd; |
| 487 | } |
| 488 | ret = fremovexattr(fd, name); |
| 489 | close(fd); |
| 490 | return ret; |
| 491 | } |
| 492 | |
| 493 | static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path, |
| 494 | const char *name, V9fsPath *target) |
| 495 | { |
Chen Gang | 4fa4ce7 | 2014-03-02 01:36:19 +0800 | [diff] [blame] | 496 | char *buffer; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 497 | struct file_handle *fh; |
| 498 | int dirfd, ret, mnt_id; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 499 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 500 | |
| 501 | /* "." and ".." are not allowed */ |
| 502 | if (!strcmp(name, ".") || !strcmp(name, "..")) { |
| 503 | errno = EINVAL; |
| 504 | return -1; |
| 505 | |
| 506 | } |
| 507 | if (dir_path) { |
| 508 | dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH); |
| 509 | } else { |
| 510 | /* relative to export root */ |
Chen Gang | 4fa4ce7 | 2014-03-02 01:36:19 +0800 | [diff] [blame] | 511 | buffer = rpath(ctx, "."); |
| 512 | dirfd = open(buffer, O_DIRECTORY); |
| 513 | g_free(buffer); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 514 | } |
| 515 | if (dirfd < 0) { |
| 516 | return dirfd; |
| 517 | } |
| 518 | fh = g_malloc(sizeof(struct file_handle) + data->handle_bytes); |
| 519 | fh->handle_bytes = data->handle_bytes; |
Dong Xu Wang | 66a0a2c | 2011-11-29 16:52:39 +0800 | [diff] [blame] | 520 | /* add a "./" at the beginning of the path */ |
Chen Gang | 4fa4ce7 | 2014-03-02 01:36:19 +0800 | [diff] [blame] | 521 | buffer = g_strdup_printf("./%s", name); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 522 | /* flag = 0 imply don't follow symlink */ |
| 523 | ret = name_to_handle(dirfd, buffer, fh, &mnt_id, 0); |
| 524 | if (!ret) { |
| 525 | target->data = (char *)fh; |
| 526 | target->size = sizeof(struct file_handle) + data->handle_bytes; |
| 527 | } else { |
| 528 | g_free(fh); |
| 529 | } |
| 530 | close(dirfd); |
Chen Gang | 4fa4ce7 | 2014-03-02 01:36:19 +0800 | [diff] [blame] | 531 | g_free(buffer); |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 532 | return ret; |
| 533 | } |
| 534 | |
| 535 | static int handle_renameat(FsContext *ctx, V9fsPath *olddir, |
| 536 | const char *old_name, V9fsPath *newdir, |
| 537 | const char *new_name) |
| 538 | { |
| 539 | int olddirfd, newdirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 540 | HandleData *data = (HandleData *) ctx->private; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 541 | |
| 542 | olddirfd = open_by_handle(data->mountfd, olddir->data, O_PATH); |
| 543 | if (olddirfd < 0) { |
| 544 | return olddirfd; |
| 545 | } |
| 546 | newdirfd = open_by_handle(data->mountfd, newdir->data, O_PATH); |
| 547 | if (newdirfd < 0) { |
| 548 | close(olddirfd); |
| 549 | return newdirfd; |
| 550 | } |
| 551 | ret = renameat(olddirfd, old_name, newdirfd, new_name); |
| 552 | close(newdirfd); |
| 553 | close(olddirfd); |
| 554 | return ret; |
| 555 | } |
| 556 | |
| 557 | static int handle_unlinkat(FsContext *ctx, V9fsPath *dir, |
| 558 | const char *name, int flags) |
| 559 | { |
| 560 | int dirfd, ret; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 561 | HandleData *data = (HandleData *) ctx->private; |
Paolo Bonzini | 930b588 | 2011-11-18 17:35:38 +0100 | [diff] [blame] | 562 | int rflags; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 563 | |
| 564 | dirfd = open_by_handle(data->mountfd, dir->data, O_PATH); |
| 565 | if (dirfd < 0) { |
| 566 | return dirfd; |
| 567 | } |
| 568 | |
Paolo Bonzini | 930b588 | 2011-11-18 17:35:38 +0100 | [diff] [blame] | 569 | rflags = 0; |
| 570 | if (flags & P9_DOTL_AT_REMOVEDIR) { |
| 571 | rflags |= AT_REMOVEDIR; |
| 572 | } |
| 573 | |
| 574 | ret = unlinkat(dirfd, name, rflags); |
| 575 | |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 576 | close(dirfd); |
| 577 | return ret; |
| 578 | } |
| 579 | |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 580 | static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path, |
| 581 | mode_t st_mode, uint64_t *st_gen) |
| 582 | { |
Kirill A. Shutemov | b931766 | 2014-01-28 17:08:25 +0200 | [diff] [blame] | 583 | #ifdef FS_IOC_GETVERSION |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 584 | int err; |
| 585 | V9fsFidOpenState fid_open; |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 586 | |
| 587 | /* |
| 588 | * Do not try to open special files like device nodes, fifos etc |
| 589 | * We can get fd for regular files and directories only |
| 590 | */ |
| 591 | if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { |
Kirill A. Shutemov | 1a9978a | 2014-01-28 17:08:26 +0200 | [diff] [blame] | 592 | errno = ENOTTY; |
| 593 | return -1; |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 594 | } |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 595 | err = handle_open(ctx, path, O_RDONLY, &fid_open); |
| 596 | if (err < 0) { |
| 597 | return err; |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 598 | } |
Aneesh Kumar K.V | cc720dd | 2011-10-25 12:10:40 +0530 | [diff] [blame] | 599 | err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); |
| 600 | handle_close(ctx, &fid_open); |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 601 | return err; |
Kirill A. Shutemov | b931766 | 2014-01-28 17:08:25 +0200 | [diff] [blame] | 602 | #else |
| 603 | errno = ENOTTY; |
| 604 | return -1; |
| 605 | #endif |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 606 | } |
| 607 | |
Greg Kurz | 65603a8 | 2018-01-08 11:18:23 +0100 | [diff] [blame] | 608 | static int handle_init(FsContext *ctx, Error **errp) |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 609 | { |
| 610 | int ret, mnt_id; |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 611 | struct statfs stbuf; |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 612 | struct file_handle fh; |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 613 | HandleData *data = g_malloc(sizeof(HandleData)); |
Aneesh Kumar K.V | d204237 | 2011-10-12 19:11:24 +0530 | [diff] [blame] | 614 | |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 615 | data->mountfd = open(ctx->fs_root, O_DIRECTORY); |
| 616 | if (data->mountfd < 0) { |
| 617 | ret = data->mountfd; |
| 618 | goto err_out; |
| 619 | } |
Harsh Prateek Bora | edb9eb7 | 2011-10-12 19:11:25 +0530 | [diff] [blame] | 620 | ret = statfs(ctx->fs_root, &stbuf); |
| 621 | if (!ret) { |
| 622 | switch (stbuf.f_type) { |
| 623 | case EXT2_SUPER_MAGIC: |
| 624 | case BTRFS_SUPER_MAGIC: |
| 625 | case REISERFS_SUPER_MAGIC: |
| 626 | case XFS_SUPER_MAGIC: |
| 627 | ctx->exops.get_st_gen = handle_ioc_getversion; |
| 628 | break; |
| 629 | } |
| 630 | } |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 631 | memset(&fh, 0, sizeof(struct file_handle)); |
| 632 | ret = name_to_handle(data->mountfd, ".", &fh, &mnt_id, 0); |
| 633 | if (ret && errno == EOVERFLOW) { |
| 634 | data->handle_bytes = fh.handle_bytes; |
| 635 | ctx->private = data; |
| 636 | ret = 0; |
| 637 | goto out; |
| 638 | } |
| 639 | /* we got 0 byte handle ? */ |
| 640 | ret = -1; |
| 641 | close(data->mountfd); |
| 642 | err_out: |
| 643 | g_free(data); |
| 644 | out: |
| 645 | return ret; |
| 646 | } |
| 647 | |
Li Qiang | 971f406 | 2016-11-23 13:53:34 +0100 | [diff] [blame] | 648 | static void handle_cleanup(FsContext *ctx) |
| 649 | { |
Greg Kurz | c4ce2c0 | 2018-01-08 11:18:22 +0100 | [diff] [blame] | 650 | HandleData *data = ctx->private; |
Li Qiang | 971f406 | 2016-11-23 13:53:34 +0100 | [diff] [blame] | 651 | |
| 652 | close(data->mountfd); |
| 653 | g_free(data); |
| 654 | } |
| 655 | |
Greg Kurz | 91cda4e | 2018-01-08 11:18:23 +0100 | [diff] [blame] | 656 | static int handle_parse_opts(QemuOpts *opts, FsDriverEntry *fse, Error **errp) |
Aneesh Kumar K.V | 99519f0 | 2011-12-14 13:48:59 +0530 | [diff] [blame] | 657 | { |
| 658 | const char *sec_model = qemu_opt_get(opts, "security_model"); |
| 659 | const char *path = qemu_opt_get(opts, "path"); |
| 660 | |
Greg Kurz | db3b3c7 | 2018-01-08 11:18:23 +0100 | [diff] [blame] | 661 | warn_report("handle backend is deprecated"); |
| 662 | |
Aneesh Kumar K.V | 99519f0 | 2011-12-14 13:48:59 +0530 | [diff] [blame] | 663 | if (sec_model) { |
Greg Kurz | 63325b1 | 2016-01-22 15:12:17 +0100 | [diff] [blame] | 664 | error_report("Invalid argument security_model specified with handle fsdriver"); |
Aneesh Kumar K.V | 99519f0 | 2011-12-14 13:48:59 +0530 | [diff] [blame] | 665 | return -1; |
| 666 | } |
| 667 | |
| 668 | if (!path) { |
Greg Kurz | 63325b1 | 2016-01-22 15:12:17 +0100 | [diff] [blame] | 669 | error_report("fsdev: No path specified"); |
Aneesh Kumar K.V | 99519f0 | 2011-12-14 13:48:59 +0530 | [diff] [blame] | 670 | return -1; |
| 671 | } |
| 672 | fse->path = g_strdup(path); |
| 673 | return 0; |
| 674 | |
| 675 | } |
| 676 | |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 677 | FileOperations handle_ops = { |
Aneesh Kumar K.V | 99519f0 | 2011-12-14 13:48:59 +0530 | [diff] [blame] | 678 | .parse_opts = handle_parse_opts, |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 679 | .init = handle_init, |
Li Qiang | 971f406 | 2016-11-23 13:53:34 +0100 | [diff] [blame] | 680 | .cleanup = handle_cleanup, |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 681 | .lstat = handle_lstat, |
| 682 | .readlink = handle_readlink, |
| 683 | .close = handle_close, |
| 684 | .closedir = handle_closedir, |
| 685 | .open = handle_open, |
| 686 | .opendir = handle_opendir, |
| 687 | .rewinddir = handle_rewinddir, |
| 688 | .telldir = handle_telldir, |
Greg Kurz | 635324e | 2016-06-06 11:52:34 +0200 | [diff] [blame] | 689 | .readdir = handle_readdir, |
Aneesh Kumar K.V | 5f54222 | 2011-08-02 11:35:54 +0530 | [diff] [blame] | 690 | .seekdir = handle_seekdir, |
| 691 | .preadv = handle_preadv, |
| 692 | .pwritev = handle_pwritev, |
| 693 | .chmod = handle_chmod, |
| 694 | .mknod = handle_mknod, |
| 695 | .mkdir = handle_mkdir, |
| 696 | .fstat = handle_fstat, |
| 697 | .open2 = handle_open2, |
| 698 | .symlink = handle_symlink, |
| 699 | .link = handle_link, |
| 700 | .truncate = handle_truncate, |
| 701 | .rename = handle_rename, |
| 702 | .chown = handle_chown, |
| 703 | .utimensat = handle_utimensat, |
| 704 | .remove = handle_remove, |
| 705 | .fsync = handle_fsync, |
| 706 | .statfs = handle_statfs, |
| 707 | .lgetxattr = handle_lgetxattr, |
| 708 | .llistxattr = handle_llistxattr, |
| 709 | .lsetxattr = handle_lsetxattr, |
| 710 | .lremovexattr = handle_lremovexattr, |
| 711 | .name_to_path = handle_name_to_path, |
| 712 | .renameat = handle_renameat, |
| 713 | .unlinkat = handle_unlinkat, |
| 714 | }; |