27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
+
-
+
+
|
struct xvfs_tclfs_server_info {
char magic[XVFS_INTERNAL_SERVER_MAGIC_LEN];
int (*registerProc)(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
};
#endif /* XVFS_MODE_FLEXIBLE || XVFS_MODE_SERVER */
#if defined(XVFS_MODE_SERVER) || defined(XVFS_MODE_STANDALONE) || defined(XVFS_MODE_FLEXIBLE)
#ifndef XVFS_ROOT_MOUNTPOINT
#define XVFS_ROOT_MOUNTPOINT "//xvfs:/"
# define XVFS_ROOT_MOUNTPOINT "//xvfs:/"
#endif
struct xvfs_tclfs_instance_info {
struct Xvfs_FSInfo *fsInfo;
Tcl_Obj *mountpoint;
};
/*
|
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
|
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
|
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
static int xvfs_tclfs_dispatch_pathInFS(Tcl_Obj *path, ClientData *dataPtr) {
const char *pathStr, *rootStr;
int pathLen, rootLen;
XVFS_DEBUG_ENTER;
XVFS_DEBUG_PRINTF("Verifying that \"%s\" belongs in XVFS ...", Tcl_GetString(path));
path = xvfs_absolutePath(path);
rootStr = XVFS_ROOT_MOUNTPOINT;
rootLen = strlen(XVFS_ROOT_MOUNTPOINT);
pathStr = Tcl_GetStringFromObj(path, &pathLen);
if (pathLen < rootLen) {
Tcl_DecrRefCount(path);
XVFS_DEBUG_PUTS("... failed (length too short)");
XVFS_DEBUG_LEAVE;
return(-1);
}
if (memcmp(pathStr, rootStr, rootLen) != 0) {
Tcl_DecrRefCount(path);
XVFS_DEBUG_PUTS("... failed (incorrect prefix)");
XVFS_DEBUG_LEAVE;
return(-1);
}
Tcl_DecrRefCount(path);
XVFS_DEBUG_PUTS("... yes");
XVFS_DEBUG_LEAVE;
return(TCL_OK);
}
static struct xvfs_tclfs_instance_info *xvfs_tclfs_dispatch_pathToInfo(Tcl_Obj *path) {
Tcl_HashEntry *mapEntry;
struct xvfs_tclfs_instance_info *retval;
int rootLen;
char *pathStr, *fsName, *fsNameEnds, origSep;
XVFS_DEBUG_ENTER;
path = xvfs_absolutePath(path);
if (xvfs_tclfs_dispatch_pathInFS(path, NULL) != TCL_OK) {
Tcl_DecrRefCount(path);
XVFS_DEBUG_LEAVE;
return(NULL);
}
rootLen = strlen(XVFS_ROOT_MOUNTPOINT);
pathStr = Tcl_GetString(path);
|
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
|
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
|
+
+
|
if (mapEntry) {
retval = (struct xvfs_tclfs_instance_info *) Tcl_GetHashValue(mapEntry);
XVFS_DEBUG_PRINTF("... found a registered filesystem: %p", retval);
} else {
retval = NULL;
XVFS_DEBUG_PUTS("... found no registered filesystem.");
}
Tcl_DecrRefCount(path);
XVFS_DEBUG_LEAVE;
return(retval);
/*
* UNREACH: We do no need the more specific check because we
* claim everything under the root, but we want to suppress
|