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)  

rsFileMkdir.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See fileMkdir.h for a description of this API call.*/
5 
6 #include "fileMkdir.h"
7 #include "miscServerFunct.hpp"
8 #include "rsFileMkdir.hpp"
9 
10 // =-=-=-=-=-=-=-
11 #include "irods_log.hpp"
13 #include "irods_stacktrace.hpp"
14 #include "fileDriver.hpp"
15 
16 int
17 rsFileMkdir( rsComm_t *rsComm, fileMkdirInp_t *fileMkdirInp ) {
19  int remoteFlag;
20  int status;
21 
22  remoteFlag = resolveHost( &fileMkdirInp->addr, &rodsServerHost );
23  if ( remoteFlag == LOCAL_HOST ) {
24  status = _rsFileMkdir( rsComm, fileMkdirInp );
25  }
26  else if ( remoteFlag == REMOTE_HOST ) {
27  status = remoteFileMkdir( rsComm, fileMkdirInp, rodsServerHost );
28  }
29  else {
30  if ( remoteFlag < 0 ) {
31  return remoteFlag;
32  }
33  else {
35  "rsFileMkdir: resolveHost returned unrecognized value %d",
36  remoteFlag );
38  }
39  }
40 
41  /* Manually insert call-specific code here */
42 
43  return status;
44 }
45 
46 int
47 remoteFileMkdir( rsComm_t *rsComm, fileMkdirInp_t *fileMkdirInp,
49  int status;
50 
51  if ( rodsServerHost == NULL ) {
53  "remoteFileMkdir: Invalid rodsServerHost" );
55  }
56 
57  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
58  return status;
59  }
60 
61 
62  status = rcFileMkdir( rodsServerHost->conn, fileMkdirInp );
63 
64  if ( status < 0 ) {
66  "remoteFileOpen: rcFileMkdir failed for %s",
67  fileMkdirInp->dirName );
68  }
69 
70  return status;
71 }
72 
73 // =-=-=-=-=-=-=-
74 // local function to handle call to mkdir via resource plugin
76  rsComm_t* _comm,
77  fileMkdirInp_t* _mkdir_inp ) {
78  // =-=-=-=-=-=-=-
79  // make call to mkdir via resource plugin
80 
83  _mkdir_inp->dirName,
84  _mkdir_inp->rescHier,
85  _mkdir_inp->mode,
86  0 ) );
87 
88  // =-=-=-=-=-=-=-
89  // pass condInput
90  coll_obj->cond_input( _mkdir_inp->condInput );
91 
92  irods::error mkdir_err = fileMkdir( _comm, coll_obj );
93 
94  // =-=-=-=-=-=-=-
95  // log error if necessary
96  if ( !mkdir_err.ok() ) {
97  if ( getErrno( mkdir_err.code() ) != EEXIST ) {
98  std::stringstream msg;
99  msg << "fileMkdir failed for ";
100  msg << _mkdir_inp->dirName;
101  msg << "]";
102  irods::error ret_err = PASSMSG( msg.str(), mkdir_err );
103  irods::log( ret_err );
104  }
105  }
106 
107  return mkdir_err.code();
108 
109 } // _rsFileMkdir
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
rsFileMkdir.hpp
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
fileMkdirInp_t::mode
int mode
Definition: fileMkdir.h:11
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
fileMkdir
irods::error fileMkdir(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:270
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
fileDriver.hpp
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileMkdir.h
fileMkdirInp_t::addr
rodsHostAddr_t addr
Definition: fileMkdir.h:8
fileMkdirInp_t::dirName
char dirName[(1024+64)]
Definition: fileMkdir.h:9
getErrno
int getErrno(int errCode)
Definition: rcMisc.cpp:3261
rcFileMkdir
int rcFileMkdir(rcComm_t *conn, fileMkdirInp_t *fileMkdirInp)
Definition: rcFileMkdir.cpp:23
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
rsFileMkdir
int rsFileMkdir(rsComm_t *rsComm, fileMkdirInp_t *fileMkdirInp)
Definition: rsFileMkdir.cpp:17
irods::log
void log(const error &)
Definition: irods_log.cpp:13
fileMkdirInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileMkdir.h:10
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
_rsFileMkdir
int _rsFileMkdir(rsComm_t *_comm, fileMkdirInp_t *_mkdir_inp)
Definition: rsFileMkdir.cpp:75
rodsServerHost
Definition: rodsConnect.h:62
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
fileMkdirInp_t::condInput
keyValPair_t condInput
Definition: fileMkdir.h:12
irods_log.hpp
fileMkdirInp_t
Definition: fileMkdir.h:7
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375
remoteFileMkdir
int remoteFileMkdir(rsComm_t *rsComm, fileMkdirInp_t *fileMkdirInp, rodsServerHost_t *rodsServerHost)
Definition: rsFileMkdir.cpp:47