Check-in [5ae034e55e]
Overview
Comment:A bit of work on reference counting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5ae034e55e8f81c846aa6eac723a438fa1a9befe83a7f016a0a4a10a00bc3d11
User & Date: rkeene on 2019-09-14 05:24:40
Other Links: manifest | tags
Context
2019-09-14
05:24
Comment out broken tests check-in: fa71466879 user: rkeene tags: trunk
05:24
A bit of work on reference counting check-in: 5ae034e55e user: rkeene tags: trunk
04:56
Added support for accessProc and mapped X_OK to directories check-in: 12ff77016f user: rkeene tags: trunk
Changes

Modified xvfs-core.c from [102d0f3049] to [7f58a650f6].

23
24
25
26
27
28
29

30
31
32
33
34
35
36




37




38
39
40
41
42
43
44
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
52







+







+
+
+
+
-
+
+
+
+







	Tcl_Obj            *mountpoint;
};

/*
 * Internal Core Utilities
 */
static const char *xvfs_relativePath(Tcl_Obj *path, struct xvfs_tclfs_instance_info *info) {
	Tcl_Obj *currentDirectory;
	const char *pathStr, *rootStr;
	const char *pathFinal;
	int pathLen, rootLen;

	rootStr = Tcl_GetStringFromObj(info->mountpoint, &rootLen);
	pathStr = Tcl_GetStringFromObj(path, &pathLen);
	if (pathStr[0] != '/') {
		currentDirectory = Tcl_FSGetCwd(NULL);
		Tcl_IncrRefCount(currentDirectory);

		/* XXX:TODO: Free this */
		path = Tcl_ObjPrintf("%s/%s", Tcl_GetString(Tcl_FSGetCwd(NULL)), pathStr);
		path = Tcl_ObjPrintf("%s/%s", Tcl_GetString(currentDirectory), pathStr);
		Tcl_IncrRefCount(path);
		Tcl_DecrRefCount(currentDirectory);

		pathStr = Tcl_GetStringFromObj(path, &pathLen);
	}

	if (pathLen < rootLen) {
		return(NULL);
	}

537
538
539
540
541
542
543
544
545

546
547
548
549
550
551
552
545
546
547
548
549
550
551

552
553
554
555
556
557
558
559
560







-

+







		child = children[idx];

		if (!Tcl_StringMatch(child, pattern)) {
			continue;
		}

		childObj = Tcl_DuplicateObj(path);
		Tcl_AppendStringsToObj(childObj, "/", child, NULL);
		Tcl_IncrRefCount(childObj);
		Tcl_AppendStringsToObj(childObj, "/", child, NULL);

		if (!xvfs_tclfs_verifyType(childObj, types, instanceInfo)) {
			Tcl_DecrRefCount(childObj);

			continue;
		}

658
659
660
661
662
663
664


665
666

667
668


669
670
671
672
673
674
675
666
667
668
669
670
671
672
673
674
675

676
677
678
679
680
681
682
683
684
685
686
687







+
+

-
+


+
+







	xvfs_tclfs_standalone_fs.lstatProc                  = NULL;
	xvfs_tclfs_standalone_fs.loadFileProc               = NULL;
	xvfs_tclfs_standalone_fs.getCwdProc                 = NULL;
	xvfs_tclfs_standalone_fs.chdirProc                  = NULL;

	xvfs_tclfs_standalone_info.fsInfo = fsInfo;
	xvfs_tclfs_standalone_info.mountpoint = Tcl_NewObj();

	Tcl_IncrRefCount(xvfs_tclfs_standalone_info.mountpoint);
	Tcl_AppendStringsToObj(xvfs_tclfs_standalone_info.mountpoint, XVFS_ROOT_MOUNTPOINT, fsInfo->name, NULL);

	
	tcl_ret = Tcl_FSRegister(NULL, &xvfs_tclfs_standalone_fs);
	if (tcl_ret != TCL_OK) {
		Tcl_DecrRefCount(xvfs_tclfs_standalone_info.mountpoint);

		if (interp) {
			Tcl_SetResult(interp, "Tcl_FSRegister() failed", NULL);
		}

		return(tcl_ret);
	}