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)  

rsSubStructFileLseek.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileLseek.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
8 // =-=-=-=-=-=-=-
10 
11 
12 int
13 rsSubStructFileLseek( rsComm_t *rsComm, subStructFileLseekInp_t *subStructFileLseekInp,
14  fileLseekOut_t **subStructFileLseekOut ) {
16  int remoteFlag;
17  int status;
18 
19  remoteFlag = resolveHost( &subStructFileLseekInp->addr, &rodsServerHost );
20 
21  if ( remoteFlag == LOCAL_HOST ) {
22  status = _rsSubStructFileLseek( rsComm, subStructFileLseekInp, subStructFileLseekOut );
23  }
24  else if ( remoteFlag == REMOTE_HOST ) {
25  status = remoteSubStructFileLseek( rsComm, subStructFileLseekInp, subStructFileLseekOut,
27  }
28  else {
29  if ( remoteFlag < 0 ) {
30  return remoteFlag;
31  }
32  else {
34  "rsSubStructFileLseek: resolveHost returned unrecognized value %d",
35  remoteFlag );
37  }
38  }
39 
40  return status;
41 }
42 
43 int
45  fileLseekOut_t **subStructFileLseekOut, rodsServerHost_t *rodsServerHost ) {
46  int status;
47 
48  if ( rodsServerHost == NULL ) {
50  "remoteSubStructFileLseek: Invalid rodsServerHost" );
52  }
53 
54  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
55  return status;
56  }
57 
58  status = rcSubStructFileLseek( rodsServerHost->conn, subStructFileLseekInp,
59  subStructFileLseekOut );
60 
61  if ( status < 0 ) {
63  "remoteSubStructFileLseek: rcFileLseek failed for fd %d",
64  subStructFileLseekInp->fd );
65  }
66 
67  return status;
68 }
69 
71  subStructFileLseekInp_t* _lseek_inp,
72  fileLseekOut_t** _lseek_out ) {
73  // =-=-=-=-=-=-=-
74  // create a structured object fco
77  ) );
78  struct_obj->comm( _comm );
79  struct_obj->resc_hier( _lseek_inp->resc_hier );
80  struct_obj->file_descriptor( _lseek_inp->fd );
81 
82  // =-=-=-=-=-=-=-
83  // call lseek interface
84  irods::error lseek_err = fileLseek( _comm,
85  struct_obj,
86  _lseek_inp->offset,
87  _lseek_inp->whence );
88  if ( !lseek_err.ok() ) {
89  std::stringstream msg;
90  msg << "fileLseek failed for fd [";
91  msg << struct_obj->file_descriptor();
92  msg << "]";
93  irods::log( PASSMSG( msg.str(), lseek_err ) );
94  return lseek_err.code();
95 
96  }
97  else {
98  // =-=-=-=-=-=-=-
99  // allocate outgoing lseek buffer
100  if ( ! *_lseek_out ) {
101  *_lseek_out = new fileLseekOut_t;
102  memset( *_lseek_out, 0, sizeof( fileLseekOut_t ) );
103  }
104 
105  ( *_lseek_out )->offset = lseek_err.code();
106  return 0;
107 
108  }
109 
110 }
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
SubStructFileLseekInp::addr
rodsHostAddr_t addr
Definition: subStructFileLseek.h:11
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
rcSubStructFileLseek
int rcSubStructFileLseek(rcComm_t *conn, subStructFileLseekInp_t *subStructFileLseekInp, fileLseekOut_t **subStructFileLseekOut)
Definition: rcSubStructFileLseek.cpp:24
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
SubStructFileLseekInp::offset
rodsLong_t offset
Definition: subStructFileLseek.h:14
SubStructFileLseekInp::resc_hier
char resc_hier[(1024+64)]
Definition: subStructFileLseek.h:16
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
subStructFileLseek.h
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
fileLseek
irods::error fileLseek(rsComm_t *, irods::first_class_object_ptr, long long, int)
Definition: fileDriver.cpp:238
fileLseekOut_t
struct FileLseekOut fileLseekOut_t
irods::error::code
long long code() const
Definition: irods_error.cpp:194
irods::structured_object
Definition: irods_structured_object.hpp:15
_rsSubStructFileLseek
int _rsSubStructFileLseek(rsComm_t *_comm, subStructFileLseekInp_t *_lseek_inp, fileLseekOut_t **_lseek_out)
Definition: rsSubStructFileLseek.cpp:70
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
SubStructFileLseekInp
Definition: subStructFileLseek.h:10
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::structured_object_ptr
boost::shared_ptr< structured_object > structured_object_ptr
Definition: irods_structured_object.hpp:107
rsSubStructFileLseek.hpp
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
remoteSubStructFileLseek
int remoteSubStructFileLseek(rsComm_t *rsComm, subStructFileLseekInp_t *subStructFileLseekInp, fileLseekOut_t **subStructFileLseekOut, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileLseek.cpp:44
irods::error
Definition: irods_error.hpp:23
FileLseekOut
Definition: fileLseek.h:53
miscServerFunct.hpp
rsSubStructFileLseek
int rsSubStructFileLseek(rsComm_t *rsComm, subStructFileLseekInp_t *subStructFileLseekInp, fileLseekOut_t **subStructFileLseekOut)
Definition: rsSubStructFileLseek.cpp:13
SubStructFileLseekInp::fd
int fd
Definition: subStructFileLseek.h:13
rodsServerHost
Definition: rodsConnect.h:62
irods_structured_object.hpp
dataObjOpr.hpp
SubStructFileLseekInp::whence
int whence
Definition: subStructFileLseek.h:15
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375