181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
return(tcl_ret);
}
return(TCL_OK);
}
#endif
#if defined(XVFS_MODE_FLEXIBLE)
#include <dlfcn.h>
int xvfs_flexible_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
int (*xvfs_register)(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) = NULL;
/*
* XXX:TODO: Find some way to use Tcl_FindSymbol() to do this
*/
xvfs_register = dlsym(NULL, "Xvfs_Register");
if (!xvfs_register) {
xvfs_register = &xvfs_standalone_register;
}
return(xvfs_register(interp, fsInfo));
}
#endif
#if defined(XVFS_MODE_SERVER)
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
return(TCL_ERROR);
|
|
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
<
>
|
<
|
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
return(tcl_ret);
}
return(TCL_OK);
}
#endif
#if defined(XVFS_MODE_FLEXIBLE) || defined(XVFS_MODE_SERVER)
struct xvfs_tclfs_server_info {
char magic[XVFS_PROTOCOL_SERVER_MAGIC_LEN];
int (*registerProc)(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
};
#endif
#if defined(XVFS_MODE_FLEXIBLE)
int xvfs_flexible_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
ClientData fsHandlerDataRaw;
struct xvfs_tclfs_server_info *fsHandlerData;
const Tcl_Filesystem *fsHandler;
int (*xvfs_register)(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
Tcl_Obj *rootPathObj;
xvfs_register = &xvfs_standalone_register;
rootPathObj = Tcl_NewStringObj(XVFS_ROOT_MOUNTPOINT, -1);
if (!rootPathObj) {
return(xvfs_register(interp, fsInfo));
}
Tcl_IncrRefCount(rootPathObj);
fsHandler = Tcl_FSGetFileSystemForPath(rootPathObj);
Tcl_DecrRefCount(rootPathObj);
if (!fsHandler) {
return(xvfs_register(interp, fsInfo));
}
fsHandlerDataRaw = Tcl_FSData(fsHandler);
if (!fsHandlerDataRaw) {
return(xvfs_register(interp, fsInfo));
}
fsHandlerData = (struct xvfs_tclfs_server_info *) fsHandlerDataRaw;
/*
* XXX:TODO: What is the chance that the handler for //xvfs:/ hold
* client data smaller than XVFS_PROTOCOL_SERVER_MAGIC_LEN ?
*/
if (memcmp(fsHandlerData->magic, XVFS_PROTOCOL_SERVER_MAGIC, sizeof(fsHandlerData->magic)) == 0) {
xvfs_register = fsHandlerData->registerProc;
}
return(xvfs_register(interp, fsInfo));
}
#endif
#if defined(XVFS_MODE_SERVER)
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) {
return(TCL_ERROR);
|