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