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)  

rsFileLseek.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See fileLseek.h for a description of this API call.*/
5 
6 #include "fileLseek.h"
7 #include "miscServerFunct.hpp"
8 #include "rsGlobalExtern.hpp"
9 #include "rsFileLseek.hpp"
10 
11 // =-=-=-=-=-=-=-
12 #include "irods_log.hpp"
13 #include "irods_file_object.hpp"
14 #include "irods_stacktrace.hpp"
15 
16 int
17 rsFileLseek( rsComm_t *rsComm, fileLseekInp_t *fileLseekInp,
18  fileLseekOut_t **fileLseekOut ) {
20  int remoteFlag;
21  int retVal;
22 
23  *fileLseekOut = NULL;
24 
25  remoteFlag = getServerHostByFileInx( fileLseekInp->fileInx,
26  &rodsServerHost );
27 
28  if ( remoteFlag == LOCAL_HOST ) {
29  retVal = _rsFileLseek( rsComm, fileLseekInp, fileLseekOut );
30  }
31  else if ( remoteFlag == REMOTE_HOST ) {
32  retVal = remoteFileLseek( rsComm, fileLseekInp,
33  fileLseekOut, rodsServerHost );
34  }
35  else {
36  if ( remoteFlag < 0 ) {
37  return remoteFlag;
38  }
39  else {
41  "rsFileLseek: resolveHost returned unrecognized value %d",
42  remoteFlag );
44  }
45  }
46 
47  /* Manually insert call-specific code here */
48 
49  return retVal;
50 }
51 
52 int
53 remoteFileLseek( rsComm_t *rsComm, fileLseekInp_t *fileLseekInp,
55  int status;
56 
57  if ( rodsServerHost == NULL ) {
59  "remoteFileLseek: Invalid rodsServerHost" );
61  }
62 
63  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
64  return status;
65  }
66 
67  fileLseekInp->fileInx = convL3descInx( fileLseekInp->fileInx );
68  status = rcFileLseek( rodsServerHost->conn, fileLseekInp, fileLseekOut );
69 
70  if ( status < 0 ) {
72  "remoteFileLseek: rcFileLseek failed for %d, status = %d",
73  fileLseekInp->fileInx, status );
74  }
75 
76  return status;
77 }
78 
79 // =-=-=-=-=-=-=-
80 // local function to handle call to stat via resource plugin
82  rsComm_t* _comm,
83  fileLseekInp_t* _lseek_inp,
84  fileLseekOut_t** _lseek_out ) {
85  // =-=-=-=-=-=-=-
86  // make call to lseek via resource plugin
87  irods::file_object_ptr file_obj(
89  _comm,
90  FileDesc[_lseek_inp->fileInx].objPath,
91  FileDesc[_lseek_inp->fileInx].fileName,
92  FileDesc[_lseek_inp->fileInx].rescHier,
93  FileDesc[_lseek_inp->fileInx].fd,
94  0, 0 ) );
95 
96  irods::error lseek_err = fileLseek(
97  _comm,
98  file_obj,
99  _lseek_inp->offset,
100  _lseek_inp->whence );
101  // =-=-=-=-=-=-=-
102  // handle error conditions and log
103  if ( !lseek_err.ok() ) {
104  std::stringstream msg;
105  msg << "lseek failed for [";
106  msg << FileDesc[_lseek_inp->fileInx].fileName;
107  msg << "]";
108  irods::error ret_err = PASSMSG( msg.str(), lseek_err );
109  irods::log( ret_err );
110 
111  return lseek_err.code();
112 
113  }
114  else {
115  ( *_lseek_out ) = ( fileLseekOut_t* )malloc( sizeof( fileLseekOut_t ) );
116  memset( ( *_lseek_out ), 0, sizeof( fileLseekOut_t ) );
117 
118  ( *_lseek_out )->offset = lseek_err.code();
119 
120  return 0;
121  }
122 
123 } // _rsFileLseek
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_file_object.hpp
irods_stacktrace.hpp
getServerHostByFileInx
int getServerHostByFileInx(int fileInx, rodsServerHost_t **rodsServerHost)
Definition: fileOpr.cpp:99
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
fileLseek.h
fileLseek
irods::error fileLseek(rsComm_t *, irods::first_class_object_ptr, long long, int)
Definition: fileDriver.cpp:238
fileDesc_t::rescHier
char * rescHier
Definition: fileOpr.hpp:28
rcFileLseek
int rcFileLseek(rcComm_t *conn, fileLseekInp_t *fileLseekInp, fileLseekOut_t **fileLseekOut)
Definition: rcFileLseek.cpp:24
rsGlobalExtern.hpp
rsFileLseek
int rsFileLseek(rsComm_t *rsComm, fileLseekInp_t *fileLseekInp, fileLseekOut_t **fileLseekOut)
Definition: rsFileLseek.cpp:17
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileDesc_t::objPath
char * objPath
Definition: fileOpr.hpp:29
remoteFileLseek
int remoteFileLseek(rsComm_t *rsComm, fileLseekInp_t *fileLseekInp, fileLseekOut_t **fileLseekOut, rodsServerHost_t *rodsServerHost)
Definition: rsFileLseek.cpp:53
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
convL3descInx
int convL3descInx(int l3descInx)
Definition: objDesc.cpp:571
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
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
FileLseekOut
Definition: fileLseek.h:53
miscServerFunct.hpp
FileDesc
fileDesc_t FileDesc[1026]
Definition: irods_server_globals.cpp:28
irods::file_object
Definition: irods_file_object.hpp:19
rodsServerHost
Definition: rodsConnect.h:62
fileDesc_t::fd
int fd
Definition: fileOpr.hpp:32
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
FileLseekInp::fileInx
int fileInx
Definition: fileLseek.h:33
FileLseekInp
Definition: fileLseek.h:32
rsFileLseek.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
FileLseekInp::offset
rodsLong_t offset
Definition: fileLseek.h:34
FileLseekInp::whence
int whence
Definition: fileLseek.h:35
fileDesc_t::fileName
char * fileName
Definition: fileOpr.hpp:27
irods_log.hpp
_rsFileLseek
int _rsFileLseek(rsComm_t *_comm, fileLseekInp_t *_lseek_inp, fileLseekOut_t **_lseek_out)
Definition: rsFileLseek.cpp:81