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)  

rsSubStructFileStat.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileStat.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
9 #include "irods_stacktrace.hpp"
10 
11 
12 
13 int
14 rsSubStructFileStat( rsComm_t *rsComm, subFile_t *subFile, rodsStat_t **subStructFileStatOut ) {
16  int remoteFlag;
17  int status;
18  remoteFlag = resolveHost( &subFile->addr, &rodsServerHost );
19 
20  if ( remoteFlag == LOCAL_HOST ) {
21  status = _rsSubStructFileStat( rsComm, subFile, subStructFileStatOut );
22  }
23  else if ( remoteFlag == REMOTE_HOST ) {
24  status = remoteSubStructFileStat( rsComm, subFile, subStructFileStatOut,
26  }
27  else {
28  if ( remoteFlag < 0 ) {
29  return remoteFlag;
30  }
31  else {
33  "rsSubStructFileStat: resolveHost returned unrecognized value %d",
34  remoteFlag );
36  }
37  }
38 
39  return status;
40 }
41 
42 int
44  rodsStat_t **subStructFileStatOut, rodsServerHost_t *rodsServerHost ) {
45  int status;
46 
47  if ( rodsServerHost == NULL ) {
49  "remoteSubStructFileStat: Invalid rodsServerHost" );
51  }
52 
53  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
54  return status;
55  }
56 
57  status = rcSubStructFileStat( rodsServerHost->conn, subFile, subStructFileStatOut );
58 
59  if ( status < 0 && getErrno( status ) != ENOENT ) {
61  "remoteSubStructFileStat: rcSubStructFileStat failed for %s, status = %d",
62  subFile->subFilePath, status );
63  }
64 
65  return status;
66 }
67 
69  subFile_t* _sub_file,
70  rodsStat_t** _stat_out ) {
71  // =-=-=-=-=-=-=-
72  // create first class structured object
75  *_sub_file ) );
76  struct_obj->comm( _comm );
77  struct_obj->resc_hier( _sub_file->specColl->rescHier );
78 
79  // =-=-=-=-=-=-=-
80  // call abstracted interface to stat
81  struct stat my_stat;
82  irods::error stat_err = fileStat( _comm, struct_obj, &my_stat );
83 
84  if ( !stat_err.ok() ) {
85  // errors are expected
86  return stat_err.code();
87 
88  }
89  else {
90 
91  // =-=-=-=-=-=-=-
92  // convert unix stat struct to an irods stat struct
93  *_stat_out = (rodsStat_t*) malloc( sizeof( rodsStat_t ) );
94  int status = statToRodsStat( *_stat_out, &my_stat );
95 
96  // =-=-=-=-=-=-=-
97  // manage error if necessary
98  if ( status < 0 ) {
99  free( *_stat_out );
100  *_stat_out = NULL;
101  }
102 
103  return status;
104 
105  }
106 
107 }
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
Subfile
Definition: objInfo.h:316
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
_rsSubStructFileStat
int _rsSubStructFileStat(rsComm_t *_comm, subFile_t *_sub_file, rodsStat_t **_stat_out)
Definition: rsSubStructFileStat.cpp:68
irods_stacktrace.hpp
Subfile::subFilePath
char subFilePath[(1024+64)]
Definition: objInfo.h:318
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
Subfile::specColl
specColl_t * specColl
Definition: objInfo.h:322
rsSubStructFileStat
int rsSubStructFileStat(rsComm_t *rsComm, subFile_t *subFile, rodsStat_t **subStructFileStatOut)
Definition: rsSubStructFileStat.cpp:14
statToRodsStat
int statToRodsStat(rodsStat_t *rodsStat, struct stat *myFileStat)
Definition: rcMisc.cpp:280
rodsStat
Definition: rodsType.h:52
rcSubStructFileStat
int rcSubStructFileStat(rcComm_t *conn, subFile_t *subFile, rodsStat_t **subStructFileStatOut)
Definition: rcSubStructFileStat.cpp:24
irods::structured_object
Definition: irods_structured_object.hpp:15
getErrno
int getErrno(int errCode)
Definition: rcMisc.cpp:3261
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
Subfile::addr
rodsHostAddr_t addr
Definition: objInfo.h:317
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
irods::structured_object_ptr
boost::shared_ptr< structured_object > structured_object_ptr
Definition: irods_structured_object.hpp:107
rsSubStructFileStat.hpp
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
fileStat
irods::error fileStat(rsComm_t *, irods::first_class_object_ptr, struct stat *)
Definition: fileDriver.cpp:207
subStructFileStat.h
rodsServerHost
Definition: rodsConnect.h:62
remoteSubStructFileStat
int remoteSubStructFileStat(rsComm_t *rsComm, subFile_t *subFile, rodsStat_t **subStructFileStatOut, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileStat.cpp:43
irods_structured_object.hpp
dataObjOpr.hpp
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375