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)  

rsFileChmod.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See fileChmod.h for a description of this API call.*/
5 
6 #include "fileChmod.h"
7 #include "miscServerFunct.hpp"
8 #include "rsFileChmod.hpp"
9 
10 
11 // =-=-=-=-=-=-=-
12 #include "irods_log.hpp"
13 #include "irods_file_object.hpp"
14 #include "irods_stacktrace.hpp"
16 
17 int
18 rsFileChmod( rsComm_t *rsComm, fileChmodInp_t *fileChmodInp ) {
20  int remoteFlag;
21  int status;
22 
23  //remoteFlag = resolveHost (&fileChmodInp->addr, &rodsServerHost);
24  irods::error ret = irods::get_host_for_hier_string( fileChmodInp->rescHier, remoteFlag, rodsServerHost );
25  if ( !ret.ok() ) {
26  irods::log( PASSMSG( "failed in call to irods::get_host_for_hier_string", ret ) );
27  return -1;
28  }
29 
30  if ( remoteFlag == LOCAL_HOST ) {
31  status = _rsFileChmod( rsComm, fileChmodInp );
32  }
33  else if ( remoteFlag == REMOTE_HOST ) {
34  status = remoteFileChmod( rsComm, fileChmodInp, rodsServerHost );
35  }
36  else {
37  if ( remoteFlag < 0 ) {
38  return remoteFlag;
39  }
40  else {
42  "rsFileChmod: resolveHost returned unrecognized value %d",
43  remoteFlag );
45  }
46  }
47 
48  /* Manually insert call-specific code here */
49 
50  return status;
51 }
52 
53 int
54 remoteFileChmod( rsComm_t *rsComm, fileChmodInp_t *fileChmodInp,
56  int status;
57 
58  if ( rodsServerHost == NULL ) {
60  "remoteFileChmod: Invalid rodsServerHost" );
62  }
63 
64  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
65  return status;
66  }
67 
68 
69  status = rcFileChmod( rodsServerHost->conn, fileChmodInp );
70 
71  if ( status < 0 ) {
73  "remoteFileOpen: rcFileChmod failed for %s",
74  fileChmodInp->fileName );
75  }
76 
77  return status;
78 }
79 
80 // =-=-=-=-=-=-=-
81 // local function which makes the call to chmod via the resource plugin
83  rsComm_t* _comm,
84  fileChmodInp_t* _chmod_inp ) {
85  // =-=-=-=-=-=-=-
86  // make the call to chmod via the resource plugin
87  irods::file_object_ptr file_obj(
89  _comm,
90  _chmod_inp->objPath,
91  _chmod_inp->fileName,
92  _chmod_inp->rescHier,
93  0, 0, 0 ) );
94  irods::error chmod_err = fileChmod( _comm, file_obj, _chmod_inp->mode );
95 
96  // =-=-=-=-=-=-=-
97  // report errors if any
98  if ( !chmod_err.ok() ) {
99  std::stringstream msg;
100  msg << "fileChmod failed for [";
101  msg << _chmod_inp->fileName;
102  msg << "] to mode [";
103  msg << _chmod_inp->mode;
104  msg << "";
105  irods::error err = PASSMSG( msg.str(), chmod_err );
106  irods::log( err );
107  }
108 
109  return chmod_err.code();
110 } //_rsChmod
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
rcFileChmod
int rcFileChmod(rcComm_t *conn, fileChmodInp_t *fileChmodInp)
Definition: rcFileChmod.cpp:23
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
irods_file_object.hpp
irods_stacktrace.hpp
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
fileChmodInp_t
Definition: fileChmod.h:7
fileChmodInp_t::fileName
char fileName[(1024+64)]
Definition: fileChmod.h:9
fileChmodInp_t::objPath
char objPath[(1024+64)]
Definition: fileChmod.h:12
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
irods_resource_backport.hpp
rsFileChmod.hpp
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
irods::error::code
long long code() const
Definition: irods_error.cpp:194
irods::get_host_for_hier_string
error get_host_for_hier_string(const std::string &, int &, rodsServerHost_t *&)
Definition: irods_resource_backport.cpp:581
fileChmodInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileChmod.h:11
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
fileChmod.h
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
irods::file_object
Definition: irods_file_object.hpp:19
rodsServerHost
Definition: rodsConnect.h:62
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
rsFileChmod
int rsFileChmod(rsComm_t *rsComm, fileChmodInp_t *fileChmodInp)
Definition: rsFileChmod.cpp:18
remoteFileChmod
int remoteFileChmod(rsComm_t *rsComm, fileChmodInp_t *fileChmodInp, rodsServerHost_t *rodsServerHost)
Definition: rsFileChmod.cpp:54
fileChmodInp_t::mode
int mode
Definition: fileChmod.h:10
fileChmod
irods::error fileChmod(rsComm_t *, irods::first_class_object_ptr, int)
Definition: fileDriver.cpp:301
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods_log.hpp
_rsFileChmod
int _rsFileChmod(rsComm_t *_comm, fileChmodInp_t *_chmod_inp)
Definition: rsFileChmod.cpp:82