Windows: normalize return codes from cm_FreelanceAddMount

Instead of returning an undefined CM error code, -1, which might
end up being confused with an Rx error, return legal CM_ERROR_xxx
values.

LICENSE MIT

Change-Id: Ie78e4e9cf00fa938806c8b355f54169a5691ff04
Reviewed-on: http://gerrit.openafs.org/1889
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2010-05-02 14:17:43 -04:00 committed by Jeffrey Altman
parent 1ff924e722
commit f8efae8c70

View File

@ -973,6 +973,7 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw,
DWORD dwType, dwSize; DWORD dwType, dwSize;
DWORD dwMountPoints; DWORD dwMountPoints;
DWORD dwIndex; DWORD dwIndex;
afs_uint32 code = 0;
/* before adding, verify the cell name; if it is not a valid cell, /* before adding, verify the cell name; if it is not a valid cell,
don't add the mount point. don't add the mount point.
@ -985,19 +986,21 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw,
rw ? "rw" : "ro"); rw ? "rw" : "ro");
if ( filename[0] == '\0' || cellname[0] == '\0' || volume[0] == '\0' ) if ( filename[0] == '\0' || cellname[0] == '\0' || volume[0] == '\0' )
return -1; return CM_ERROR_INVAL;
if (cellname[0] == '.') { if (cellname[0] == '.') {
if (!cm_GetCell_Gen(&cellname[1], fullname, CM_FLAG_CREATE)) if (!cm_GetCell_Gen(&cellname[1], fullname, CM_FLAG_CREATE))
return -1; return CM_ERROR_INVAL;
} else { } else {
if (!cm_GetCell_Gen(cellname, fullname, CM_FLAG_CREATE)) if (!cm_GetCell_Gen(cellname, fullname, CM_FLAG_CREATE))
return -1; return CM_ERROR_INVAL;
} }
if ( cm_FreelanceMountPointExists(filename, 0) || if ( cm_FreelanceMountPointExists(filename, 0) ||
cm_FreelanceSymlinkExists(filename, 0) ) cm_FreelanceSymlinkExists(filename, 0) ) {
return -1; code = CM_ERROR_EXISTS;
goto done;
}
osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s", osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s",
osi_LogSaveString(afsd_logp,cellname)); osi_LogSaveString(afsd_logp,cellname));
@ -1081,9 +1084,9 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw,
cm_noteLocalMountPointChange(TRUE); cm_noteLocalMountPointChange(TRUE);
lock_ReleaseMutex(&cm_Freelance_Lock); lock_ReleaseMutex(&cm_Freelance_Lock);
done:
if (fidp) { if (fidp) {
cm_req_t req; cm_req_t req;
afs_uint32 code;
cm_scache_t *scp; cm_scache_t *scp;
clientchar_t *cpath; clientchar_t *cpath;
@ -1102,7 +1105,7 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw,
cm_ReleaseSCache(scp); cm_ReleaseSCache(scp);
} }
return 0; return code;
} }
long cm_FreelanceRemoveMount(char *toremove) long cm_FreelanceRemoveMount(char *toremove)