00001
00002
00003 #include "structFileDriver.h"
00004 #include "subStructFileClose.h"
00005 #include "miscServerFunct.h"
00006 #include "dataObjOpr.h"
00007
00008 int
00009 rsSubStructFileClose (rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp)
00010 {
00011 rodsServerHost_t *rodsServerHost;
00012 int remoteFlag;
00013 int status;
00014
00015 remoteFlag = resolveHost (&subStructFileCloseInp->addr, &rodsServerHost);
00016
00017 if (remoteFlag == LOCAL_HOST) {
00018 status = _rsSubStructFileClose (rsComm, subStructFileCloseInp);
00019 } else if (remoteFlag == REMOTE_HOST) {
00020 status = remoteSubStructFileClose (rsComm, subStructFileCloseInp,
00021 rodsServerHost);
00022 } else {
00023 if (remoteFlag < 0) {
00024 return (remoteFlag);
00025 } else {
00026 rodsLog (LOG_NOTICE,
00027 "rsSubStructFileClose: resolveHost returned unrecognized value %d",
00028 remoteFlag);
00029 return (SYS_UNRECOGNIZED_REMOTE_FLAG);
00030 }
00031 }
00032
00033 return (status);
00034 }
00035
00036 int
00037 remoteSubStructFileClose (rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp,
00038 rodsServerHost_t *rodsServerHost)
00039 {
00040 int status;
00041
00042 if (rodsServerHost == NULL) {
00043 rodsLog (LOG_NOTICE,
00044 "remoteSubStructFileClose: Invalid rodsServerHost");
00045 return SYS_INVALID_SERVER_HOST;
00046 }
00047
00048 if ((status = svrToSvrConnect (rsComm, rodsServerHost)) < 0) {
00049 return status;
00050 }
00051
00052 status = rcSubStructFileClose (rodsServerHost->conn, subStructFileCloseInp);
00053
00054 if (status < 0) {
00055 rodsLog (LOG_NOTICE,
00056 "remoteSubStructFileClose: rcFileClose failed for fd %d",
00057 subStructFileCloseInp->fd);
00058 }
00059
00060 return status;
00061 }
00062
00063 int
00064 _rsSubStructFileClose (rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp)
00065 {
00066 int status;
00067
00068 status = subStructFileClose (subStructFileCloseInp->type, rsComm,
00069 subStructFileCloseInp->fd);
00070
00071 return (status);
00072 }
00073