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)  

rsFileOpendir.cpp
Go to the documentation of this file.
1 
3 /* rsFileOpendir.c - server routine that handles the fileOpendir
4  * API
5  */
6 
7 /* script generated code */
8 #include "fileOpendir.h"
9 #include "miscServerFunct.hpp"
10 #include "rsGlobalExtern.hpp"
11 #include "rsFileOpendir.hpp"
12 
13 // =-=-=-=-=-=-=-
14 #include "irods_log.hpp"
17 #include "irods_stacktrace.hpp"
18 
19 int
20 rsFileOpendir( rsComm_t *rsComm, fileOpendirInp_t *fileOpendirInp ) {
22  int remoteFlag;
23  int fileInx;
24  int status;
25  void *dirPtr = NULL;
26 
27  //remoteFlag = resolveHost (&fileOpendirInp->addr, &rodsServerHost);
28  irods::error ret = irods::get_host_for_hier_string( fileOpendirInp->resc_hier_, remoteFlag, rodsServerHost );
29  if ( !ret.ok() ) {
30  irods::log( PASSMSG( "failed in call to irods::get_host_for_hier_string", ret ) );
31  return -1;
32  }
33 
34  if ( remoteFlag == LOCAL_HOST ) {
35  status = _rsFileOpendir( rsComm, fileOpendirInp, &dirPtr );
36  }
37  else if ( remoteFlag == REMOTE_HOST ) {
38  status = remoteFileOpendir( rsComm, fileOpendirInp, rodsServerHost );
39  }
40  else {
41  if ( remoteFlag < 0 ) {
42  return remoteFlag;
43  }
44  else {
46  "rsFileOpendir: resolveHost returned unrecognized value %d",
47  remoteFlag );
49  }
50  }
51 
52  if ( status < 0 ) {
53  return status;
54  }
55 
56  fileInx = allocAndFillFileDesc( rodsServerHost, fileOpendirInp->objPath, fileOpendirInp->dirName, fileOpendirInp->resc_hier_,
57  status, 0 );
58  if ( fileInx < 0 ) {
59  rodsLog( LOG_NOTICE, "call to allocAndFileDesc failed with status %ji", ( intmax_t ) fileInx );
60  return fileInx;
61  }
62  FileDesc[fileInx].driverDep = dirPtr;
63 
64  return fileInx;
65 }
66 
67 int
68 remoteFileOpendir( rsComm_t *rsComm, fileOpendirInp_t *fileOpendirInp,
70  int fileInx;
71  int status;
72 
73  if ( rodsServerHost == NULL ) {
75  "remoteFileOpendir: Invalid rodsServerHost" );
77  }
78 
79  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
80  return status;
81  }
82 
83  fileInx = rcFileOpendir( rodsServerHost->conn, fileOpendirInp );
84 
85  if ( fileInx < 0 ) {
87  "remoteFileOpendir: rcFileOpendir failed for %s",
88  fileOpendirInp->dirName );
89  }
90 
91  return fileInx;
92 }
93 
94 // =-=-=-=-=-=-=-
95 // _rsFileOpendir - this the local version of rsFileOpendir.
97  rsComm_t* _comm,
98  fileOpendirInp_t* _opendir_inp,
99  void** _dir_ptr ) {
100  // =-=-=-=-=-=-=-
101  // FIXME:: XXXX need to check resource permission and vault permission
102  // when RCAT is available
103 
104  // =-=-=-=-=-=-=-
105  // make the call to opendir via resource plugin
108  _opendir_inp->dirName,
109  _opendir_inp->resc_hier_,
110  0, 0 ) );
111  irods::error opendir_err = fileOpendir( _comm, coll_obj );
112 
113  // =-=-=-=-=-=-=-
114  // log an error, if any
115  if ( !opendir_err.ok() ) {
116  std::stringstream msg;
117  msg << "fileOpendir failed for [";
118  msg << _opendir_inp->dirName;
119  msg << "]";
120  irods::error err = PASSMSG( msg.str(), opendir_err );
121  irods::log( err );
122  }
123 
124  ( *_dir_ptr ) = coll_obj->directory_pointer(); // JMC -- TEMPORARY
125 
126  return opendir_err.code();
127 
128 } // _rsFileOpendir
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
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
irods_stacktrace.hpp
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
irods_resource_backport.hpp
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
rsFileOpendir.hpp
rsGlobalExtern.hpp
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileOpendirInp_t
Definition: fileOpendir.h:7
fileOpendir
irods::error fileOpendir(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:362
irods::get_host_for_hier_string
error get_host_for_hier_string(const std::string &, int &, rodsServerHost_t *&)
Definition: irods_resource_backport.cpp:581
fileOpendirInp_t::dirName
char dirName[(1024+64)]
Definition: fileOpendir.h:12
fileOpendirInp_t::resc_hier_
char resc_hier_[(1024+64)]
Definition: fileOpendir.h:9
fileOpendir.h
fileOpendirInp_t::objPath
char objPath[(1024+64)]
Definition: fileOpendir.h:10
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::collection_object
Definition: irods_collection_object.hpp:14
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
allocAndFillFileDesc
int allocAndFillFileDesc(rodsServerHost_t *rodsServerHost, const std::string &objPath, const std::string &fileName, const std::string &rescHier, int fd, int mode)
Definition: fileOpr.cpp:48
irods::log
void log(const error &)
Definition: irods_log.cpp:13
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
rcFileOpendir
int rcFileOpendir(rcComm_t *conn, fileOpendirInp_t *fileOpendirInp)
Definition: rcFileOpendir.cpp:23
rodsServerHost
Definition: rodsConnect.h:62
remoteFileOpendir
int remoteFileOpendir(rsComm_t *rsComm, fileOpendirInp_t *fileOpendirInp, rodsServerHost_t *rodsServerHost)
Definition: rsFileOpendir.cpp:68
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
_rsFileOpendir
int _rsFileOpendir(rsComm_t *_comm, fileOpendirInp_t *_opendir_inp, void **_dir_ptr)
Definition: rsFileOpendir.cpp:96
irods_log.hpp
rsFileOpendir
int rsFileOpendir(rsComm_t *rsComm, fileOpendirInp_t *fileOpendirInp)
Definition: rsFileOpendir.cpp:20