Lines of
xvfs-core.h
from check-in 5583d77f1c
that are changed by the sequence of edits moving toward
check-in 10f67b2ced:
1: #ifndef XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
2: #define XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1
3:
4: #include <tcl.h>
5:
6: #define XVFS_PROTOCOL_VERSION 1
7:
8: typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt *count);
9: typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt *length);
10: typedef int (*xvfs_proc_getStat_t)(const char *path, Tcl_StatBuf *statBuf);
11:
12: /*
13: * Interface for the filesystem to fill out before registering.
14: * The protocolVersion is provided first so that if this
15: * needs to change over time it can be appropriately handled.
16: */
17: struct Xvfs_FSInfo {
18: int protocolVersion;
19: const char *name;
20: xvfs_proc_getChildren_t getChildrenProc;
21: xvfs_proc_getData_t getDataProc;
22: xvfs_proc_getStat_t getStatProc;
23: };
24:
25: /*
26: * Error codes for various calls. This is part of the ABI and must
27: * not be changed.
28: */
29: #define XVFS_RV_ERR_ENOENT (-8192)
30: #define XVFS_RV_ERR_EINVAL (-8193)
31: #define XVFS_RV_ERR_EISDIR (-8194)
32: #define XVFS_RV_ERR_ENOTDIR (-8195)
33: #define XVFS_RV_ERR_EFAULT (-8196)
34: #define XVFS_RV_ERR_INTERNAL (-16383)
35:
36: #define XVFS_REGISTER_INTERFACE(name) int name(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
37:
38: #if defined(XVFS_MODE_STANDALONE)
39: /*
40: * In standalone mode, we just redefine calls to
41: * Xvfs_Register() to go to the xvfs_standalone_register()
42: * function
43: */
44: # define Xvfs_Register xvfs_standalone_register
45: static XVFS_REGISTER_INTERFACE(Xvfs_Register)
46:
47: #elif defined(XVFS_MODE_FLEXIBLE)
48: /*
49: * In flexible mode, we just redefine calls to
50: * Xvfs_Register() to go to the xvfs_flexible_register()
51: * function which will either dispatch to a common
52: * core XVFS or use the xvfs_standalone_register()
53: * function as a standalone would.
54: */
55: # define Xvfs_Register xvfs_flexible_register
56: static XVFS_REGISTER_INTERFACE(Xvfs_Register)
57:
58: #elif defined(XVFS_MODE_CLIENT)
59: /*
60: * In client mode we declare an external symbol named
61: * Xvfs_Register() that must be provided by the environment
62: * we are loaded into
63: */
64: extern XVFS_REGISTER_INTERFACE(Xvfs_Register)
65:
66: #elif defined(XVFS_MODE_SERVER)
67: /*
68: * In server mode we are going to implementing Xvfs_Register()
69: * for flexible/client modes, just forward declare it
70: */
71: XVFS_REGISTER_INTERFACE(Xvfs_Register)
72:
73: #else
74: # error Unsupported XVFS_MODE
75: #endif
76:
77: /*
78: * In flexible or standalone mode, directly include what
79: * would otherwise be a separate translation unit, to
80: * avoid symbols leaking
81: */
82: #if defined(XVFS_MODE_FLEXIBLE) || defined(XVFS_MODE_STANDALONE)
83: #include <xvfs-core.c>
84: #endif
85:
86: #endif