virtio-9p.h (7a46274529c2a1866e4344b4385739db674d6a35) virtio-9p.h (541dc0d47f10973c241e9955afc2aefc96adec51)
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>
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#include <sys/resource.h>
9#include "hw/virtio.h"
10#include "fsdev/file-op-9p.h"
11
12/* The feature bitmap for virtio 9P */
13/* The mount point is specified in a config variable */
14#define VIRTIO_9P_MOUNT_TAG 0
15
16enum {

--- 80 unchanged lines hidden (view full) ---

97enum p9_proto_version {
98 V9FS_PROTO_2000U = 0x01,
99 V9FS_PROTO_2000L = 0x02,
100};
101
102#define P9_NOTAG (u16)(~0)
103#define P9_NOFID (u32)(~0)
104#define P9_MAXWELEM 16
8#include "hw/virtio.h"
9#include "fsdev/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
15enum {

--- 80 unchanged lines hidden (view full) ---

96enum p9_proto_version {
97 V9FS_PROTO_2000U = 0x01,
98 V9FS_PROTO_2000L = 0x02,
99};
100
101#define P9_NOTAG (u16)(~0)
102#define P9_NOFID (u32)(~0)
103#define P9_MAXWELEM 16
105
106#define FID_REFERENCED 0x1
107#define FID_NON_RECLAIMABLE 0x2
108static inline const char *rpath(FsContext *ctx, const char *path, char *buffer)
109{
110 snprintf(buffer, PATH_MAX, "%s/%s", ctx->fs_root, path);
111 return buffer;
112}
113
114/*
115 * ample room for Twrite/Rread header

--- 81 unchanged lines hidden (view full) ---

197} V9fsXattr;
198
199struct V9fsFidState
200{
201 int fid_type;
202 int32_t fid;
203 V9fsString path;
204 union {
104static inline const char *rpath(FsContext *ctx, const char *path, char *buffer)
105{
106 snprintf(buffer, PATH_MAX, "%s/%s", ctx->fs_root, path);
107 return buffer;
108}
109
110/*
111 * ample room for Twrite/Rread header

--- 81 unchanged lines hidden (view full) ---

193} V9fsXattr;
194
195struct V9fsFidState
196{
197 int fid_type;
198 int32_t fid;
199 V9fsString path;
200 union {
205 int fd;
206 DIR *dir;
207 V9fsXattr xattr;
201 int fd;
202 DIR *dir;
203 V9fsXattr xattr;
208 } fs;
204 } fs;
209 union {
210 int fd;
211 DIR *dir;
212 } fs_reclaim;
213 int flags;
214 int open_flags;
215 uid_t uid;
205 uid_t uid;
216 int ref;
217 int clunked;
218 V9fsFidState *next;
206 V9fsFidState *next;
219 V9fsFidState *rclm_lst;
220};
221
222typedef struct V9fsState
223{
224 VirtIODevice vdev;
225 VirtQueue *vq;
226 V9fsPDU pdus[MAX_REQ];
227 QLIST_HEAD(, V9fsPDU) free_list;

--- 94 unchanged lines hidden (view full) ---

322} V9fsIattr;
323
324struct virtio_9p_config
325{
326 /* number of characters in tag */
327 uint16_t tag_len;
328 /* Variable size tag name */
329 uint8_t tag[0];
207};
208
209typedef struct V9fsState
210{
211 VirtIODevice vdev;
212 VirtQueue *vq;
213 V9fsPDU pdus[MAX_REQ];
214 QLIST_HEAD(, V9fsPDU) free_list;

--- 94 unchanged lines hidden (view full) ---

309} V9fsIattr;
310
311struct virtio_9p_config
312{
313 /* number of characters in tag */
314 uint16_t tag_len;
315 /* Variable size tag name */
316 uint8_t tag[0];
330} __attribute__((packed));
317} QEMU_PACKED;
331
332typedef struct V9fsMkState {
333 V9fsPDU *pdu;
334 size_t offset;
335 V9fsQID qid;
336 struct stat stbuf;
337 V9fsString name;
338 V9fsString fullname;

--- 21 unchanged lines hidden (view full) ---

360{
361 uint8_t type;
362 uint64_t start; /* absolute offset */
363 uint64_t length;
364 uint32_t proc_id;
365 V9fsString client_id;
366} V9fsGetlock;
367
318
319typedef struct V9fsMkState {
320 V9fsPDU *pdu;
321 size_t offset;
322 V9fsQID qid;
323 struct stat stbuf;
324 V9fsString name;
325 V9fsString fullname;

--- 21 unchanged lines hidden (view full) ---

347{
348 uint8_t type;
349 uint64_t start; /* absolute offset */
350 uint64_t length;
351 uint32_t proc_id;
352 V9fsString client_id;
353} V9fsGetlock;
354
368extern int open_fd_hw;
369extern int total_open_fd;
370
371size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
372 size_t offset, size_t size, int pack);
373
374static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count,
375 size_t offset, size_t size)
376{
377 return pdu_packunpack(dst, sg, sg_count, offset, size, 0);
378}
379
380extern void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq);
355size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
356 size_t offset, size_t size, int pack);
357
358static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count,
359 size_t offset, size_t size)
360{
361 return pdu_packunpack(dst, sg, sg_count, offset, size, 0);
362}
363
364extern void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq);
381extern void virtio_9p_set_fd_limit(void);
382extern void v9fs_reclaim_fd(V9fsState *s);
383#endif
365#endif