mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 07:51:00 +00:00
DEVEL15-windows-ioctl-path-availability-20070614
fix cm_IoctlPathAvailability to return the current volume state.
0, CM_ERROR_ALLBUSY, CM_ERROR_ALLDOWN, CM_ERROR_ALLOFFLINE
modify fs.c to generate messages when the errors are received.
(cherry picked from commit e8fa4d0e40
)
This commit is contained in:
parent
14115da9fb
commit
7940ab94a8
@ -2829,8 +2829,8 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp)
|
||||
cm_scache_t *scp;
|
||||
cm_cell_t *cellp;
|
||||
cm_volume_t *tvp;
|
||||
cm_serverRef_t **tsrpp;
|
||||
unsigned long volume;
|
||||
cm_vol_state_t *statep;
|
||||
afs_uint32 volume;
|
||||
cm_req_t req;
|
||||
|
||||
cm_InitReq(&req);
|
||||
@ -2852,13 +2852,30 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp)
|
||||
if (code)
|
||||
return code;
|
||||
|
||||
lock_ObtainMutex(&tvp->mx);
|
||||
tsrpp = cm_GetVolServers(tvp, volume);
|
||||
code = cm_CheckServersStatus(*tsrpp);
|
||||
cm_FreeServerList(tsrpp, 0);
|
||||
lock_ReleaseMutex(&tvp->mx);
|
||||
if (volume == tvp->rw.ID)
|
||||
statep = &tvp->rw;
|
||||
else if (volume == tvp->ro.ID)
|
||||
statep = &tvp->ro;
|
||||
else
|
||||
statep = &tvp->bk;
|
||||
|
||||
switch (statep->state) {
|
||||
case vl_online:
|
||||
case vl_unknown:
|
||||
code = 0;
|
||||
break;
|
||||
case vl_busy:
|
||||
code = CM_ERROR_ALLBUSY;
|
||||
break;
|
||||
case vl_offline:
|
||||
code = CM_ERROR_ALLOFFLINE;
|
||||
break;
|
||||
case vl_alldown:
|
||||
code = CM_ERROR_ALLDOWN;
|
||||
break;
|
||||
}
|
||||
cm_PutVolume(tvp);
|
||||
return 0;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4639,10 +4639,10 @@ Die(int code, char *filename)
|
||||
else if (code == ENODEV) {
|
||||
fprintf(stderr,"%s: AFS service may not have started.\n", pn);
|
||||
}
|
||||
else if (code == ESRCH) {
|
||||
else if (code == ESRCH) { /* hack */
|
||||
fprintf(stderr,"%s: Cell name not recognized.\n", pn);
|
||||
}
|
||||
else if (code == EPIPE) {
|
||||
else if (code == EPIPE) { /* hack */
|
||||
fprintf(stderr,"%s: Volume name or ID not recognized.\n", pn);
|
||||
}
|
||||
else if (code == EFBIG) {
|
||||
@ -4654,6 +4654,24 @@ Die(int code, char *filename)
|
||||
else
|
||||
fprintf(stderr,"%s: Connection timed out", pn);
|
||||
}
|
||||
else if (code == EBUSY) {
|
||||
if (filename)
|
||||
fprintf(stderr,"%s: All servers are busy on which '%s' resides\n", pn, filename);
|
||||
else
|
||||
fprintf(stderr,"%s: All servers are busy\n", pn);
|
||||
}
|
||||
else if (code == ENXIO) {
|
||||
if (filename)
|
||||
fprintf(stderr,"%s: All volume instances are offline on which '%s' resides\n", pn, filename);
|
||||
else
|
||||
fprintf(stderr,"%s: All volume instances are offline\n", pn);
|
||||
}
|
||||
else if (code == ENOSYS) {
|
||||
if (filename)
|
||||
fprintf(stderr,"%s: All servers are down on which '%s' resides\n", pn, filename);
|
||||
else
|
||||
fprintf(stderr,"%s: All servers are down\n", pn);
|
||||
}
|
||||
else {
|
||||
if (filename)
|
||||
fprintf(stderr,"%s:'%s'", pn, filename);
|
||||
|
Loading…
Reference in New Issue
Block a user