1364031f1SWei Liu /* 2364031f1SWei Liu * 9p 3364031f1SWei Liu * 4364031f1SWei Liu * Copyright IBM, Corp. 2011 5364031f1SWei Liu * 6364031f1SWei Liu * Authors: 7364031f1SWei Liu * Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 8364031f1SWei Liu * 9364031f1SWei Liu * This work is licensed under the terms of the GNU GPL, version 2. See 10364031f1SWei Liu * the COPYING file in the top-level directory. 11364031f1SWei Liu * 12364031f1SWei Liu */ 13364031f1SWei Liu 14121d0712SMarkus Armbruster #ifndef QEMU_9P_SYNTH_H 15121d0712SMarkus Armbruster #define QEMU_9P_SYNTH_H 16364031f1SWei Liu 17364031f1SWei Liu typedef struct V9fsSynthNode V9fsSynthNode; 18364031f1SWei Liu typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset, 19364031f1SWei Liu void *arg); 20364031f1SWei Liu typedef ssize_t (*v9fs_synth_write)(void *buf, int len, off_t offset, 21364031f1SWei Liu void *arg); 22364031f1SWei Liu typedef struct V9fsSynthNodeAttr { 23364031f1SWei Liu int mode; 24364031f1SWei Liu int inode; 25364031f1SWei Liu int nlink; 26364031f1SWei Liu v9fs_synth_read read; 27364031f1SWei Liu v9fs_synth_write write; 28364031f1SWei Liu } V9fsSynthNodeAttr; 29364031f1SWei Liu 30364031f1SWei Liu struct V9fsSynthNode { 31364031f1SWei Liu QLIST_HEAD(, V9fsSynthNode) child; 32364031f1SWei Liu QLIST_ENTRY(V9fsSynthNode) sibling; 33364031f1SWei Liu char name[NAME_MAX]; 34364031f1SWei Liu V9fsSynthNodeAttr *attr; 35364031f1SWei Liu V9fsSynthNodeAttr actual_attr; 36364031f1SWei Liu void *private; 37364031f1SWei Liu int open_count; 38364031f1SWei Liu }; 39364031f1SWei Liu 40364031f1SWei Liu typedef struct V9fsSynthOpenState { 41364031f1SWei Liu off_t offset; 42364031f1SWei Liu V9fsSynthNode *node; 43635324e8SGreg Kurz struct dirent dent; 44364031f1SWei Liu } V9fsSynthOpenState; 45364031f1SWei Liu 46bc70a592SGreg Kurz int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode, 47364031f1SWei Liu const char *name, V9fsSynthNode **result); 48bc70a592SGreg Kurz int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode, 49364031f1SWei Liu const char *name, v9fs_synth_read read, 50364031f1SWei Liu v9fs_synth_write write, void *arg); 51364031f1SWei Liu 522893ddd5SGreg Kurz /* qtest stuff */ 532893ddd5SGreg Kurz 542893ddd5SGreg Kurz #define QTEST_V9FS_SYNTH_WALK_FILE "WALK%d" 55*82469aaeSGreg Kurz #define QTEST_V9FS_SYNTH_LOPEN_FILE "LOPEN" 562893ddd5SGreg Kurz 57364031f1SWei Liu #endif 58