1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <xvfs-core.h>
#include <string.h>
#include <tcl.h>
#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"
struct xvfs_tclfs_instance_info {
struct Xvfs_FSInfo *fsInfo;
Tcl_Obj *mountpoint;
};
static struct xvfs_tclfs_instance_info xvfs_tclfs_standalone_info;
/*
* Internal Core Utilities
*/
static const char *xvfs_relativePath(Tcl_Obj *path, struct xvfs_tclfs_instance_info *info) {
const char *pathStr, *rootStr;
int pathLen, rootLen;
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include <xvfs-core.h>
#include <string.h>
#include <tcl.h>
#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"
struct xvfs_tclfs_instance_info {
struct Xvfs_FSInfo *fsInfo;
Tcl_Obj *mountpoint;
};
/*
* Internal Core Utilities
*/
static const char *xvfs_relativePath(Tcl_Obj *path, struct xvfs_tclfs_instance_info *info) {
const char *pathStr, *rootStr;
int pathLen, rootLen;
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
pathStr = xvfs_relativePath(path, instanceInfo);
fprintf(stderr, "Called open(%s)!\n", pathStr);
return(NULL);
}
/*
* Tcl_Filesystem handlers for the standalone implementation
*/
static int xvfs_tclfs_standalone_pathInFilesystem(Tcl_Obj *path, ClientData *dataPtr) {
return(xvfs_tclfs_pathInFilesystem(path, dataPtr, &xvfs_tclfs_standalone_info));
}
static int xvfs_tclfs_standalone_stat(Tcl_Obj *path, Tcl_StatBuf *statBuf) {
return(xvfs_tclfs_stat(path, statBuf, &xvfs_tclfs_standalone_info));
}
|
>
>
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
pathStr = xvfs_relativePath(path, instanceInfo);
fprintf(stderr, "Called open(%s)!\n", pathStr);
return(NULL);
}
#if XVFS_MODE == standalone
/*
* Tcl_Filesystem handlers for the standalone implementation
*/
static struct xvfs_tclfs_instance_info xvfs_tclfs_standalone_info;
static int xvfs_tclfs_standalone_pathInFilesystem(Tcl_Obj *path, ClientData *dataPtr) {
return(xvfs_tclfs_pathInFilesystem(path, dataPtr, &xvfs_tclfs_standalone_info));
}
static int xvfs_tclfs_standalone_stat(Tcl_Obj *path, Tcl_StatBuf *statBuf) {
return(xvfs_tclfs_stat(path, statBuf, &xvfs_tclfs_standalone_info));
}
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
* then dispatches to the appropriate registered
* handler
* 3. flexible -- Attempts to find a core Xvfs instance for the
* process at runtime, if found do #2, otherwise
* fallback to #1
*
*/
static int xvfs_standalone_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
Tcl_Filesystem *xvfs_tclfs_Info;
int tcl_ret;
static int registered = 0;
/*
* Ensure this instance is not already registered
*/
|
|
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
* then dispatches to the appropriate registered
* handler
* 3. flexible -- Attempts to find a core Xvfs instance for the
* process at runtime, if found do #2, otherwise
* fallback to #1
*
*/
int xvfs_standalone_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
Tcl_Filesystem *xvfs_tclfs_Info;
int tcl_ret;
static int registered = 0;
/*
* Ensure this instance is not already registered
*/
|
185
186
187
188
189
190
191
192
193
194
195
|
}
return(tcl_ret);
}
return(TCL_OK);
}
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
return(xvfs_standalone_register(interp, fsInfo));
}
|
|
|
>
|
186
187
188
189
190
191
192
193
194
195
196
197
|
}
return(tcl_ret);
}
return(TCL_OK);
}
#else
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
return(TCL_ERROR);
}
#endif
|