Lines of
xvfs-core.h
from check-in 149aa89b7d
that are changed by the sequence of edits moving toward
check-in 5583d77f1c:
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:
35: #define XVFS_REGISTER_INTERFACE(name) int name(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
36:
37: #if defined(XVFS_MODE_STANDALONE)
38: /*
39: * In standalone mode, we just redefine calls to
40: * Xvfs_Register() to go to the xvfs_standalone_register()
41: * function
42: */
43: # define Xvfs_Register xvfs_standalone_register
44: static XVFS_REGISTER_INTERFACE(Xvfs_Register)
45:
46: #elif defined(XVFS_MODE_FLEXIBLE)
47: /*
48: * In flexible mode, we just redefine calls to
49: * Xvfs_Register() to go to the xvfs_flexible_register()
50: * function which will either dispatch to a common
51: * core XVFS or use the xvfs_standalone_register()
52: * function as a standalone would.
53: */
54: # define Xvfs_Register xvfs_flexible_register
55: static XVFS_REGISTER_INTERFACE(Xvfs_Register)
56:
57: #elif defined(XVFS_MODE_CLIENT)
58: /*
59: * In client mode we declare an external symbol named
60: * Xvfs_Register() that must be provided by the environment
61: * we are loaded into
62: */
63: extern XVFS_REGISTER_INTERFACE(Xvfs_Register)
64:
65: #elif defined(XVFS_MODE_SERVER)
66: /*
67: * In server mode we are going to implementing Xvfs_Register()
68: * for flexible/client modes, just forward declare it
69: */
70: XVFS_REGISTER_INTERFACE(Xvfs_Register)
71:
72: #else
73: # error Unsupported XVFS_MODE
74: #endif
75:
76: /*
77: * In flexible or standalone mode, directly include what
78: * would otherwise be a separate translation unit, to
79: * avoid symbols leaking
80: */
81: #if defined(XVFS_MODE_FLEXIBLE) || defined(XVFS_MODE_STANDALONE)
82: #include <xvfs-core.c>
83: #endif
84:
85: #endif