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)  

rsSubStructFileReaddir.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileReaddir.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
9 
10 int
11 rsSubStructFileReaddir( rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileReaddirInp,
14  int remoteFlag;
15  int status;
16 
17  remoteFlag = resolveHost( &subStructFileReaddirInp->addr, &rodsServerHost );
18 
19  if ( remoteFlag == LOCAL_HOST ) {
20  status = _rsSubStructFileReaddir( rsComm, subStructFileReaddirInp, rodsDirent );
21  }
22  else if ( remoteFlag == REMOTE_HOST ) {
23  status = remoteSubStructFileReaddir( rsComm, subStructFileReaddirInp, rodsDirent,
25  }
26  else {
27  if ( remoteFlag < 0 ) {
28  return remoteFlag;
29  }
30  else {
32  "rsSubStructFileReaddir: resolveHost returned unrecognized value %d",
33  remoteFlag );
35  }
36  }
37 
38  return status;
39 }
40 
41 int
42 remoteSubStructFileReaddir( rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileReaddirInp,
44  int status;
45 
46  if ( rodsServerHost == NULL ) {
48  "remoteSubStructFileReaddir: Invalid rodsServerHost" );
50  }
51 
52  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
53  return status;
54  }
55 
56  status = rcSubStructFileReaddir( rodsServerHost->conn, subStructFileReaddirInp,
57  rodsDirent );
58 
59  if ( status < 0 && status != -1 ) {
61  "remoteSubStructFileReaddir: rcFileReaddir failed for fd %d",
62  subStructFileReaddirInp->fd );
63  }
64 
65  return status;
66 
67 }
68 
70  subStructFileFdOprInp_t* _read_inp,
71  rodsDirent_t ** _dirent ) {
72  if ( !_read_inp ) {
73  irods::log( LOG_NOTICE, "XXXX _rsSubStructFileReaddir - null _read_inp" );
74  return -1;
75  }
76 
77  // =-=-=-=-=-=-=-
78  // create first class structured object
80  new irods::structured_object( *_read_inp ) );
81 
82  struct_obj->comm( _comm );
83  struct_obj->resc_hier( _read_inp->resc_hier );
84  struct_obj->file_descriptor( _read_inp->fd );
85 
86  // =-=-=-=-=-=-=-
87  // call abstrcated interface to read a file
88  irods::error readdir_err = fileReaddir( _comm, struct_obj, _dirent );
89  if ( !readdir_err.ok() ) {
90  std::stringstream msg;
91  msg << "failed on call to fileReaddir for [";
92  msg << struct_obj->physical_path();
93  msg << "]";
94  irods::log( PASSMSG( msg.str(), readdir_err ) );
95  return readdir_err.code();
96 
97  }
98  else {
99  return readdir_err.code();
100 
101  }
102 
103 }
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
subStructFileReaddir.h
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
_rsSubStructFileReaddir
int _rsSubStructFileReaddir(rsComm_t *_comm, subStructFileFdOprInp_t *_read_inp, rodsDirent_t **_dirent)
Definition: rsSubStructFileReaddir.cpp:69
SubStructFileFdOpr
Definition: subStructFileRead.h:8
irods::error::code
long long code() const
Definition: irods_error.cpp:194
remoteSubStructFileReaddir
int remoteSubStructFileReaddir(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileReaddirInp, rodsDirent_t **rodsDirent, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileReaddir.cpp:42
irods::structured_object
Definition: irods_structured_object.hpp:15
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
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
rodsDirent
Definition: rodsType.h:70
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
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
rsSubStructFileReaddir
int rsSubStructFileReaddir(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileReaddirInp, rodsDirent_t **rodsDirent)
Definition: rsSubStructFileReaddir.cpp:11
rcSubStructFileReaddir
int rcSubStructFileReaddir(rcComm_t *conn, subStructFileFdOprInp_t *subStructFileReaddirInp, rodsDirent_t **rodsDirent)
Definition: rcSubStructFileReaddir.cpp:24
fileReaddir
irods::error fileReaddir(rsComm_t *, irods::first_class_object_ptr, struct rodsDirent **)
Definition: fileDriver.cpp:422
irods_structured_object.hpp
dataObjOpr.hpp
rsSubStructFileReaddir.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375