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)  

rsFileReaddir.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See fileReaddir.h for a description of this API call.*/
5 
6 #include "fileReaddir.h"
7 #include "miscServerFunct.hpp"
8 #include "rsGlobalExtern.hpp"
9 #include "rsFileReaddir.hpp"
10 
11 // =-=-=-=-=-=-=-
12 #include "irods_log.hpp"
14 
15 int
16 rsFileReaddir( rsComm_t *rsComm, fileReaddirInp_t *fileReaddirInp,
17  rodsDirent_t **fileReaddirOut ) {
19  int remoteFlag;
20  int status;
21 
22  *fileReaddirOut = NULL;
23 
24  remoteFlag = getServerHostByFileInx( fileReaddirInp->fileInx,
25  &rodsServerHost );
26 
27  if ( remoteFlag == LOCAL_HOST ) {
28  status = _rsFileReaddir( rsComm, fileReaddirInp, fileReaddirOut );
29  }
30  else if ( remoteFlag == REMOTE_HOST ) {
31  status = remoteFileReaddir( rsComm, fileReaddirInp, fileReaddirOut,
33  }
34  else {
35  if ( remoteFlag < 0 ) {
36  return remoteFlag;
37  }
38  else {
40  "rsFileReaddir: resolveHost returned unrecognized value %d",
41  remoteFlag );
43  }
44  }
45 
46  /* Manually insert call-specific code here */
47 
48  return status;
49 }
50 
51 int
52 remoteFileReaddir( rsComm_t *rsComm, fileReaddirInp_t *fileReaddirInp,
53  rodsDirent_t **fileReaddirOut, rodsServerHost_t *rodsServerHost ) {
54  int status;
55 
56  if ( rodsServerHost == NULL ) {
58  "remoteFileReaddir: Invalid rodsServerHost" );
60  }
61 
62  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
63  return status;
64  }
65 
66  fileReaddirInp->fileInx = convL3descInx( fileReaddirInp->fileInx );
67  status = rcFileReaddir( rodsServerHost->conn, fileReaddirInp, fileReaddirOut );
68 
69  if ( status < 0 ) {
70  if ( status != -1 ) { /* eof */
72  "remoteFileReaddir: rcFileReaddir failed for %s",
73  FileDesc[fileReaddirInp->fileInx].fileName );
74  }
75  }
76 
77  return status;
78 }
79 
80 // =-=-=-=-=-=-=-
81 // local function to call readdir via resource plugin
83  rsComm_t* _comm,
84  fileReaddirInp_t* _file_readdir_inp,
85  rodsDirent_t** _rods_dirent ) {
86  // =-=-=-=-=-=-=-
87  // create a collection_object, and extract dir ptr from the file desc table
90  FileDesc[ _file_readdir_inp->fileInx].fileName,
91  FileDesc[ _file_readdir_inp->fileInx].rescHier,
92  0, 0 ) );
93  coll_obj->directory_pointer( reinterpret_cast< DIR* >( FileDesc[ _file_readdir_inp->fileInx].driverDep ) );
94 
95  // =-=-=-=-=-=-=-
96  // make call to readdir via resource plugin and handle errors, if necessary
97  irods::error readdir_err = fileReaddir( _comm,
98  coll_obj,
99  _rods_dirent );
100  if ( !readdir_err.ok() ) {
101  std::stringstream msg;
102  msg << "fileReaddir failed for [";
103  msg << FileDesc[ _file_readdir_inp->fileInx].fileName;
104  msg << "]";
105  irods::error err = PASSMSG( msg.str(), readdir_err );
106  irods::log( err );
107 
108  return readdir_err.code();
109  }
110  else {
111  // =-=-=-=-=-=-=-
112  // case for handle end of file
113  if ( -1 == readdir_err.code() ) {
114  return readdir_err.code();
115  }
116  }
117 
118  // =-=-=-=-=-=-=-
119  // error code holds 'status' of api call
120  return readdir_err.code();
121 
122 } // _rsFileReaddir
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
fileReaddirInp_t::fileInx
int fileInx
Definition: fileReaddir.h:8
rsComm_t
Definition: rcConnect.h:145
rcFileReaddir
int rcFileReaddir(rcComm_t *conn, fileReaddirInp_t *fileReaddirInp, rodsDirent_t **fileReaddirOut)
Definition: rcFileReaddir.cpp:24
_rsFileReaddir
int _rsFileReaddir(rsComm_t *_comm, fileReaddirInp_t *_file_readdir_inp, rodsDirent_t **_rods_dirent)
Definition: rsFileReaddir.cpp:82
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
remoteFileReaddir
int remoteFileReaddir(rsComm_t *rsComm, fileReaddirInp_t *fileReaddirInp, rodsDirent_t **fileReaddirOut, rodsServerHost_t *rodsServerHost)
Definition: rsFileReaddir.cpp:52
getServerHostByFileInx
int getServerHostByFileInx(int fileInx, rodsServerHost_t **rodsServerHost)
Definition: fileOpr.cpp:99
fileReaddir.h
irods_collection_object.hpp
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
irods::collection_object_ptr
boost::shared_ptr< collection_object > collection_object_ptr
Definition: irods_collection_object.hpp:85
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
fileDesc_t::driverDep
void * driverDep
Definition: fileOpr.hpp:34
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
fileDesc_t::rescHier
char * rescHier
Definition: fileOpr.hpp:28
rsGlobalExtern.hpp
irods::error::code
long long code() const
Definition: irods_error.cpp:194
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
rsFileReaddir.hpp
convL3descInx
int convL3descInx(int l3descInx)
Definition: objDesc.cpp:571
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
irods::collection_object
Definition: irods_collection_object.hpp:14
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
rodsDirent
Definition: rodsType.h:70
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
FileDesc
fileDesc_t FileDesc[1026]
Definition: irods_server_globals.cpp:28
rodsServerHost
Definition: rodsConnect.h:62
fileReaddir
irods::error fileReaddir(rsComm_t *, irods::first_class_object_ptr, struct rodsDirent **)
Definition: fileDriver.cpp:422
fileReaddirInp_t
Definition: fileReaddir.h:7
rsFileReaddir
int rsFileReaddir(rsComm_t *rsComm, fileReaddirInp_t *fileReaddirInp, rodsDirent_t **fileReaddirOut)
Definition: rsFileReaddir.cpp:16
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
fileDesc_t::fileName
char * fileName
Definition: fileOpr.hpp:27
irods_log.hpp