irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsSubStructFileClose.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileClose.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
8 // =-=-=-=-=-=-=-
10 
11 int
12 rsSubStructFileClose( rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp ) {
14  int remoteFlag;
15  int status;
16 
17  remoteFlag = resolveHost( &subStructFileCloseInp->addr, &rodsServerHost );
18 
19  if ( remoteFlag == LOCAL_HOST ) {
20  status = _rsSubStructFileClose( rsComm, subStructFileCloseInp );
21  }
22  else if ( remoteFlag == REMOTE_HOST ) {
23  status = remoteSubStructFileClose( rsComm, subStructFileCloseInp,
25  }
26  else {
27  if ( remoteFlag < 0 ) {
28  return remoteFlag;
29  }
30  else {
32  "rsSubStructFileClose: resolveHost returned unrecognized value %d",
33  remoteFlag );
35  }
36  }
37 
38  return status;
39 }
40 
41 int
44  int status;
45 
46  if ( rodsServerHost == NULL ) {
48  "remoteSubStructFileClose: Invalid rodsServerHost" );
50  }
51 
52  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
53  return status;
54  }
55 
56  status = rcSubStructFileClose( rodsServerHost->conn, subStructFileCloseInp );
57 
58  if ( status < 0 ) {
60  "remoteSubStructFileClose: rcFileClose failed for fd %d",
61  subStructFileCloseInp->fd );
62  }
63 
64  return status;
65 }
66 
68  rsComm_t* _comm,
69  subStructFileFdOprInp_t* _close_inp ) {
70  // =-=-=-=-=-=-=-
71  // create first class structured object
73  new irods::structured_object( *_close_inp ) );
74  struct_obj->comm( _comm );
75  struct_obj->resc_hier( _close_inp->resc_hier );
76  struct_obj->file_descriptor( _close_inp->fd );
77 
78  // =-=-=-=-=-=-=-
79  // call abstrcated interface to open a file
80  irods::error close_err = fileClose( _comm, struct_obj );
81  if ( !close_err.ok() ) {
82  std::stringstream msg;
83  msg << "failed on call to fileClose for fd [ ";
84  msg << struct_obj->file_descriptor();
85  msg << " ]";
86  irods::log( PASSMSG( msg.str(), close_err ) );
87  return close_err.code();
88 
89  }
90  else {
91  return close_err.code();
92 
93  }
94 
95 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
SubStructFileFdOpr::addr
rodsHostAddr_t addr
Definition: subStructFileRead.h:9
rsComm_t
Definition: rcConnect.h:145
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
rsSubStructFileClose.hpp
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
SubStructFileFdOpr
Definition: subStructFileRead.h:8
irods::error::code
long long code() const
Definition: irods_error.cpp:194
_rsSubStructFileClose
int _rsSubStructFileClose(rsComm_t *_comm, subStructFileFdOprInp_t *_close_inp)
Definition: rsSubStructFileClose.cpp:67
irods::structured_object
Definition: irods_structured_object.hpp:15
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
remoteSubStructFileClose
int remoteSubStructFileClose(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileClose.cpp:42
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::structured_object_ptr
boost::shared_ptr< structured_object > structured_object_ptr
Definition: irods_structured_object.hpp:107
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
fileClose
irods::error fileClose(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:147
SubStructFileFdOpr::resc_hier
char resc_hier[(1024+64)]
Definition: subStructFileRead.h:13
SubStructFileFdOpr::fd
int fd
Definition: subStructFileRead.h:11
rodsServerHost
Definition: rodsConnect.h:62
rcSubStructFileClose
int rcSubStructFileClose(rcComm_t *conn, subStructFileFdOprInp_t *subStructFileCloseInp)
Definition: rcSubStructFileClose.cpp:23
rsSubStructFileClose
int rsSubStructFileClose(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileCloseInp)
Definition: rsSubStructFileClose.cpp:12
subStructFileClose.h
irods_structured_object.hpp
dataObjOpr.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375