Skip to content

Commit

Permalink
Fix unmounting volume via vfs::unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
chpock committed May 29, 2024
1 parent ae513fa commit 4589c3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2024-05-29 Konstantin Kushnir <[email protected]>
* Fix a regression when register volume and unregister with vfs::unmount

2024-05-28 Konstantin Kushnir <[email protected]>
* Add cppcheck

Expand Down
6 changes: 4 additions & 2 deletions generic/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ void Cookfs_VfsUnregisterInTclvfs(Cookfs_Vfs *vfs) {
objv[1] = vfs->mountObj;
Tcl_Obj *cmd = Tcl_NewListObj(2, objv);
Tcl_IncrRefCount(cmd);
CookfsLog(printf("Cookfs_VfsUnregisterInTclvfs: call tclvfs..."));
CookfsLog(printf("Cookfs_VfsUnregisterInTclvfs: call tclvfs: [%s]",
Tcl_GetString(cmd)));
int ret = Tcl_EvalObjEx(vfs->interp, cmd, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
Tcl_DecrRefCount(cmd);
CookfsLog(printf("Cookfs_VfsUnregisterInTclvfs: tclvfs returned: %d",
Expand Down Expand Up @@ -249,7 +250,8 @@ int Cookfs_VfsRegisterInTclvfs(Cookfs_Vfs *vfs) {
Tcl_Obj *cmd = Tcl_NewListObj(3, objv);

Tcl_IncrRefCount(cmd);
CookfsLog(printf("Cookfs_VfsRegisterInTclvfs: call tclvfs..."));
CookfsLog(printf("Cookfs_VfsRegisterInTclvfs: call tclvfs: [%s]",
Tcl_GetString(cmd)));
int ret = Tcl_EvalObjEx(vfs->interp, cmd, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
Tcl_DecrRefCount(cmd);
CookfsLog(printf("Cookfs_VfsRegisterInTclvfs: tclvfs returned: %d",
Expand Down
15 changes: 8 additions & 7 deletions generic/vfsCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,17 @@ static int CookfsMountCmd(ClientData clientData, Tcl_Interp *interp,
Tcl_DecrRefCount(localActual);
localActual = NULL;

CookfsLog(printf("CookfsMountCmd: add mount point..."));
if (!Cookfs_CookfsAddVfs(interp, vfs)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("Unable to add"
" the mount point", -1));
goto error;
}

if (!noregister) {
CookfsLog(printf("CookfsMountCmd: registering the vfs in tclvfs..."));
if (Cookfs_VfsRegisterInTclvfs(vfs) != TCL_OK) {
Cookfs_CookfsRemoveVfs(interp, NULL, vfs);
// We have an error message from Tclvfs in interp result
CookfsLog(printf("CookfsMountCmd: failed to register vfs"
" in tclvfs"));
Expand All @@ -532,13 +540,6 @@ static int CookfsMountCmd(ClientData clientData, Tcl_Interp *interp,
" in tclvfs"));
}

CookfsLog(printf("CookfsMountCmd: add mount point..."));
if (!Cookfs_CookfsAddVfs(interp, vfs)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("Unable to add"
" the mount point", -1));
goto error;
}

char cmd[128];
sprintf(cmd, "::cookfs::c::vfs::mount%p", (void *)vfs);
if (!nocommand) {
Expand Down

0 comments on commit 4589c3f

Please sign in to comment.