Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 1 | #ifndef _QEMU_VIRTIO_9P_H |
| 2 | #define _QEMU_VIRTIO_9P_H |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | #include <dirent.h> |
| 6 | #include <sys/time.h> |
| 7 | #include <utime.h> |
| 8 | |
| 9 | #include "file-op-9p.h" |
| 10 | |
| 11 | /* The feature bitmap for virtio 9P */ |
| 12 | /* The mount point is specified in a config variable */ |
| 13 | #define VIRTIO_9P_MOUNT_TAG 0 |
| 14 | |
| 15 | enum { |
Arun R Bharadwaj | 8f4d1ca | 2010-07-28 14:10:22 +0530 | [diff] [blame] | 16 | P9_TLERROR = 6, |
| 17 | P9_RLERROR, |
M. Mohan Kumar | be940c8 | 2010-05-10 12:11:03 +0530 | [diff] [blame] | 18 | P9_TSTATFS = 8, |
| 19 | P9_RSTATFS, |
M. Mohan Kumar | 771e9d4 | 2010-06-22 19:47:04 +0530 | [diff] [blame] | 20 | P9_TLOPEN = 12, |
| 21 | P9_RLOPEN, |
Venkateswararao Jujjuri (JV) | c1568af | 2010-06-17 18:27:24 -0700 | [diff] [blame] | 22 | P9_TLCREATE = 14, |
| 23 | P9_RLCREATE, |
Venkateswararao Jujjuri (JV) | 08c60fc | 2010-06-09 14:02:08 -0700 | [diff] [blame] | 24 | P9_TSYMLINK = 16, |
| 25 | P9_RSYMLINK, |
M. Mohan Kumar | 5268cec | 2010-06-22 12:24:09 +0530 | [diff] [blame] | 26 | P9_TMKNOD = 18, |
| 27 | P9_RMKNOD, |
M. Mohan Kumar | c7b4b0b | 2010-06-22 12:29:41 +0530 | [diff] [blame] | 28 | P9_TRENAME = 20, |
| 29 | P9_RRENAME, |
M. Mohan Kumar | df0973a | 2010-09-14 15:08:25 +0530 | [diff] [blame] | 30 | P9_TREADLINK = 22, |
| 31 | P9_RREADLINK, |
Sripathi Kodi | 00ede4c | 2010-07-20 11:44:41 +0530 | [diff] [blame] | 32 | P9_TGETATTR = 24, |
| 33 | P9_RGETATTR, |
Sripathi Kodi | c79ce73 | 2010-06-17 18:18:47 +0530 | [diff] [blame] | 34 | P9_TSETATTR = 26, |
| 35 | P9_RSETATTR, |
Aneesh Kumar K.V | fa32ef8 | 2010-09-02 11:09:06 +0530 | [diff] [blame] | 36 | P9_TXATTRWALK = 30, |
| 37 | P9_RXATTRWALK, |
Aneesh Kumar K.V | 10b468b | 2010-09-02 11:09:07 +0530 | [diff] [blame] | 38 | P9_TXATTRCREATE = 32, |
| 39 | P9_RXATTRCREATE, |
Sripathi Kodi | c18e2f9 | 2010-06-09 14:57:57 +0530 | [diff] [blame] | 40 | P9_TREADDIR = 40, |
| 41 | P9_RREADDIR, |
Venkateswararao Jujjuri (JV) | b41e95d | 2010-09-22 17:18:33 -0700 | [diff] [blame] | 42 | P9_TFSYNC = 50, |
| 43 | P9_RFSYNC, |
M. Mohan Kumar | 82cc3ee | 2010-09-08 02:19:32 +0530 | [diff] [blame] | 44 | P9_TLOCK = 52, |
| 45 | P9_RLOCK, |
M. Mohan Kumar | 8f35400 | 2010-09-08 02:36:52 +0530 | [diff] [blame] | 46 | P9_TGETLOCK = 54, |
| 47 | P9_RGETLOCK, |
Venkateswararao Jujjuri (JV) | b2c224b | 2010-06-09 11:21:15 -0700 | [diff] [blame] | 48 | P9_TLINK = 70, |
| 49 | P9_RLINK, |
M. Mohan Kumar | b67592e | 2010-06-22 12:25:22 +0530 | [diff] [blame] | 50 | P9_TMKDIR = 72, |
| 51 | P9_RMKDIR, |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 52 | P9_TVERSION = 100, |
| 53 | P9_RVERSION, |
| 54 | P9_TAUTH = 102, |
| 55 | P9_RAUTH, |
| 56 | P9_TATTACH = 104, |
| 57 | P9_RATTACH, |
| 58 | P9_TERROR = 106, |
| 59 | P9_RERROR, |
| 60 | P9_TFLUSH = 108, |
| 61 | P9_RFLUSH, |
| 62 | P9_TWALK = 110, |
| 63 | P9_RWALK, |
| 64 | P9_TOPEN = 112, |
| 65 | P9_ROPEN, |
| 66 | P9_TCREATE = 114, |
| 67 | P9_RCREATE, |
| 68 | P9_TREAD = 116, |
| 69 | P9_RREAD, |
| 70 | P9_TWRITE = 118, |
| 71 | P9_RWRITE, |
| 72 | P9_TCLUNK = 120, |
| 73 | P9_RCLUNK, |
| 74 | P9_TREMOVE = 122, |
| 75 | P9_RREMOVE, |
| 76 | P9_TSTAT = 124, |
| 77 | P9_RSTAT, |
| 78 | P9_TWSTAT = 126, |
| 79 | P9_RWSTAT, |
| 80 | }; |
| 81 | |
| 82 | |
| 83 | /* qid.types */ |
| 84 | enum { |
| 85 | P9_QTDIR = 0x80, |
| 86 | P9_QTAPPEND = 0x40, |
| 87 | P9_QTEXCL = 0x20, |
| 88 | P9_QTMOUNT = 0x10, |
| 89 | P9_QTAUTH = 0x08, |
| 90 | P9_QTTMP = 0x04, |
| 91 | P9_QTSYMLINK = 0x02, |
| 92 | P9_QTLINK = 0x01, |
| 93 | P9_QTFILE = 0x00, |
| 94 | }; |
| 95 | |
M. Mohan Kumar | 8415151 | 2010-05-27 13:57:29 +0530 | [diff] [blame] | 96 | enum p9_proto_version { |
| 97 | V9FS_PROTO_2000U = 0x01, |
| 98 | V9FS_PROTO_2000L = 0x02, |
| 99 | }; |
| 100 | |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 101 | #define P9_NOTAG (u16)(~0) |
| 102 | #define P9_NOFID (u32)(~0) |
| 103 | #define P9_MAXWELEM 16 |
| 104 | |
M. Mohan Kumar | 5e94c10 | 2010-06-09 19:14:28 +0530 | [diff] [blame] | 105 | /* |
| 106 | * ample room for Twrite/Rread header |
| 107 | * size[4] Tread/Twrite tag[2] fid[4] offset[8] count[4] |
| 108 | */ |
| 109 | #define P9_IOHDRSZ 24 |
| 110 | |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 111 | typedef struct V9fsPDU V9fsPDU; |
| 112 | |
| 113 | struct V9fsPDU |
| 114 | { |
| 115 | uint32_t size; |
| 116 | uint16_t tag; |
| 117 | uint8_t id; |
| 118 | VirtQueueElement elem; |
| 119 | QLIST_ENTRY(V9fsPDU) next; |
| 120 | }; |
| 121 | |
| 122 | |
| 123 | /* FIXME |
| 124 | * 1) change user needs to set groups and stuff |
| 125 | */ |
| 126 | |
| 127 | /* from Linux's linux/virtio_9p.h */ |
| 128 | |
| 129 | /* The ID for virtio console */ |
| 130 | #define VIRTIO_ID_9P 9 |
| 131 | #define MAX_REQ 128 |
| 132 | #define MAX_TAG_LEN 32 |
| 133 | |
| 134 | #define BUG_ON(cond) assert(!(cond)) |
| 135 | |
| 136 | typedef struct V9fsFidState V9fsFidState; |
| 137 | |
| 138 | typedef struct V9fsString |
| 139 | { |
| 140 | int16_t size; |
| 141 | char *data; |
| 142 | } V9fsString; |
| 143 | |
| 144 | typedef struct V9fsQID |
| 145 | { |
| 146 | int8_t type; |
| 147 | int32_t version; |
| 148 | int64_t path; |
| 149 | } V9fsQID; |
| 150 | |
| 151 | typedef struct V9fsStat |
| 152 | { |
| 153 | int16_t size; |
| 154 | int16_t type; |
| 155 | int32_t dev; |
| 156 | V9fsQID qid; |
| 157 | int32_t mode; |
| 158 | int32_t atime; |
| 159 | int32_t mtime; |
| 160 | int64_t length; |
| 161 | V9fsString name; |
| 162 | V9fsString uid; |
| 163 | V9fsString gid; |
| 164 | V9fsString muid; |
| 165 | /* 9p2000.u */ |
| 166 | V9fsString extension; |
| 167 | int32_t n_uid; |
| 168 | int32_t n_gid; |
| 169 | int32_t n_muid; |
| 170 | } V9fsStat; |
| 171 | |
Aneesh Kumar K.V | d62dbb5 | 2010-09-02 11:09:06 +0530 | [diff] [blame] | 172 | enum { |
| 173 | P9_FID_NONE = 0, |
| 174 | P9_FID_FILE, |
| 175 | P9_FID_DIR, |
| 176 | P9_FID_XATTR, |
| 177 | }; |
| 178 | |
| 179 | typedef struct V9fsXattr |
| 180 | { |
| 181 | int64_t copied_len; |
| 182 | int64_t len; |
| 183 | void *value; |
| 184 | V9fsString name; |
| 185 | int flags; |
| 186 | } V9fsXattr; |
| 187 | |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 188 | struct V9fsFidState |
| 189 | { |
Aneesh Kumar K.V | d62dbb5 | 2010-09-02 11:09:06 +0530 | [diff] [blame] | 190 | int fid_type; |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 191 | int32_t fid; |
| 192 | V9fsString path; |
Aneesh Kumar K.V | d62dbb5 | 2010-09-02 11:09:06 +0530 | [diff] [blame] | 193 | union { |
| 194 | int fd; |
| 195 | DIR *dir; |
| 196 | V9fsXattr xattr; |
| 197 | } fs; |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 198 | uid_t uid; |
| 199 | V9fsFidState *next; |
| 200 | }; |
| 201 | |
| 202 | typedef struct V9fsState |
| 203 | { |
| 204 | VirtIODevice vdev; |
| 205 | VirtQueue *vq; |
| 206 | V9fsPDU pdus[MAX_REQ]; |
| 207 | QLIST_HEAD(, V9fsPDU) free_list; |
| 208 | V9fsFidState *fid_list; |
| 209 | FileOperations *ops; |
| 210 | FsContext ctx; |
| 211 | uint16_t tag_len; |
| 212 | uint8_t *tag; |
| 213 | size_t config_size; |
M. Mohan Kumar | 8415151 | 2010-05-27 13:57:29 +0530 | [diff] [blame] | 214 | enum p9_proto_version proto_version; |
M. Mohan Kumar | 5e94c10 | 2010-06-09 19:14:28 +0530 | [diff] [blame] | 215 | int32_t msize; |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 216 | } V9fsState; |
| 217 | |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 218 | typedef struct V9fsCreateState { |
| 219 | V9fsPDU *pdu; |
| 220 | size_t offset; |
| 221 | V9fsFidState *fidp; |
| 222 | V9fsQID qid; |
| 223 | int32_t perm; |
| 224 | int8_t mode; |
| 225 | struct stat stbuf; |
| 226 | V9fsString name; |
| 227 | V9fsString extension; |
| 228 | V9fsString fullname; |
M. Mohan Kumar | 5e94c10 | 2010-06-09 19:14:28 +0530 | [diff] [blame] | 229 | int iounit; |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 230 | } V9fsCreateState; |
| 231 | |
Venkateswararao Jujjuri (JV) | c1568af | 2010-06-17 18:27:24 -0700 | [diff] [blame] | 232 | typedef struct V9fsLcreateState { |
| 233 | V9fsPDU *pdu; |
| 234 | size_t offset; |
| 235 | V9fsFidState *fidp; |
| 236 | V9fsQID qid; |
| 237 | int32_t iounit; |
| 238 | struct stat stbuf; |
| 239 | V9fsString name; |
| 240 | V9fsString fullname; |
| 241 | } V9fsLcreateState; |
| 242 | |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 243 | typedef struct V9fsStatState { |
| 244 | V9fsPDU *pdu; |
| 245 | size_t offset; |
| 246 | V9fsStat v9stat; |
| 247 | V9fsFidState *fidp; |
| 248 | struct stat stbuf; |
| 249 | } V9fsStatState; |
| 250 | |
Sripathi Kodi | 00ede4c | 2010-07-20 11:44:41 +0530 | [diff] [blame] | 251 | typedef struct V9fsStatDotl { |
| 252 | uint64_t st_result_mask; |
| 253 | V9fsQID qid; |
| 254 | uint32_t st_mode; |
| 255 | uint32_t st_uid; |
| 256 | uint32_t st_gid; |
| 257 | uint64_t st_nlink; |
| 258 | uint64_t st_rdev; |
| 259 | uint64_t st_size; |
| 260 | uint64_t st_blksize; |
| 261 | uint64_t st_blocks; |
| 262 | uint64_t st_atime_sec; |
| 263 | uint64_t st_atime_nsec; |
| 264 | uint64_t st_mtime_sec; |
| 265 | uint64_t st_mtime_nsec; |
| 266 | uint64_t st_ctime_sec; |
| 267 | uint64_t st_ctime_nsec; |
| 268 | uint64_t st_btime_sec; |
| 269 | uint64_t st_btime_nsec; |
| 270 | uint64_t st_gen; |
| 271 | uint64_t st_data_version; |
| 272 | } V9fsStatDotl; |
| 273 | |
| 274 | typedef struct V9fsStatStateDotl { |
| 275 | V9fsPDU *pdu; |
| 276 | size_t offset; |
| 277 | V9fsStatDotl v9stat_dotl; |
| 278 | struct stat stbuf; |
| 279 | } V9fsStatStateDotl; |
| 280 | |
| 281 | |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 282 | typedef struct V9fsWalkState { |
| 283 | V9fsPDU *pdu; |
| 284 | size_t offset; |
| 285 | int16_t nwnames; |
| 286 | int name_idx; |
| 287 | V9fsQID *qids; |
| 288 | V9fsFidState *fidp; |
| 289 | V9fsFidState *newfidp; |
| 290 | V9fsString path; |
| 291 | V9fsString *wnames; |
| 292 | struct stat stbuf; |
| 293 | } V9fsWalkState; |
| 294 | |
| 295 | typedef struct V9fsOpenState { |
| 296 | V9fsPDU *pdu; |
| 297 | size_t offset; |
M. Mohan Kumar | 771e9d4 | 2010-06-22 19:47:04 +0530 | [diff] [blame] | 298 | int32_t mode; |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 299 | V9fsFidState *fidp; |
| 300 | V9fsQID qid; |
| 301 | struct stat stbuf; |
M. Mohan Kumar | 5e94c10 | 2010-06-09 19:14:28 +0530 | [diff] [blame] | 302 | int iounit; |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 303 | } V9fsOpenState; |
| 304 | |
| 305 | typedef struct V9fsReadState { |
| 306 | V9fsPDU *pdu; |
| 307 | size_t offset; |
| 308 | int32_t count; |
| 309 | int32_t total; |
| 310 | int64_t off; |
| 311 | V9fsFidState *fidp; |
| 312 | struct iovec iov[128]; /* FIXME: bad, bad, bad */ |
| 313 | struct iovec *sg; |
| 314 | off_t dir_pos; |
| 315 | struct dirent *dent; |
| 316 | struct stat stbuf; |
| 317 | V9fsString name; |
| 318 | V9fsStat v9stat; |
| 319 | int32_t len; |
| 320 | int32_t cnt; |
| 321 | int32_t max_count; |
| 322 | } V9fsReadState; |
| 323 | |
| 324 | typedef struct V9fsWriteState { |
| 325 | V9fsPDU *pdu; |
| 326 | size_t offset; |
| 327 | int32_t len; |
| 328 | int32_t count; |
| 329 | int32_t total; |
| 330 | int64_t off; |
| 331 | V9fsFidState *fidp; |
| 332 | struct iovec iov[128]; /* FIXME: bad, bad, bad */ |
| 333 | struct iovec *sg; |
| 334 | int cnt; |
| 335 | } V9fsWriteState; |
| 336 | |
| 337 | typedef struct V9fsRemoveState { |
| 338 | V9fsPDU *pdu; |
| 339 | size_t offset; |
| 340 | V9fsFidState *fidp; |
| 341 | } V9fsRemoveState; |
| 342 | |
| 343 | typedef struct V9fsWstatState |
| 344 | { |
| 345 | V9fsPDU *pdu; |
| 346 | size_t offset; |
| 347 | int16_t unused; |
| 348 | V9fsStat v9stat; |
| 349 | V9fsFidState *fidp; |
| 350 | struct stat stbuf; |
Venkateswararao Jujjuri (JV) | fac4f11 | 2010-06-01 13:30:51 -0700 | [diff] [blame] | 351 | } V9fsWstatState; |
| 352 | |
Venkateswararao Jujjuri (JV) | 08c60fc | 2010-06-09 14:02:08 -0700 | [diff] [blame] | 353 | typedef struct V9fsSymlinkState |
| 354 | { |
| 355 | V9fsPDU *pdu; |
| 356 | size_t offset; |
| 357 | V9fsString name; |
| 358 | V9fsString symname; |
| 359 | V9fsString fullname; |
| 360 | V9fsFidState *dfidp; |
| 361 | V9fsQID qid; |
| 362 | struct stat stbuf; |
| 363 | } V9fsSymlinkState; |
| 364 | |
Sripathi Kodi | c79ce73 | 2010-06-17 18:18:47 +0530 | [diff] [blame] | 365 | typedef struct V9fsIattr |
| 366 | { |
| 367 | int32_t valid; |
| 368 | int32_t mode; |
| 369 | int32_t uid; |
| 370 | int32_t gid; |
| 371 | int64_t size; |
| 372 | int64_t atime_sec; |
| 373 | int64_t atime_nsec; |
| 374 | int64_t mtime_sec; |
| 375 | int64_t mtime_nsec; |
| 376 | } V9fsIattr; |
| 377 | |
| 378 | typedef struct V9fsSetattrState |
| 379 | { |
| 380 | V9fsPDU *pdu; |
| 381 | size_t offset; |
| 382 | V9fsIattr v9iattr; |
| 383 | V9fsFidState *fidp; |
| 384 | } V9fsSetattrState; |
| 385 | |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 386 | struct virtio_9p_config |
| 387 | { |
| 388 | /* number of characters in tag */ |
| 389 | uint16_t tag_len; |
| 390 | /* Variable size tag name */ |
| 391 | uint8_t tag[0]; |
| 392 | } __attribute__((packed)); |
| 393 | |
M. Mohan Kumar | be940c8 | 2010-05-10 12:11:03 +0530 | [diff] [blame] | 394 | typedef struct V9fsStatfs |
| 395 | { |
| 396 | uint32_t f_type; |
| 397 | uint32_t f_bsize; |
| 398 | uint64_t f_blocks; |
| 399 | uint64_t f_bfree; |
| 400 | uint64_t f_bavail; |
| 401 | uint64_t f_files; |
| 402 | uint64_t f_ffree; |
| 403 | uint64_t fsid_val; |
| 404 | uint32_t f_namelen; |
| 405 | } V9fsStatfs; |
| 406 | |
| 407 | typedef struct V9fsStatfsState { |
| 408 | V9fsPDU *pdu; |
| 409 | size_t offset; |
| 410 | int32_t fid; |
| 411 | V9fsStatfs v9statfs; |
| 412 | V9fsFidState *fidp; |
| 413 | struct statfs stbuf; |
| 414 | } V9fsStatfsState; |
| 415 | |
M. Mohan Kumar | 5268cec | 2010-06-22 12:24:09 +0530 | [diff] [blame] | 416 | typedef struct V9fsMkState { |
| 417 | V9fsPDU *pdu; |
| 418 | size_t offset; |
| 419 | V9fsQID qid; |
| 420 | struct stat stbuf; |
| 421 | V9fsString name; |
| 422 | V9fsString fullname; |
| 423 | } V9fsMkState; |
| 424 | |
M. Mohan Kumar | c7b4b0b | 2010-06-22 12:29:41 +0530 | [diff] [blame] | 425 | typedef struct V9fsRenameState { |
| 426 | V9fsPDU *pdu; |
| 427 | V9fsFidState *fidp; |
| 428 | size_t offset; |
| 429 | int32_t newdirfid; |
| 430 | V9fsString name; |
| 431 | } V9fsRenameState; |
| 432 | |
Aneesh Kumar K.V | fa32ef8 | 2010-09-02 11:09:06 +0530 | [diff] [blame] | 433 | typedef struct V9fsXattrState |
| 434 | { |
| 435 | V9fsPDU *pdu; |
| 436 | size_t offset; |
| 437 | V9fsFidState *file_fidp; |
| 438 | V9fsFidState *xattr_fidp; |
| 439 | V9fsString name; |
| 440 | int64_t size; |
| 441 | int flags; |
| 442 | void *value; |
| 443 | } V9fsXattrState; |
| 444 | |
M. Mohan Kumar | 82cc3ee | 2010-09-08 02:19:32 +0530 | [diff] [blame] | 445 | #define P9_LOCK_SUCCESS 0 |
| 446 | #define P9_LOCK_BLOCKED 1 |
| 447 | #define P9_LOCK_ERROR 2 |
| 448 | #define P9_LOCK_GRACE 3 |
| 449 | |
| 450 | #define P9_LOCK_FLAGS_BLOCK 1 |
| 451 | #define P9_LOCK_FLAGS_RECLAIM 2 |
| 452 | |
| 453 | typedef struct V9fsFlock |
| 454 | { |
| 455 | uint8_t type; |
| 456 | uint32_t flags; |
| 457 | uint64_t start; /* absolute offset */ |
| 458 | uint64_t length; |
| 459 | uint32_t proc_id; |
| 460 | V9fsString client_id; |
| 461 | } V9fsFlock; |
| 462 | |
| 463 | typedef struct V9fsLockState |
| 464 | { |
| 465 | V9fsPDU *pdu; |
| 466 | size_t offset; |
| 467 | int8_t status; |
| 468 | struct stat stbuf; |
| 469 | V9fsFidState *fidp; |
| 470 | V9fsFlock *flock; |
| 471 | } V9fsLockState; |
| 472 | |
M. Mohan Kumar | 8f35400 | 2010-09-08 02:36:52 +0530 | [diff] [blame] | 473 | typedef struct V9fsGetlock |
| 474 | { |
| 475 | uint8_t type; |
| 476 | uint64_t start; /* absolute offset */ |
| 477 | uint64_t length; |
| 478 | uint32_t proc_id; |
| 479 | V9fsString client_id; |
| 480 | } V9fsGetlock; |
| 481 | |
| 482 | typedef struct V9fsGetlockState |
| 483 | { |
| 484 | V9fsPDU *pdu; |
| 485 | size_t offset; |
| 486 | struct stat stbuf; |
| 487 | V9fsFidState *fidp; |
| 488 | V9fsGetlock *glock; |
| 489 | } V9fsGetlockState; |
| 490 | |
M. Mohan Kumar | df0973a | 2010-09-14 15:08:25 +0530 | [diff] [blame] | 491 | typedef struct V9fsReadLinkState |
| 492 | { |
| 493 | V9fsPDU *pdu; |
| 494 | size_t offset; |
| 495 | V9fsString target; |
| 496 | } V9fsReadLinkState; |
M. Mohan Kumar | 8f35400 | 2010-09-08 02:36:52 +0530 | [diff] [blame] | 497 | |
Blue Swirl | 64b85a8 | 2011-01-23 16:21:20 +0000 | [diff] [blame] | 498 | size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count, |
| 499 | size_t offset, size_t size, int pack); |
Anthony Liguori | 9f10751 | 2010-04-29 17:44:44 +0530 | [diff] [blame] | 500 | |
| 501 | static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count, |
| 502 | size_t offset, size_t size) |
| 503 | { |
| 504 | return pdu_packunpack(dst, sg, sg_count, offset, size, 0); |
| 505 | } |
| 506 | |
| 507 | #endif |