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)  

rsPhyPathReg.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See phyPathReg.h for a description of this API call.*/
5 
6 #include "fileStat.h"
7 #include "phyPathReg.h"
8 #include "rodsLog.h"
9 #include "icatDefines.h"
10 #include "objMetaOpr.hpp"
11 #include "dataObjOpr.hpp"
12 #include "collection.hpp"
13 #include "specColl.hpp"
14 #include "resource.hpp"
15 #include "physPath.hpp"
16 #include "rsGlobalExtern.hpp"
17 #include "rcGlobalExtern.h"
18 #include "rsPhyPathReg.hpp"
19 #include "miscServerFunct.hpp"
20 #include "apiHeaderAll.h"
21 #include "rsRegReplica.hpp"
22 #include "rsCollCreate.hpp"
23 #include "rsFileOpendir.hpp"
24 #include "rsFileReaddir.hpp"
25 #include "rsFileStat.hpp"
26 #include "rsFileMkdir.hpp"
27 #include "rsFileClosedir.hpp"
28 #include "rsRegDataObj.hpp"
29 #include "rsModColl.hpp"
30 #include "rsRegColl.hpp"
31 #include "rsModAccessControl.hpp"
32 #include "rsDataObjCreate.hpp"
33 #include "rsDataObjClose.hpp"
34 #include "rsRegColl.hpp"
35 #include "rsSubStructFileStat.hpp"
36 #include "rsSyncMountedColl.hpp"
37 #include "rsFileOpen.hpp"
38 #include "rsFileRead.hpp"
39 #include "rsFileClose.hpp"
40 
41 // =-=-=-=-=-=-=-
45 
46 #define IRODS_FILESYSTEM_ENABLE_SERVER_SIDE_API
47 #include "filesystem.hpp"
48 
49 #include "boost/lexical_cast.hpp"
50 
51 // =-=-=-=-=-=-=-
52 // stl includes
53 #include <iostream>
54 
55 /* holds a struct that describes pathname match patterns
56  to exclude from registration. Needs to be global due
57  to the recursive dirPathReg() calls. */
59 
60 /* function to read pattern file from a data server */
62 readPathnamePatternsFromFile( rsComm_t *rsComm, char *filename, char* );
63 
64 /* phyPathRegNoChkPerm - Wrapper internal function to allow phyPathReg with
65  * no checking for path Perm.
66  */
67 int
68 phyPathRegNoChkPerm( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp ) {
69  int status;
70 
71  addKeyVal( &phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW, "" );
72 
73  status = irsPhyPathReg( rsComm, phyPathRegInp );
74  return status;
75 }
76 
77 int
78 rsPhyPathReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp ) {
79  int status;
80 
81  if ( getValByKey( &phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW ) != NULL &&
83  return SYS_NO_API_PRIV;
84  }
85 
86  status = irsPhyPathReg( rsComm, phyPathRegInp );
87  return status;
88 }
89 
90 int
91 irsPhyPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
92 {
93  namespace fs = irods::experimental::filesystem;
94 
95  // Also covers checking of empty paths.
96  if (fs::path{phyPathRegInp->objPath}.object_name().empty()) {
97  return USER_INPUT_PATH_ERR;
98  }
99 
100  int status;
102  int remoteFlag;
103  rodsHostAddr_t addr;
104 
105  // =-=-=-=-=-=-=-
106  // NOTE:: resource_redirect can wipe out the specColl due to a call to getDataObjIncSpecColl
107  // which nullifies the specColl in the case of certain special collections ( LINKED ).
108  // this block of code needs to be called before redirect to handle that case as it doesnt
109  // need the resource hierarchy anyway. this is the sort of thing i'd like to avoid in
110  // the future
111 
112  char* coll_type = getValByKey( &phyPathRegInp->condInput, COLLECTION_TYPE_KW );
113 
114  if ( coll_type && strcmp( coll_type, UNMOUNT_STR ) == 0 ) {
115  status = unmountFileDir( rsComm, phyPathRegInp );
116  return status;
117 
118  }
119  else if ( coll_type != NULL && strcmp( coll_type, LINK_POINT_STR ) == 0 ) {
120  status = linkCollReg( rsComm, phyPathRegInp );
121  return status;
122 
123  }
124 
125  // =-=-=-=-=-=-=-
126  // determine if a hierarchy has been passed by kvp, if so use it.
127  // otherwise determine a resource hierarchy given dst hier or default resource
128  std::string hier;
129  char* tmp_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
130  if ( NULL == tmp_hier ) {
131  // =-=-=-=-=-=-=-
132  // if no hier is provided, determine if a resource was specified
133  char* dst_resc = getValByKey( &phyPathRegInp->condInput, DEST_RESC_NAME_KW );
134  if ( dst_resc ) {
135  // =-=-=-=-=-=-=-
136  // if we do have a dest resc, see if it has a parent or a child
137  irods::resource_ptr resc;
138  irods::error ret = resc_mgr.resolve( dst_resc, resc );
139  if ( !ret.ok() ) {
140  irods::log( PASS( ret ) );
141  return ret.code();
142  }
143 
144  // =-=-=-=-=-=-=-
145  // get parent
146  irods::resource_ptr parent_resc;
147  ret = resc->get_parent( parent_resc );
148  bool has_parent = ret.ok();
149 
150  // =-=-=-=-=-=-=-
151  // get child
152  bool has_child = ( resc->num_children() > 0 );
153 
154  // =-=-=-=-=-=-=-
155  // if the resc is mid-tier this is a Bad Thing
156  if ( has_parent && has_child ) {
157  return HIERARCHY_ERROR;
158  }
159  // =-=-=-=-=-=-=-
160  // this is a leaf node situation
161  else if ( has_parent && !has_child ) {
162  // =-=-=-=-=-=-=-
163  // get the path from our parent resource
164  // to this given leaf resource - this our hier
166  dst_resc,
167  hier );
168  if(!ret.ok()) {
169  irods::log(PASS(ret));
170  return ret.code();
171  }
172 
173  addKeyVal(
174  &phyPathRegInp->condInput,
176  hier.c_str() );
177 
178  // =-=-=-=-=-=-=-
179  // get the root resc of the hier, this is the
180  // new resource name
181  std::string root_resc;
183  parser.set_string( hier );
184  parser.first_resc( root_resc );
185  addKeyVal(
186  &phyPathRegInp->condInput,
188  root_resc.c_str() );
189 
190  }
191  // =-=-=-=-=-=-=-
192  // this is a solo node situation
193  else if ( !has_parent && !has_child ) {
194  hier = dst_resc;
195  addKeyVal(
196  &phyPathRegInp->condInput,
198  hier.c_str() );
199  }
200  // =-=-=-=-=-=-=-
201  // root node and pathological situation
202  else {
205  rsComm,
206  phyPathRegInp,
207  hier );
208  if ( !ret.ok() ) {
209  std::string msg( "failed for [" );
210  msg += phyPathRegInp->objPath;
211  msg += "]";
212  irods::log( PASSMSG( msg, ret ) );
213  return ret.code();
214  }
215 
216  addKeyVal(
217  &phyPathRegInp->condInput,
219  hier.c_str() );
220  }
221 
222  } // if dst_resc
223  else {
224  // =-=-=-=-=-=-=-
225  // no resc is specified, request a hierarchy given the default resource
226  irods::file_object_ptr file_obj( new irods::file_object() );
229  rsComm,
230  phyPathRegInp,
231  hier );
232  if ( !ret.ok() ) {
233  std::string msg( "failed for [" );
234  msg += phyPathRegInp->objPath;
235  msg += "]";
236  irods::log( PASSMSG( msg, ret ) );
237  return ret.code();
238  }
239 
240  // =-=-=-=-=-=-=-
241  // we resolved the redirect and have a host, set the hier str for subsequent
242  // api calls, etc.
243  addKeyVal( &phyPathRegInp->condInput, RESC_HIER_STR_KW, hier.c_str() );
244 
245  } // else
246 
247  } // if tmp_hier
248  // =-=-=-=-=-=-=-
249  // we have been handed a hierarchy, pass it on
250  else {
251  hier = tmp_hier;
252  }
253 
254  // =-=-=-=-=-=-=-
255  // coll registration requires the resource hierarchy
256  if ( coll_type && ( strcmp( coll_type, HAAW_STRUCT_FILE_STR ) == 0 ||
257  strcmp( coll_type, TAR_STRUCT_FILE_STR ) == 0 ||
258  strcmp( coll_type, MSSO_STRUCT_FILE_STR ) == 0 ) ) {
259  status = structFileReg( rsComm, phyPathRegInp );
260  return status;
261  }
262 
263  // =-=-=-=-=-=-=-
264  rodsLong_t resc_id = 0;
265  irods::error ret = resc_mgr.hier_to_leaf_id(hier,resc_id);
266  if(!ret.ok()) {
267  return ret.code();
268  }
269 
270  std::string location;
271  ret = irods::get_resource_property< std::string >(
272  resc_id,
274  location );
275  if ( !ret.ok() ) {
276  irods::log( PASSMSG( "failed in get_resource_property", ret ) );
277  return ret.code();
278  }
279 
280  memset( &addr, 0, sizeof( addr ) );
281  rstrcpy( addr.hostAddr, location.c_str(), LONG_NAME_LEN );
282  remoteFlag = resolveHost( &addr, &rodsServerHost );
283 
284  // We do not need to redirect if we do not need to stat the file which is to be registered
285  const auto size_kw{getValByKey(&phyPathRegInp->condInput, DATA_SIZE_KW)};
286  if ( size_kw || remoteFlag == LOCAL_HOST ) {
288  p.set_string(hier);
289  std::string leaf_resc;
290  p.last_resc(leaf_resc);
291  status = _rsPhyPathReg( rsComm, phyPathRegInp, leaf_resc.c_str(), rodsServerHost );
292 
293  }
294  else if ( remoteFlag == REMOTE_HOST ) {
295  status = remotePhyPathReg( rsComm, phyPathRegInp, rodsServerHost );
296 
297  }
298  else {
299  if ( remoteFlag < 0 ) {
300  return remoteFlag;
301  }
302  else {
304  "rsPhyPathReg: resolveHost returned unrecognized value %d",
305  remoteFlag );
307  }
308  }
309 
310  return status;
311 }
312 
313 int
314 remotePhyPathReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp,
316  int status;
317 
318  if ( rodsServerHost == NULL ) {
320  "remotePhyPathReg: Invalid rodsServerHost" );
322  }
323 
324  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
325  return status;
326  }
327 
328  status = rcPhyPathReg( rodsServerHost->conn, phyPathRegInp );
329 
330  if ( status < 0 ) {
332  "remotePhyPathReg: rcPhyPathReg failed for %s",
333  phyPathRegInp->objPath );
334  }
335 
336  return status;
337 }
338 
339 int
340 _rsPhyPathReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp,
341  const char *_resc_name, rodsServerHost_t *rodsServerHost ) {
342  int status = 0;
343  fileOpenInp_t chkNVPathPermInp;
344  char *tmpFilePath = 0;
345  char filePath[MAX_NAME_LEN];
346  dataObjInfo_t dataObjInfo;
347  char *tmpStr = NULL;
348  int chkType = 0; // JMC - backport 4774
349  char *excludePatternFile = 0;
350 
351  if ( ( tmpFilePath = getValByKey( &phyPathRegInp->condInput, FILE_PATH_KW ) ) == NULL ) {
352  rodsLog( LOG_ERROR, "_rsPhyPathReg: No filePath input for %s",
353  phyPathRegInp->objPath );
354  return SYS_INVALID_FILE_PATH;
355  }
356  else {
357  /* have to do this since it will be over written later */
358  rstrcpy( filePath, tmpFilePath, MAX_NAME_LEN );
359  }
360 
361  /* check if we need to chk permission */
362  memset( &dataObjInfo, 0, sizeof( dataObjInfo ) );
363  rstrcpy( dataObjInfo.objPath, phyPathRegInp->objPath, MAX_NAME_LEN );
364  rstrcpy( dataObjInfo.filePath, filePath, MAX_NAME_LEN );
365  rstrcpy( dataObjInfo.rescName, _resc_name, NAME_LEN );
366 
367  char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
368  if ( resc_hier ) {
369  rstrcpy( dataObjInfo.rescHier, resc_hier, MAX_NAME_LEN );
370  }
371  else {
372  rodsLog( LOG_NOTICE, "_rsPhyPathReg :: RESC_HIER_STR_KW is NULL" );
374  }
375 
376  irods::error ret = resc_mgr.hier_to_leaf_id(resc_hier,dataObjInfo.rescId);
377  if( !ret.ok() ) {
378  irods::log(PASS(ret));
379  }
380 
381  if ( getValByKey( &phyPathRegInp->condInput, NO_CHK_FILE_PERM_KW ) == NULL &&
382  ( chkType = getchkPathPerm( rsComm, phyPathRegInp, &dataObjInfo ) ) != NO_CHK_PATH_PERM ) { // JMC - backport 4774
383 
384  memset( &chkNVPathPermInp, 0, sizeof( chkNVPathPermInp ) );
385 
386  rstrcpy( chkNVPathPermInp.fileName, filePath, MAX_NAME_LEN );
387 
388  // =-=-=-=-=-=-=-
389  // extract the host location from the resource hierarchy
390  std::string location;
391  irods::error ret = irods::get_loc_for_hier_string( resc_hier, location );
392  if ( !ret.ok() ) {
393  irods::log( PASSMSG( "_rsPhyPathReg - failed in get_loc_for_hier_string", ret ) );
394  return ret.code();
395  }
396 
397  rstrcpy( chkNVPathPermInp.addr.hostAddr, location.c_str(), NAME_LEN );
398  status = chkFilePathPerm( rsComm, &chkNVPathPermInp, rodsServerHost, chkType ); // JMC - backport 4774
399 
400  if ( status < 0 ) {
402  "_rsPhyPathReg: chkFilePathPerm error for %s",
403  phyPathRegInp->objPath );
404  return status;
405  }
406  }
407  else {
408  status = 0;
409  }
410 
411  if ( getValByKey( &phyPathRegInp->condInput, COLLECTION_KW ) != NULL ) {
412  excludePatternFile = getValByKey( &phyPathRegInp->condInput, EXCLUDE_FILE_KW );
413  if ( excludePatternFile != NULL ) {
415  excludePatternFile,
416  resc_hier );
417  }
418 
419  status = dirPathReg( rsComm, phyPathRegInp, filePath, _resc_name );
420  if ( excludePatternFile != NULL ) {
423  }
424 
425  }
426  else if ( ( tmpStr = getValByKey( &phyPathRegInp->condInput, COLLECTION_TYPE_KW ) ) != NULL && strcmp( tmpStr, MOUNT_POINT_STR ) == 0 ) {
427  rodsLong_t resc_id = 0;
428  ret = resc_mgr.hier_to_leaf_id(_resc_name,resc_id);
429  if(!ret.ok()) {
430  return ret.code();
431  }
432 
433  // Get resource path
434  std::string resc_vault_path;
435  irods::error ret = irods::get_resource_property< std::string >( resc_id, irods::RESOURCE_PATH, resc_vault_path );
436  if ( !ret.ok() ) {
437  irods::log PASSMSG( "_rsPhyPathReg - failed in get_resource_property", ret );
438  return ret.code();
439  }
440 
441  status = mountFileDir( rsComm, phyPathRegInp, filePath, resc_vault_path.c_str() );
442 
443  }
444  else {
445  if ( getValByKey( &phyPathRegInp->condInput, REG_REPL_KW ) != NULL ) {
446  status = filePathRegRepl( rsComm, phyPathRegInp, filePath, _resc_name );
447  }
448  else {
449  status = filePathReg( rsComm, phyPathRegInp, _resc_name );
450  }
451  }
452 
453  return status;
454 }
455 
456 int
457 filePathRegRepl( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
458  const char *_resc_name ) {
459  dataObjInfo_t destDataObjInfo, *dataObjInfoHead = NULL;
460  regReplica_t regReplicaInp;
461  int status;
462 
463  char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
464  if ( !resc_hier ) {
465  rodsLog( LOG_NOTICE, "filePathRegRepl - RESC_HIER_STR_KW is NULL" );
467  }
468 
469  status = getDataObjInfo( rsComm, phyPathRegInp, &dataObjInfoHead,
470  ACCESS_READ_OBJECT, 0 );
471  if ( status < 0 ) {
473  "filePathRegRepl: getDataObjInfo for %s", phyPathRegInp->objPath );
474  return status;
475  }
476 
477  status = sortObjInfoForOpen( &dataObjInfoHead, &phyPathRegInp->condInput, 0 );
478  if ( status < 0 ) {
479  // =-=-=-=-=-=-=-
480  // we perhaps did not match the hier string but
481  // we can still continue as we have a good copy
482  // for a read
483  if ( NULL == dataObjInfoHead ) {
484  return status; // JMC cppcheck - nullptr
485  }
486  }
487 
488  destDataObjInfo = *dataObjInfoHead;
489  rstrcpy( destDataObjInfo.filePath, filePath, MAX_NAME_LEN );
490  rstrcpy( destDataObjInfo.rescName, _resc_name, NAME_LEN );
491  rstrcpy( destDataObjInfo.rescHier, resc_hier, MAX_NAME_LEN );
492  irods::error ret = resc_mgr.hier_to_leaf_id(resc_hier,destDataObjInfo.rescId);
493  if( !ret.ok() ) {
494  irods::log(PASS(ret));
495  }
496 
497  memset( &regReplicaInp, 0, sizeof( regReplicaInp ) );
498  regReplicaInp.srcDataObjInfo = dataObjInfoHead;
499  regReplicaInp.destDataObjInfo = &destDataObjInfo;
500  if ( getValByKey( &phyPathRegInp->condInput, SU_CLIENT_USER_KW ) != NULL ) {
501  addKeyVal( &regReplicaInp.condInput, SU_CLIENT_USER_KW, "" );
502  addKeyVal( &regReplicaInp.condInput, ADMIN_KW, "" );
503  }
504  else if ( getValByKey( &phyPathRegInp->condInput,
505  ADMIN_KW ) != NULL ) {
506  addKeyVal( &regReplicaInp.condInput, ADMIN_KW, "" );
507  }
508  // Data size can be passed via DATA_SIZE_KW to save a stat later
509  const auto data_size_str = getValByKey(&phyPathRegInp->condInput, DATA_SIZE_KW);
510  if (nullptr != data_size_str) {
511  addKeyVal(&regReplicaInp.condInput, DATA_SIZE_KW, data_size_str);
512  }
513  status = rsRegReplica( rsComm, &regReplicaInp );
514  clearKeyVal( &regReplicaInp.condInput );
515  freeAllDataObjInfo( dataObjInfoHead );
516 
517  return status;
518 }
519 
520 int
521 filePathReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, const char *_resc_name ) {
522  dataObjInfo_t dataObjInfo;
523  memset( &dataObjInfo, 0, sizeof( dataObjInfo ) );
524 
525  int status;
526  char *chksum = NULL;
527  initDataObjInfoWithInp( &dataObjInfo, phyPathRegInp );
528 
529  dataObjInfo.replStatus = NEWLY_CREATED_COPY;
530  rstrcpy( dataObjInfo.rescName, _resc_name, NAME_LEN );
531 
532  char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
533  if ( !resc_hier ) {
534  rodsLog( LOG_NOTICE, "filePathReg - RESC_HIER_STR_KW is NULL" );
536  }
537 
538  rstrcpy( dataObjInfo.rescHier, resc_hier, MAX_NAME_LEN );
539  irods::error ret = resc_mgr.hier_to_leaf_id(resc_hier,dataObjInfo.rescId);
540  if( !ret.ok() ) {
541  irods::log(PASS(ret));
542  }
543 
544  auto data_size_str{getValByKey(&phyPathRegInp->condInput, DATA_SIZE_KW)};
545  try {
546  if (data_size_str) {
547  dataObjInfo.dataSize = boost::lexical_cast<decltype(dataObjInfo.dataSize)>(data_size_str);
548  }
549  }
550  catch (boost::bad_lexical_cast&) {
551  rodsLog(LOG_ERROR, "[%s] - bad_lexical_cast for dataSize [%s]; setting to 0", __FUNCTION__, data_size_str);
552  dataObjInfo.dataSize = 0;
553  data_size_str = nullptr;
554  }
555 
556  if ( nullptr == data_size_str &&
557  dataObjInfo.dataSize <= 0 &&
558  ( dataObjInfo.dataSize = getFileMetadataFromVault( rsComm, &dataObjInfo ) ) < 0 &&
559  dataObjInfo.dataSize != UNKNOWN_FILE_SZ ) {
560  status = ( int ) dataObjInfo.dataSize;
562  "filePathReg: getFileMetadataFromVault for %s failed, status = %d",
563  dataObjInfo.objPath, status );
564  clearKeyVal( &dataObjInfo.condInput );
565  return status;
566  }
567 
568  const auto data_modify_str{getValByKey(&phyPathRegInp->condInput, DATA_MODIFY_KW)};
569  if (NULL != data_modify_str) {
570  strcpy(dataObjInfo.dataModify, data_modify_str);
571  }
572 
573  if ( ( getValByKey( &phyPathRegInp->condInput, REG_CHKSUM_KW ) != NULL ) ||
574  ( getValByKey( &phyPathRegInp->condInput, VERIFY_CHKSUM_KW ) != NULL ) ) {
575  chksum = 0;
576  status = _dataObjChksum( rsComm, &dataObjInfo, &chksum );
577  if ( status < 0 ) {
579  "filePathReg: _dataObjChksum for %s failed, status = %d",
580  dataObjInfo.objPath, status );
581  clearKeyVal( &dataObjInfo.condInput );
582  return status;
583  }
584  rstrcpy( dataObjInfo.chksum, chksum, NAME_LEN );
585  }
586 
587  status = svrRegDataObj( rsComm, &dataObjInfo );
588  if ( status < 0 ) {
590  "filePathReg: svrRegDataObj for %s failed, status = %d",
591  dataObjInfo.objPath, status );
592  }
593  else {
594  ruleExecInfo_t rei;
595  initReiWithDataObjInp( &rei, rsComm, phyPathRegInp );
596  rei.doi = &dataObjInfo;
597  rei.status = status;
598 
599  // make resource properties available as rule session variables
601 
602  rei.status = applyRule( "acPostProcForFilePathReg", NULL, &rei,
603  NO_SAVE_REI );
605  free(rei.condInputData);
606 
607  }
608 
609  clearKeyVal( &dataObjInfo.condInput );
610 
611  return status;
612 }
613 
614 int
615 dirPathReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath,
616  const char *_resc_name ) {
617  fileStatInp_t fileStatInp;
618  collInp_t collCreateInp;
619  fileOpendirInp_t fileOpendirInp;
620  fileClosedirInp_t fileClosedirInp;
621  int status;
622  int dirFd;
623  dataObjInp_t subPhyPathRegInp;
624  fileReaddirInp_t fileReaddirInp;
626  rodsObjStat_t *rodsObjStatOut = NULL;
627  int forceFlag;
628 
629  char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
630  if ( !resc_hier ) {
631  rodsLog( LOG_NOTICE, "dirPathReg - RESC_HIER_STR_KW is NULL" );
633  }
634 
635  // =-=-=-=-=-=-=-
636  // extract the host location from the resource hierarchy
637  std::string location;
638  irods::error ret = irods::get_loc_for_hier_string( resc_hier, location );
639  if ( !ret.ok() ) {
640  irods::log( PASSMSG( "dirPathReg - failed in get_loc_for_hier_string", ret ) );
642  }
643 
644  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
645  if ( status < 0 || NULL == rodsObjStatOut ) { // JMC cppcheck - nullptr
646  freeRodsObjStat( rodsObjStatOut );
647  rodsObjStatOut = NULL;
648  memset( &collCreateInp, 0, sizeof( collCreateInp ) );
649  rstrcpy( collCreateInp.collName, phyPathRegInp->objPath,
650  MAX_NAME_LEN );
651 
652  /* no need to resolve sym link */ // JMC - backport 4845
653  addKeyVal( &collCreateInp.condInput, TRANSLATED_PATH_KW, "" ); // JMC - backport 4845
654 
655  /* stat the source directory to track the */
656  /* original directory meta-data */
657  memset( &fileStatInp, 0, sizeof( fileStatInp ) );
658  rstrcpy( fileStatInp.fileName, filePath, MAX_NAME_LEN );
659 
660  // Get resource location
661  rodsLong_t resc_id = 0;
662  ret = resc_mgr.hier_to_leaf_id(_resc_name,resc_id);
663  if(!ret.ok()) {
664  return ret.code();
665  }
666  std::string location;
667  irods::error ret = irods::get_resource_property< std::string >( resc_id, irods::RESOURCE_LOCATION, location );
668  if ( !ret.ok() ) {
669  irods::log PASSMSG( "dirPathReg - failed in get_resource_property", ret );
670  return ret.code();
671  }
672 
673  snprintf( fileStatInp.addr.hostAddr, NAME_LEN, "%s", location.c_str() );
674 
675 
676  rstrcpy( fileStatInp.rescHier, resc_hier, MAX_NAME_LEN );
677  rstrcpy( fileStatInp.objPath, phyPathRegInp->objPath, MAX_NAME_LEN );
678 
679  /* create the coll just in case it does not exist */
680  status = rsCollCreate( rsComm, &collCreateInp );
681  clearKeyVal( &collCreateInp.condInput ); // JMC - backport 4835
682  if ( status < 0 ) {
683  return status;
684  }
685  }
686  else if ( rodsObjStatOut->specColl != NULL ) {
687  freeRodsObjStat( rodsObjStatOut );
689  "mountFileDir: %s already mounted", phyPathRegInp->objPath );
691  }
692  freeRodsObjStat( rodsObjStatOut );
693  rodsObjStatOut = NULL;
694 
695  memset( &fileOpendirInp, 0, sizeof( fileOpendirInp ) );
696 
697  rstrcpy( fileOpendirInp.dirName, filePath, MAX_NAME_LEN );
698  rstrcpy( fileOpendirInp.addr.hostAddr, location.c_str(), NAME_LEN );
699  rstrcpy( fileOpendirInp.objPath, phyPathRegInp->objPath, MAX_NAME_LEN );
700  rstrcpy( fileOpendirInp.resc_hier_, resc_hier, MAX_NAME_LEN );
701 
702  dirFd = rsFileOpendir( rsComm, &fileOpendirInp );
703  if ( dirFd < 0 ) {
705  "dirPathReg: rsFileOpendir for %s error, status = %d",
706  filePath, dirFd );
707  return dirFd;
708  }
709 
710  fileReaddirInp.fileInx = dirFd;
711 
712  if ( getValByKey( &phyPathRegInp->condInput, FORCE_FLAG_KW ) != NULL ) {
713  forceFlag = 1;
714  }
715  else {
716  forceFlag = 0;
717  }
718 
719  while ( ( status = rsFileReaddir( rsComm, &fileReaddirInp, &rodsDirent ) ) >= 0 ) {
720 
721  if ( NULL == rodsDirent || strlen( rodsDirent->d_name ) == 0 ) {
722  free( rodsDirent );
723  break;
724  }
725 
726  if ( strcmp( rodsDirent->d_name, "." ) == 0 ||
727  strcmp( rodsDirent->d_name, ".." ) == 0 ) {
728  free( rodsDirent ); // JMC - backport 4835
729  continue;
730  }
731 
732  subPhyPathRegInp = *phyPathRegInp;
733  snprintf( subPhyPathRegInp.objPath, MAX_NAME_LEN, "%s/%s",
734  phyPathRegInp->objPath, rodsDirent->d_name );
735 
736  if ( matchPathname( ExcludePatterns, rodsDirent->d_name, filePath ) ) {
737  free( rodsDirent );
738  continue;
739  }
740 
741  fileStatInp_t fileStatInp;
742  memset( &fileStatInp, 0, sizeof( fileStatInp ) );
743 
744  // Issue #3658 - This section removes trailing slashes from the
745  // directory path in the server when the path is already in the catalog.
746  //
747  // TODO: This is a localized fix that addresses any trailing slashes
748  // in inPath. Any future refactoring of the code that deals with paths
749  // would most probably take care of this issue, and the code segment
750  // below would/should then be removed.
751 
752  char tmpStr[MAX_NAME_LEN];
753  rstrcpy( tmpStr, filePath, MAX_NAME_LEN );
754  size_t len = strlen(tmpStr);
755 
756  for (size_t i = len-1; i > 0 && tmpStr[i] == '/'; i--) {
757  tmpStr[i] = '\0';
758  }
759 
760  snprintf( fileStatInp.fileName, MAX_NAME_LEN, "%s/%s", tmpStr, rodsDirent->d_name );
761 
762  rstrcpy( fileStatInp.objPath, subPhyPathRegInp.objPath, MAX_NAME_LEN );
763  fileStatInp.addr = fileOpendirInp.addr;
764  rstrcpy( fileStatInp.rescHier, resc_hier, MAX_NAME_LEN );
765 
766  rodsStat_t *myStat = NULL;
767  status = rsFileStat( rsComm, &fileStatInp, &myStat );
768 
769  if ( status != 0 ) {
771  "dirPathReg: rsFileStat failed for %s, status = %d",
772  fileStatInp.fileName, status );
773  free( rodsDirent ); // JMC - backport 4835
774  return status;
775  }
776 
777  if ( ( myStat->st_mode & S_IFREG ) != 0 ) { /* a file */
778  if ( forceFlag > 0 ) {
779  /* check if it already exists */
780  if ( isData( rsComm, subPhyPathRegInp.objPath, NULL ) >= 0 ) {
781  free( myStat );
782  free( rodsDirent ); // JMC - backport 4835
783  continue;
784  }
785  }
786 
787  subPhyPathRegInp.dataSize = myStat->st_size;
788  std::string reg_func_name;
789 
790  if ( getValByKey( &phyPathRegInp->condInput, REG_REPL_KW ) != NULL ) {
791  reg_func_name = "filePathRegRepl";
792  status = filePathRegRepl( rsComm, &subPhyPathRegInp, fileStatInp.fileName, _resc_name );
793  }
794  else {
795  reg_func_name = "filePathReg";
796  addKeyVal( &subPhyPathRegInp.condInput, FILE_PATH_KW, fileStatInp.fileName );
797  status = filePathReg( rsComm, &subPhyPathRegInp, _resc_name );
798  }
799 
800  if ( status != 0 ) {
801  if ( rsComm->rError.len < MAX_ERROR_MESSAGES ) {
802  char error_msg[ERR_MSG_LEN];
803  snprintf( error_msg, ERR_MSG_LEN, "dirPathReg: %s failed for %s, status = %d",
804  reg_func_name.c_str(), subPhyPathRegInp.objPath, status );
805  addRErrorMsg( &rsComm->rError, status, error_msg );
806  }
807  }
808  }
809  else if ( ( myStat->st_mode & S_IFDIR ) != 0 ) { /* a directory */
810  status = dirPathReg( rsComm, &subPhyPathRegInp,
811  fileStatInp.fileName, _resc_name );
812  }
813 
814  free( myStat );
815  free( rodsDirent ); // JMC - backport 4835
816  }
817 
818  if ( status == -1 ) { /* just EOF */
819  status = 0;
820  }
821 
822  fileClosedirInp.fileInx = dirFd;
823  rsFileClosedir( rsComm, &fileClosedirInp );
824 
825  return status;
826 }
827 
828 int mountFileDir( rsComm_t* rsComm,
829  dataObjInp_t* phyPathRegInp,
830  char* filePath,
831  const char *rescVaultPath ) {
832  collInp_t collCreateInp;
833  int status;
834  fileStatInp_t fileStatInp;
835  rodsStat_t *myStat = NULL;
836  rodsObjStat_t *rodsObjStatOut = NULL;
837 
838  char* resc_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
839  if ( !resc_hier ) {
840  rodsLog( LOG_NOTICE, "mountFileDir - RESC_HIER_STR_KW is NULL" );
842  }
843 
844  // =-=-=-=-=-=-=-
845  // extract the host location from the resource hierarchy
846  std::string location;
847  irods::error ret = irods::get_loc_for_hier_string( resc_hier, location );
848  if ( !ret.ok() ) {
849  irods::log( PASSMSG( "mountFileDir - failed in get_loc_for_hier_string", ret ) );
850  return ret.code();
851  }
852 
853  if ( rsComm->clientUser.authInfo.authFlag < LOCAL_PRIV_USER_AUTH ) { // JMC - backport 4832
854  rodsLog( LOG_NOTICE, "mountFileDir - insufficient privilege" );
856  }
857 
858  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
859  if ( status < 0 || NULL == rodsObjStatOut ) {
860  freeRodsObjStat( rodsObjStatOut );
861  rodsLog( LOG_NOTICE, "mountFileDir collstat failed." );
862  return status; // JMC cppcheck - nullptr
863  }
864 
865  if ( rodsObjStatOut->specColl != NULL ) {
866  freeRodsObjStat( rodsObjStatOut );
868  "mountFileDir: %s already mounted", phyPathRegInp->objPath );
870  }
871  freeRodsObjStat( rodsObjStatOut );
872  rodsObjStatOut = NULL;
873 
874  if ( isCollEmpty( rsComm, phyPathRegInp->objPath ) == False ) {
876  "mountFileDir: collection %s not empty", phyPathRegInp->objPath );
878  }
879 
880  memset( &fileStatInp, 0, sizeof( fileStatInp ) );
881 
882  rstrcpy( fileStatInp.fileName, filePath, MAX_NAME_LEN );
883  rstrcpy( fileStatInp.objPath, phyPathRegInp->objPath, MAX_NAME_LEN );
884  rstrcpy( fileStatInp.addr.hostAddr, location.c_str(), NAME_LEN );
885  rstrcpy( fileStatInp.rescHier, resc_hier, MAX_NAME_LEN );
886 
887 
888  status = rsFileStat( rsComm, &fileStatInp, &myStat );
889 
890  if ( status < 0 ) {
891  fileMkdirInp_t fileMkdirInp;
892 
894  "mountFileDir: rsFileStat failed for %s, status = %d, create it",
895  fileStatInp.fileName, status );
896  memset( &fileMkdirInp, 0, sizeof( fileMkdirInp ) );
897  rstrcpy( fileMkdirInp.dirName, filePath, MAX_NAME_LEN );
898  rstrcpy( fileMkdirInp.rescHier, resc_hier, MAX_NAME_LEN );
899  fileMkdirInp.mode = getDefDirMode();
900  rstrcpy( fileMkdirInp.addr.hostAddr, location.c_str(), NAME_LEN );
901  status = rsFileMkdir( rsComm, &fileMkdirInp );
902  if ( status < 0 ) {
903  return status;
904  }
905  }
906  else if ( ( myStat->st_mode & S_IFDIR ) == 0 ) {
908  "mountFileDir: phyPath %s is not a directory",
909  fileStatInp.fileName );
910  free( myStat );
912  }
913 
914  free( myStat );
915  /* mk the collection */
916 
917  memset( &collCreateInp, 0, sizeof( collCreateInp ) );
918  rstrcpy( collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN );
920 
921  addKeyVal( &collCreateInp.condInput, COLLECTION_INFO1_KW, filePath );
922  addKeyVal( &collCreateInp.condInput, COLLECTION_INFO2_KW, resc_hier );
923 
924  /* try to mod the coll first */
925  status = rsModColl( rsComm, &collCreateInp );
926 
927  if ( status < 0 ) { /* try to create it */
928  rodsLog( LOG_NOTICE, "mountFileDir rsModColl < 0." );
929  status = rsRegColl( rsComm, &collCreateInp );
930  }
931 
932  if ( status >= 0 ) {
933  rodsLog( LOG_NOTICE, "mountFileDir rsModColl > 0." );
934 
935  char outLogPath[MAX_NAME_LEN];
936  int status1;
937  /* see if the phyPath is mapped into a real collection */
938  if ( getLogPathFromPhyPath( filePath, rescVaultPath, outLogPath ) >= 0 &&
939  strcmp( outLogPath, phyPathRegInp->objPath ) != 0 ) {
940  /* log path not the same as input objPath */
941  if ( isColl( rsComm, outLogPath, NULL ) >= 0 ) {
942  modAccessControlInp_t modAccessControl;
943  /* it is a real collection. better set the collection
944  * to read-only mode because any modification to files
945  * through this mounted collection can be trouble */
946  bzero( &modAccessControl, sizeof( modAccessControl ) );
947  modAccessControl.accessLevel = "read";
948  modAccessControl.userName = rsComm->clientUser.userName;
949  modAccessControl.zone = rsComm->clientUser.rodsZone;
950  modAccessControl.path = phyPathRegInp->objPath;
951  status1 = rsModAccessControl( rsComm, &modAccessControl );
952  if ( status1 < 0 ) {
954  "mountFileDir: rsModAccessControl err for %s, stat = %d",
955  phyPathRegInp->objPath, status1 );
956  }
957  }
958  }
959  }
960 
961  rodsLog( LOG_NOTICE, "mountFileDir return status." );
962  return status;
963 }
964 
965 int
966 unmountFileDir( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp ) {
967  int status;
968  collInp_t modCollInp;
969  rodsObjStat_t *rodsObjStatOut = NULL;
970 
971  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
972  if ( status < 0 || NULL == rodsObjStatOut ) { // JMC cppcheck - nullptr
973  free( rodsObjStatOut );
974  return status;
975  }
976  else if ( rodsObjStatOut->specColl == NULL ) {
977  freeRodsObjStat( rodsObjStatOut );
979  "unmountFileDir: %s not mounted", phyPathRegInp->objPath );
981  }
982 
983  if ( getStructFileType( rodsObjStatOut->specColl ) >= 0 ) {
984  status = _rsSyncMountedColl( rsComm, rodsObjStatOut->specColl,
986  if ( status < 0 ) {
987  rodsLog( LOG_ERROR, "unmountFileDir - failed in _rsSyncMountedColl with status %d", status );
988  }
989  }
990 
991  freeRodsObjStat( rodsObjStatOut );
992  rodsObjStatOut = NULL;
993 
994  memset( &modCollInp, 0, sizeof( modCollInp ) );
995  rstrcpy( modCollInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN );
996  addKeyVal( &modCollInp.condInput, COLLECTION_TYPE_KW,
997  "NULL_SPECIAL_VALUE" );
998  addKeyVal( &modCollInp.condInput, COLLECTION_INFO1_KW, "NULL_SPECIAL_VALUE" );
999  addKeyVal( &modCollInp.condInput, COLLECTION_INFO2_KW, "NULL_SPECIAL_VALUE" );
1000 
1001  status = rsModColl( rsComm, &modCollInp );
1002 
1003  return status;
1004 }
1005 
1007  rsComm_t* rsComm,
1008  dataObjInp_t* phyPathRegInp ) {
1009  // =-=-=-=-=-=-=-
1010  //
1011  dataObjInp_t dataObjInp;
1012  collInp_t collCreateInp;
1013  int status = 0;
1014  int len = 0;
1015  char* collType = NULL;
1016  char* structFilePath = NULL;
1017  dataObjInfo_t* dataObjInfo = NULL;
1018  rodsObjStat_t* rodsObjStatOut = NULL;
1019  specCollCache_t* specCollCache = NULL;
1020 
1021  if ( ( structFilePath = getValByKey( &phyPathRegInp->condInput, FILE_PATH_KW ) )
1022  == NULL ) {
1023  rodsLog( LOG_ERROR,
1024  "structFileReg: No structFilePath input for %s",
1025  phyPathRegInp->objPath );
1026  return SYS_INVALID_FILE_PATH;
1027  }
1028 
1029  collType = getValByKey( &phyPathRegInp->condInput, COLLECTION_TYPE_KW );
1030  if ( collType == NULL ) {
1031  rodsLog( LOG_ERROR,
1032  "structFileReg: Bad COLLECTION_TYPE_KW for structFilePath %s",
1033  dataObjInp.objPath );
1035  }
1036 
1037  len = strlen( phyPathRegInp->objPath );
1038  if ( strncmp( structFilePath, phyPathRegInp->objPath, len ) == 0 &&
1039  ( structFilePath[len] == '\0' || structFilePath[len] == '/' ) ) {
1040  rodsLog( LOG_ERROR,
1041  "structFileReg: structFilePath %s inside collection %s",
1042  structFilePath, phyPathRegInp->objPath );
1044  }
1045 
1046  /* see if the struct file is in spec coll */
1047 
1048  if ( getSpecCollCache( rsComm, structFilePath, 0, &specCollCache ) >= 0 ) {
1049  rodsLog( LOG_ERROR,
1050  "structFileReg: structFilePath %s is in a mounted path",
1051  structFilePath );
1053  }
1054 
1055  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
1056  if ( status < 0 || NULL == rodsObjStatOut ) {
1057  free( rodsObjStatOut );
1058  return status; // JMC cppcheck - nullptr
1059  }
1060 
1061  if ( rodsObjStatOut->specColl != NULL ) {
1062  freeRodsObjStat( rodsObjStatOut );
1063  rodsLog( LOG_ERROR,
1064  "structFileReg: %s already mounted", phyPathRegInp->objPath );
1066  }
1067 
1068  freeRodsObjStat( rodsObjStatOut );
1069  rodsObjStatOut = NULL;
1070 
1071  if ( isCollEmpty( rsComm, phyPathRegInp->objPath ) == False ) {
1072  rodsLog( LOG_ERROR,
1073  "structFileReg: collection %s not empty", phyPathRegInp->objPath );
1074  return SYS_COLLECTION_NOT_EMPTY;
1075  }
1076 
1077  memset( &dataObjInp, 0, sizeof( dataObjInp ) );
1078  rstrcpy( dataObjInp.objPath, structFilePath, sizeof( dataObjInp.objPath ) );
1079  /* user need to have write permission */
1080  dataObjInp.openFlags = O_WRONLY;
1081  status = getDataObjInfoIncSpecColl( rsComm, &dataObjInp, &dataObjInfo );
1082  if ( status < 0 || NULL == dataObjInfo ) { // JMC cppcheck - nullptr
1083  int myStatus;
1084  /* try to make one */
1085  dataObjInp.condInput = phyPathRegInp->condInput;
1086  /* have to remove FILE_PATH_KW because getFullPathName will use it */
1087  rmKeyVal( &dataObjInp.condInput, FILE_PATH_KW );
1088  myStatus = rsDataObjCreate( rsComm, &dataObjInp );
1089  if ( myStatus < 0 ) {
1090  rodsLog( LOG_ERROR,
1091  "structFileReg: Problem with open/create structFilePath %s, status = %d",
1092  dataObjInp.objPath, status );
1093  return status;
1094  }
1095  else {
1096  openedDataObjInp_t dataObjCloseInp;
1097  bzero( &dataObjCloseInp, sizeof( dataObjCloseInp ) );
1098  dataObjCloseInp.l1descInx = myStatus;
1099  rsDataObjClose( rsComm, &dataObjCloseInp );
1100  }
1101  }
1102 
1103  char* tmp_hier = getValByKey( &phyPathRegInp->condInput, RESC_HIER_STR_KW );
1104  if ( !tmp_hier ) {
1105  rodsLog( LOG_ERROR, "structFileReg - RESC_HIER_STR_KW is NULL" );
1106  return SYS_INVALID_INPUT_PARAM;
1107  }
1109  parser.set_string( std::string( tmp_hier ) );
1110  std::string resc_name;
1111  parser.last_resc( resc_name );
1112 
1113  /* mk the collection */
1114 
1115  memset( &collCreateInp, 0, sizeof( collCreateInp ) );
1116  rstrcpy( collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN );
1117  addKeyVal( &collCreateInp.condInput, COLLECTION_TYPE_KW, collType );
1118  /* have to use dataObjInp.objPath because structFile path was removed */
1119  addKeyVal( &collCreateInp.condInput, COLLECTION_INFO1_KW, dataObjInp.objPath );
1120 
1121  /* try to mod the coll first */
1122  status = rsModColl( rsComm, &collCreateInp );
1123 
1124  if ( status < 0 ) { /* try to create it */
1125  status = rsRegColl( rsComm, &collCreateInp );
1126  }
1127 
1128  return status;
1129 }
1130 
1131 int
1132 structFileSupport( rsComm_t *rsComm, char *collection, char *collType,
1133  char* resc_hier ) {
1134  int status;
1135  subFile_t subFile;
1136  specColl_t specColl;
1137 
1138  if ( rsComm == NULL || collection == NULL || collType == NULL ||
1139  resc_hier == NULL ) {
1140  return 0;
1141  }
1142 
1143  memset( &subFile, 0, sizeof( subFile ) );
1144  memset( &specColl, 0, sizeof( specColl ) );
1145  /* put in some fake path */
1146  subFile.specColl = &specColl;
1147  rstrcpy( specColl.collection, collection, MAX_NAME_LEN );
1148  specColl.collClass = STRUCT_FILE_COLL;
1149  if ( strcmp( collType, HAAW_STRUCT_FILE_STR ) == 0 ) {
1150  specColl.type = HAAW_STRUCT_FILE_T;
1151  }
1152  else if ( strcmp( collType, TAR_STRUCT_FILE_STR ) == 0 ) {
1153  specColl.type = TAR_STRUCT_FILE_T;
1154  }
1155  else if ( strcmp( collType, MSSO_STRUCT_FILE_STR ) == 0 ) {
1156  specColl.type = MSSO_STRUCT_FILE_T;
1157  }
1158  else {
1159  return 0;
1160  }
1161 
1162  // =-=-=-=-=-=-=-
1163  // extract the host location from the resource hierarchy
1164  std::string location;
1165  irods::error ret = irods::get_loc_for_hier_string( resc_hier, location );
1166  if ( !ret.ok() ) {
1167  irods::log( PASSMSG( "structFileSupport - failed in get_loc_for_hier_string", ret ) );
1168  return ret.code();
1169  }
1170 
1172  parser.set_string( resc_hier );
1173  std::string first_resc;
1174  parser.first_resc( first_resc );
1175 
1176  snprintf( specColl.objPath, MAX_NAME_LEN, "%s/myFakeFile", collection );
1177  rstrcpy( specColl.resource, first_resc.c_str(), NAME_LEN );
1178  rstrcpy( specColl.rescHier, resc_hier, MAX_NAME_LEN );
1179  rstrcpy( specColl.phyPath, "/fakeDir1/fakeDir2/myFakeStructFile", MAX_NAME_LEN );
1180  rstrcpy( subFile.subFilePath, "/fakeDir1/fakeDir2/myFakeFile", MAX_NAME_LEN );
1181  rstrcpy( subFile.addr.hostAddr, location.c_str(), NAME_LEN );
1182 
1183  rodsStat_t *myStat = NULL;
1184  status = rsSubStructFileStat( rsComm, &subFile, &myStat );
1185  free( myStat );
1186  return status != SYS_NOT_SUPPORTED;
1187 }
1188 
1189 int
1190 linkCollReg( rsComm_t *rsComm, dataObjInp_t *phyPathRegInp ) {
1191  collInp_t collCreateInp;
1192  int status;
1193  char *linkPath = NULL;
1194  char *collType;
1195  int len;
1196  rodsObjStat_t *rodsObjStatOut = NULL;
1197  specCollCache_t *specCollCache = NULL;
1198 
1199  if ( ( linkPath = getValByKey( &phyPathRegInp->condInput, FILE_PATH_KW ) )
1200  == NULL ) {
1201  rodsLog( LOG_ERROR,
1202  "linkCollReg: No linkPath input for %s",
1203  phyPathRegInp->objPath );
1204  return SYS_INVALID_FILE_PATH;
1205  }
1206 
1207  collType = getValByKey( &phyPathRegInp->condInput, COLLECTION_TYPE_KW );
1208  if ( collType == NULL || strcmp( collType, LINK_POINT_STR ) != 0 ) {
1209  rodsLog( LOG_ERROR,
1210  "linkCollReg: Bad COLLECTION_TYPE_KW for linkPath %s",
1211  phyPathRegInp->objPath );
1213  }
1214 
1215  if ( phyPathRegInp->objPath[0] != '/' || linkPath[0] != '/' ) {
1216  rodsLog( LOG_ERROR,
1217  "linkCollReg: linkPath %s or collection %s not absolute path",
1218  linkPath, phyPathRegInp->objPath );
1219  return SYS_COLL_LINK_PATH_ERR;
1220  }
1221 
1222  len = strlen( phyPathRegInp->objPath );
1223  if ( strncmp( linkPath, phyPathRegInp->objPath, len ) == 0 &&
1224  linkPath[len] == '/' ) {
1225  rodsLog( LOG_ERROR,
1226  "linkCollReg: linkPath %s inside collection %s",
1227  linkPath, phyPathRegInp->objPath );
1228  return SYS_COLL_LINK_PATH_ERR;
1229  }
1230 
1231  len = strlen( linkPath );
1232  if ( strncmp( phyPathRegInp->objPath, linkPath, len ) == 0 &&
1233  phyPathRegInp->objPath[len] == '/' ) {
1234  rodsLog( LOG_ERROR,
1235  "linkCollReg: collection %s inside linkPath %s",
1236  linkPath, phyPathRegInp->objPath );
1237  return SYS_COLL_LINK_PATH_ERR;
1238  }
1239 
1240  if ( getSpecCollCache( rsComm, linkPath, 0, &specCollCache ) >= 0 &&
1241  specCollCache->specColl.collClass != LINKED_COLL ) {
1242  rodsLog( LOG_ERROR,
1243  "linkCollReg: linkPath %s is in a spec coll path",
1244  linkPath );
1245  return SYS_COLL_LINK_PATH_ERR;
1246  }
1247 
1248  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
1249  if ( status < 0 ) {
1250  freeRodsObjStat( rodsObjStatOut );
1251  rodsObjStatOut = NULL;
1252  /* does not exist. make one */
1253  collInp_t collCreateInp;
1254  memset( &collCreateInp, 0, sizeof( collCreateInp ) );
1255  rstrcpy( collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN );
1256  status = rsRegColl( rsComm, &collCreateInp );
1257  if ( status < 0 ) {
1258  rodsLog( LOG_ERROR,
1259  "linkCollReg: rsRegColl error for %s, status = %d",
1260  collCreateInp.collName, status );
1261  return status;
1262  }
1263  status = collStat( rsComm, phyPathRegInp, &rodsObjStatOut );
1264  if ( status < 0 ) {
1265  freeRodsObjStat( rodsObjStatOut );
1266  return status;
1267  }
1268 
1269  }
1270 
1271  if ( rodsObjStatOut && // JMC cppcheck - nullptr
1272  rodsObjStatOut->specColl != NULL &&
1273  rodsObjStatOut->specColl->collClass != LINKED_COLL ) {
1274  freeRodsObjStat( rodsObjStatOut );
1275  rodsLog( LOG_ERROR,
1276  "linkCollReg: link collection %s in a spec coll path",
1277  phyPathRegInp->objPath );
1278  return SYS_COLL_LINK_PATH_ERR;
1279  }
1280 
1281  freeRodsObjStat( rodsObjStatOut );
1282  rodsObjStatOut = NULL;
1283 
1284  if ( isCollEmpty( rsComm, phyPathRegInp->objPath ) == False ) {
1285  rodsLog( LOG_ERROR,
1286  "linkCollReg: collection %s not empty", phyPathRegInp->objPath );
1287  return SYS_COLLECTION_NOT_EMPTY;
1288  }
1289 
1290  /* mk the collection */
1291 
1292  memset( &collCreateInp, 0, sizeof( collCreateInp ) );
1293  rstrcpy( collCreateInp.collName, phyPathRegInp->objPath, MAX_NAME_LEN );
1294  addKeyVal( &collCreateInp.condInput, COLLECTION_TYPE_KW, collType );
1295 
1296  /* have to use dataObjInp.objPath because structFile path was removed */
1297  addKeyVal( &collCreateInp.condInput, COLLECTION_INFO1_KW,
1298  linkPath );
1299 
1300  /* try to mod the coll first */
1301  status = rsModColl( rsComm, &collCreateInp );
1302 
1303  if ( status < 0 ) { /* try to create it */
1304  status = rsRegColl( rsComm, &collCreateInp );
1305  }
1306 
1307  return status;
1308 }
1309 
1311 readPathnamePatternsFromFile( rsComm_t *rsComm, char *filename, char* resc_hier ) {
1312  int status;
1313  rodsStat_t *stbuf;
1314  fileStatInp_t fileStatInp;
1315  bytesBuf_t fileReadBuf;
1316  fileOpenInp_t fileOpenInp;
1317  fileReadInp_t fileReadInp;
1318  fileCloseInp_t fileCloseInp;
1319  int buf_len, fd;
1320  pathnamePatterns_t *pp;
1321 
1322  if ( rsComm == NULL || filename == NULL || resc_hier == NULL ) {
1323  return NULL;
1324  }
1325 
1326 
1327  // =-=-=-=-=-=-=-
1328  // extract the host location from the resource hierarchy
1329  std::string location;
1330  irods::error ret = irods::get_loc_for_hier_string( resc_hier, location );
1331  if ( !ret.ok() ) {
1332  irods::log( PASSMSG( "readPathnamePatternsFromFile - failed in get_loc_for_hier_string", ret ) );
1333  return NULL;
1334  }
1335 
1336  memset( &fileStatInp, 0, sizeof( fileStatInp ) );
1337  rstrcpy( fileStatInp.fileName, filename, MAX_NAME_LEN );
1338  rstrcpy( fileStatInp.addr.hostAddr, location.c_str(), NAME_LEN );
1339  rstrcpy( fileStatInp.rescHier, resc_hier, MAX_NAME_LEN );
1340  status = rsFileStat( rsComm, &fileStatInp, &stbuf );
1341  if ( status != 0 ) {
1342  if ( status != UNIX_FILE_STAT_ERR - ENOENT ) {
1343  rodsLog( LOG_DEBUG, "readPathnamePatternsFromFile: can't stat %s. status = %d",
1344  fileStatInp.fileName, status );
1345  }
1346  return NULL;
1347  }
1348  buf_len = stbuf->st_size;
1349  free( stbuf );
1350 
1351  memset( &fileOpenInp, 0, sizeof( fileOpenInp ) );
1352  rstrcpy( fileOpenInp.fileName, filename, MAX_NAME_LEN );
1353  rstrcpy( fileOpenInp.addr.hostAddr, location.c_str(), NAME_LEN );
1354  rstrcpy( fileOpenInp.resc_hier_, resc_hier, MAX_NAME_LEN );
1355  fileOpenInp.flags = O_RDONLY;
1356  fd = rsFileOpen( rsComm, &fileOpenInp );
1357  if ( fd < 0 ) {
1359  "readPathnamePatternsFromFile: can't open %s for reading. status = %d",
1360  fileOpenInp.fileName, fd );
1361  return NULL;
1362  }
1363 
1364  memset( &fileReadBuf, 0, sizeof( fileReadBuf ) );
1365  fileReadBuf.buf = malloc( buf_len );
1366  if ( fileReadBuf.buf == NULL ) {
1367  rodsLog( LOG_NOTICE, "readPathnamePatternsFromFile: could not malloc buffer" );
1368  return NULL;
1369  }
1370 
1371  memset( &fileReadInp, 0, sizeof( fileReadInp ) );
1372  fileReadInp.fileInx = fd;
1373  fileReadInp.len = buf_len;
1374  status = rsFileRead( rsComm, &fileReadInp, &fileReadBuf );
1375 
1376  memset( &fileCloseInp, 0, sizeof( fileCloseInp ) );
1377  fileCloseInp.fileInx = fd;
1378  rsFileClose( rsComm, &fileCloseInp );
1379 
1380  if ( status < 0 ) {
1381  rodsLog( LOG_NOTICE, "readPathnamePatternsFromFile: could not read %s. status = %d",
1382  fileOpenInp.fileName, status );
1383  free( fileReadBuf.buf );
1384  return NULL;
1385  }
1386 
1387  pp = readPathnamePatterns( ( char* )fileReadBuf.buf, buf_len );
1388 
1389  return pp;
1390 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
getValByKey
char * getValByKey(const keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:675
DataObjInp::objPath
char objPath[(1024+64)]
Definition: dataObjInpOut.h:66
OpenedDataObjInp
Definition: dataObjInpOut.h:104
getchkPathPerm
int getchkPathPerm(rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t *dataObjInfo)
Definition: physPath.cpp:312
irods::resource_manager::get_hier_to_root_for_resc
error get_hier_to_root_for_resc(const std::string &, std::string &)
Definition: irods_resource_manager.cpp:434
NULL
#define NULL
Definition: rodsDef.h:70
rsCollCreate
int rsCollCreate(rsComm_t *rsComm, collInp_t *collCreateInp)
Definition: rsCollCreate.cpp:52
rodsStat::st_mode
unsigned int st_mode
Definition: rodsType.h:56
irods::RESOURCE_LOCATION
const std::string RESOURCE_LOCATION("resource_property_location")
ACCESS_READ_OBJECT
#define ACCESS_READ_OBJECT
Definition: icatDefines.h:52
fileReaddirInp_t::fileInx
int fileInx
Definition: fileReaddir.h:8
rsComm_t
Definition: rcConnect.h:145
irods.pyparsing.empty
empty
Definition: pyparsing.py:3430
getDefDirMode
int getDefDirMode()
Definition: physPath.cpp:1070
addKeyVal
int addKeyVal(keyValPair_t *condInput, const char *keyWord, const char *value)
Definition: rcMisc.cpp:789
rsRegColl
int rsRegColl(rsComm_t *rsComm, collInp_t *regCollInp)
Definition: rsRegColl.cpp:16
rError_t::len
int len
Definition: rodsError.h:25
rsFileMkdir.hpp
SYS_INTERNAL_NULL_INPUT_ERR
@ SYS_INTERNAL_NULL_INPUT_ERR
Definition: rodsErrorTable.h:92
dirPathReg
int dirPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath, const char *_resc_name)
Definition: rsPhyPathReg.cpp:615
UNKNOWN_FILE_SZ
#define UNKNOWN_FILE_SZ
Definition: rodsDef.h:92
SYS_MOUNT_MOUNTED_COLL_ERR
@ SYS_MOUNT_MOUNTED_COLL_ERR
Definition: rodsErrorTable.h:140
SYS_NO_API_PRIV
@ SYS_NO_API_PRIV
Definition: rodsErrorTable.h:81
LINK_POINT_STR
#define LINK_POINT_STR
Definition: objInfo.h:69
FileReadInp::len
int len
Definition: fileRead.h:9
ExcludePatterns
static pathnamePatterns_t * ExcludePatterns
Definition: rsPhyPathReg.cpp:58
rsFileOpen.hpp
COLLECTION_INFO2_KW
#define COLLECTION_INFO2_KW
Definition: rodsKeyWdDef.h:69
DataObjInp::openFlags
int openFlags
Definition: dataObjInpOut.h:68
DataObjInfo::dataModify
char dataModify[32]
Definition: objInfo.h:151
NEWLY_CREATED_COPY
#define NEWLY_CREATED_COPY
Definition: objInfo.h:115
REG_REPL_KW
#define REG_REPL_KW
Definition: rodsKeyWdDef.h:104
DATA_MODIFY_KW
#define DATA_MODIFY_KW
Definition: rodsKeyWdDef.h:42
specColl.hpp
SYS_STRUCT_FILE_INMOUNTED_COLL
@ SYS_STRUCT_FILE_INMOUNTED_COLL
Definition: rodsErrorTable.h:143
CollInp
Definition: dataObjInpOut.h:157
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
rsDataObjCreate.hpp
SpecColl::resource
char resource[64]
Definition: objInfo.h:83
UNMOUNT_STR
#define UNMOUNT_STR
Definition: objInfo.h:74
HAAW_STRUCT_FILE_STR
#define HAAW_STRUCT_FILE_STR
Definition: objInfo.h:66
userInfo_t::userName
char userName[64]
Definition: rodsUser.h:66
Subfile
Definition: objInfo.h:316
isColl
int isColl(rsComm_t *rsComm, char *objName, rodsLong_t *collId)
Definition: objMetaOpr.cpp:204
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
fileClosedirInp_t
Definition: fileClosedir.h:6
modAccessControlInp_t::userName
char * userName
Definition: modAccessControl.h:12
RuleExecInfo::status
int status
Definition: irods_re_structs.hpp:19
phyPathRegNoChkPerm
int phyPathRegNoChkPerm(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:68
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
resc_mgr
irods::resource_manager resc_mgr
Definition: irods_resource_manager.cpp:31
Subfile::subFilePath
char subFilePath[(1024+64)]
Definition: objInfo.h:318
DataObjInp::dataSize
rodsLong_t dataSize
Definition: dataObjInpOut.h:70
irods::resolve_resource_hierarchy
error resolve_resource_hierarchy(const std::string &, rsComm_t *, dataObjInp_t *, std::string &, dataObjInfo_t **_data_obj_info=0)
Definition: irods_resource_redirect.cpp:505
getSpecCollCache
int getSpecCollCache(rsComm_t *rsComm, char *objPath, int inCachOnly, specCollCache_t **specCollCache)
Definition: specColl.cpp:255
OpenedDataObjInp::l1descInx
int l1descInx
Definition: dataObjInpOut.h:105
rodsDirent::d_name
char d_name[256]
Definition: rodsType.h:75
irods::resource_ptr
boost::shared_ptr< resource > resource_ptr
Definition: irods_resource_types.hpp:11
rsDataObjCreate
int rsDataObjCreate(rsComm_t *rsComm, dataObjInp_t *dataObjInp)
Definition: rsDataObjCreate.cpp:77
NO_SAVE_REI
#define NO_SAVE_REI
Definition: rodsDef.h:103
rcPhyPathReg
int rcPhyPathReg(rcComm_t *conn, dataObjInp_t *phyPathRegInp)
Definition: rcPhyPathReg.cpp:71
fileClosedirInp_t::fileInx
int fileInx
Definition: fileClosedir.h:7
rsFileStat
int rsFileStat(rsComm_t *rsComm, fileStatInp_t *fileStatInp, rodsStat_t **fileStatOut)
Definition: rsFileStat.cpp:18
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
SpecColl::phyPath
char phyPath[(1024+64)]
Definition: objInfo.h:85
irods::hierarchy_parser
Definition: irods_hierarchy_parser.hpp:14
isData
int isData(rsComm_t *rsComm, char *objName, rodsLong_t *dataId)
Definition: objMetaOpr.cpp:47
pid_age.p
p
Definition: pid_age.py:13
DataObjInfo::rescId
rodsLong_t rescId
Definition: objInfo.h:164
remotePhyPathReg
int remotePhyPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, rodsServerHost_t *rodsServerHost)
Definition: rsPhyPathReg.cpp:314
rsRegColl.hpp
fileStatInp_t
Definition: fileStat.h:7
LONG_NAME_LEN
#define LONG_NAME_LEN
Definition: rodsDef.h:57
SpecColl::type
structFileType_t type
Definition: objInfo.h:78
fileMkdirInp_t::mode
int mode
Definition: fileMkdir.h:11
modAccessControlInp_t::accessLevel
char * accessLevel
Definition: modAccessControl.h:11
svrRegDataObj
int svrRegDataObj(rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
Definition: rsRegDataObj.cpp:120
getStructFileType
int getStructFileType(specColl_t *specColl)
Definition: objMetaOpr.cpp:386
USER_FILE_DOES_NOT_EXIST
@ USER_FILE_DOES_NOT_EXIST
Definition: rodsErrorTable.h:241
DataObjInfo::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:132
DataObjInfo::replStatus
int replStatus
Definition: objInfo.h:141
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
filesystem.hpp
RuleExecInfo::doi
dataObjInfo_t * doi
Definition: irods_re_structs.hpp:28
HAAW_STRUCT_FILE_T
@ HAAW_STRUCT_FILE_T
Definition: objInfo.h:54
irods::RESOURCE_PATH
const std::string RESOURCE_PATH("resource_property_path")
collStat
int collStat(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsObjStat_t **rodsObjStatOut)
Definition: collection.cpp:271
DataObjInfo::condInput
keyValPair_t condInput
Definition: objInfo.h:161
TAR_STRUCT_FILE_STR
#define TAR_STRUCT_FILE_STR
Definition: objInfo.h:67
irods_resource_backport.hpp
Subfile::specColl
specColl_t * specColl
Definition: objInfo.h:322
fileOpenInp_t::resc_hier_
char resc_hier_[(1024+64)]
Definition: fileOpen.h:16
rsPhyPathReg
int rsPhyPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:78
SpecColl
Definition: objInfo.h:76
rsFileReaddir
int rsFileReaddir(rsComm_t *rsComm, fileReaddirInp_t *fileReaddirInp, rodsDirent_t **fileReaddirOut)
Definition: rsFileReaddir.cpp:16
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
rsFileOpendir.hpp
fileStat.h
STRUCT_FILE_COLL
@ STRUCT_FILE_COLL
Definition: objInfo.h:47
rcGlobalExtern.h
deploy_schemas_locally.parser
parser
Definition: deploy_schemas_locally.py:59
DataObjInfo::filePath
char filePath[(1024+64)]
Definition: objInfo.h:137
filePathReg
int filePathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, const char *_resc_name)
Definition: rsPhyPathReg.cpp:521
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
modAccessControlInp_t
Definition: modAccessControl.h:9
irods_resource_redirect.hpp
structFileSupport
int structFileSupport(rsComm_t *rsComm, char *collection, char *collType, char *resc_hier)
Definition: rsPhyPathReg.cpp:1132
DATA_SIZE_KW
#define DATA_SIZE_KW
Definition: rodsKeyWdDef.h:24
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
fileOpenInp_t::fileName
char fileName[(1024+64)]
Definition: fileOpen.h:20
rsSyncMountedColl.hpp
phyPathReg.h
rsFileOpen
int rsFileOpen(rsComm_t *rsComm, fileOpenInp_t *fileOpenInp)
Definition: rsFileOpen.cpp:21
regReplica_t::condInput
keyValPair_t condInput
Definition: regReplica.h:10
readPathnamePatterns
pathnamePatterns_t * readPathnamePatterns(char *buf, int buflen)
Definition: miscUtil.cpp:2220
rsFileClose.hpp
irods::get_resc_properties_as_kvp
error get_resc_properties_as_kvp(const std::string &, keyValPair_t *)
Definition: irods_resource_backport.cpp:500
rsSubStructFileStat
int rsSubStructFileStat(rsComm_t *rsComm, subFile_t *subFile, rodsStat_t **subStructFileStatOut)
Definition: rsSubStructFileStat.cpp:14
initReiWithDataObjInp
int initReiWithDataObjInp(ruleExecInfo_t *rei, rsComm_t *rsComm, dataObjInp_t *dataObjIn)
Definition: irods_re_structs.cpp:164
filePathRegRepl
int filePathRegRepl(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath, const char *_resc_name)
Definition: rsPhyPathReg.cpp:457
rodsStat::st_size
rodsLong_t st_size
Definition: rodsType.h:53
freeRodsObjStat
int freeRodsObjStat(rodsObjStat_t *rodsObjStat)
Definition: rcMisc.cpp:3537
FileCloseInp
Definition: fileClose.h:6
matchPathname
int matchPathname(pathnamePatterns_t *pp, char *name, char *dirname)
Definition: miscUtil.cpp:2297
MOUNT_POINT_STR
#define MOUNT_POINT_STR
Definition: objInfo.h:68
REG_CHKSUM_KW
#define REG_CHKSUM_KW
Definition: rodsKeyWdDef.h:15
regReplica_t::destDataObjInfo
dataObjInfo_t * destDataObjInfo
Definition: regReplica.h:9
SYS_NOT_SUPPORTED
@ SYS_NOT_SUPPORTED
Definition: rodsErrorTable.h:133
DEST_RESC_NAME_KW
#define DEST_RESC_NAME_KW
Definition: rodsKeyWdDef.h:20
RuleExecInfo::condInputData
keyValPair_t * condInputData
Definition: irods_re_structs.hpp:34
rsGlobalExtern.hpp
rsFileStat.hpp
FileReadInp
Definition: fileRead.h:7
MAX_ERROR_MESSAGES
#define MAX_ERROR_MESSAGES
Definition: rodsError.h:17
rsComm_t::rError
rError_t rError
Definition: rcConnect.h:158
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileOpenInp_t::flags
int flags
Definition: fileOpen.h:21
rodsStat
Definition: rodsType.h:52
LINKED_COLL
@ LINKED_COLL
Definition: objInfo.h:49
RESC_HIER_STR_KW
#define RESC_HIER_STR_KW
Definition: rodsKeyWdDef.h:225
getFileMetadataFromVault
rodsLong_t getFileMetadataFromVault(rsComm_t *rsComm, dataObjInfo_t *dataObjInfo)
Definition: physPath.cpp:1315
fileOpenInp_t::addr
rodsHostAddr_t addr
Definition: fileOpen.h:19
fileStatInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileStat.h:10
linkCollReg
int linkCollReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:1190
fileStatInp_t::objPath
char objPath[(1024+64)]
Definition: fileStat.h:11
COLLECTION_KW
#define COLLECTION_KW
Definition: rodsKeyWdDef.h:61
FileCloseInp::fileInx
int fileInx
Definition: fileClose.h:7
structFileReg
int structFileReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:1006
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
fileOpendirInp_t
Definition: fileOpendir.h:7
rsComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:152
irods::experimental::filesystem
Definition: collection_entry.hpp:12
NO_CHK_PATH_PERM
#define NO_CHK_PATH_PERM
Definition: objInfo.h:246
unmountFileDir
int unmountFileDir(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:966
freeAllDataObjInfo
int freeAllDataObjInfo(dataObjInfo_t *dataObjInfoHead)
Definition: rcMisc.cpp:561
fileStatInp_t::addr
rodsHostAddr_t addr
Definition: fileStat.h:8
modAccessControlInp_t::path
char * path
Definition: modAccessControl.h:14
CAT_INSUFFICIENT_PRIVILEGE_LEVEL
@ CAT_INSUFFICIENT_PRIVILEGE_LEVEL
Definition: rodsErrorTable.h:445
rsModColl
int rsModColl(rsComm_t *rsComm, collInp_t *modCollInp)
Definition: rsModColl.cpp:14
getDataObjInfoIncSpecColl
int getDataObjInfoIncSpecColl(rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t **dataObjInfo)
Definition: dataObjOpr.cpp:1767
rsModColl.hpp
fileOpendirInp_t::dirName
char dirName[(1024+64)]
Definition: fileOpendir.h:12
fileOpendirInp_t::resc_hier_
char resc_hier_[(1024+64)]
Definition: fileOpendir.h:9
fileMkdirInp_t::addr
rodsHostAddr_t addr
Definition: fileMkdir.h:8
_rsSyncMountedColl
int _rsSyncMountedColl(rsComm_t *rsComm, specColl_t *specColl, int oprType)
Definition: rsSyncMountedColl.cpp:73
fileMkdirInp_t::dirName
char dirName[(1024+64)]
Definition: fileMkdir.h:9
rsFileOpendir
int rsFileOpendir(rsComm_t *rsComm, fileOpendirInp_t *fileOpendirInp)
Definition: rsFileOpendir.cpp:20
rsRegReplica
int rsRegReplica(rsComm_t *rsComm, regReplica_t *regReplicaInp)
Definition: rsRegReplica.cpp:187
rsDataObjClose
int rsDataObjClose(rsComm_t *rsComm, openedDataObjInp_t *dataObjCloseInp)
Definition: rsDataObjClose.cpp:56
SYS_COLL_NOT_MOUNTED_ERR
@ SYS_COLL_NOT_MOUNTED_ERR
Definition: rodsErrorTable.h:141
DataObjInp
Definition: dataObjInpOut.h:65
rsDataObjClose.hpp
fileOpendirInp_t::objPath
char objPath[(1024+64)]
Definition: fileOpendir.h:10
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
irods::resource_manager::resolve
error resolve(std::string, resource_ptr &)
Definition: irods_resource_manager.cpp:51
_rsPhyPathReg
int _rsPhyPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, const char *_resc_name, rodsServerHost_t *rodsServerHost)
Definition: rsPhyPathReg.cpp:340
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
Subfile::addr
rodsHostAddr_t addr
Definition: objInfo.h:317
COLLECTION_TYPE_KW
#define COLLECTION_TYPE_KW
Definition: rodsKeyWdDef.h:67
rmKeyVal
int rmKeyVal(keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:710
SU_CLIENT_USER_KW
#define SU_CLIENT_USER_KW
Definition: rodsKeyWdDef.h:86
CollInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:161
NO_CHK_FILE_PERM_KW
#define NO_CHK_FILE_PERM_KW
Definition: rodsKeyWdDef.h:186
ADMIN_KW
#define ADMIN_KW
Definition: rodsKeyWdDef.h:62
rsFileReaddir.hpp
sortObjInfoForOpen
int sortObjInfoForOpen(dataObjInfo_t **dataObjInfoHead, keyValPair_t *condInput, int writeFlag)
Definition: dataObjOpr.cpp:548
addRErrorMsg
int addRErrorMsg(rError_t *myError, int status, const char *msg)
Definition: rcMisc.cpp:121
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
collType
ReIterableType collType(Res *coll)
Definition: functions.cpp:323
LOCAL_PRIV_USER_AUTH
#define LOCAL_PRIV_USER_AUTH
Definition: rodsUser.h:36
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
TRANSLATED_PATH_KW
#define TRANSLATED_PATH_KW
Definition: rodsKeyWdDef.h:97
userInfo_t::rodsZone
char rodsZone[64]
Definition: rodsUser.h:67
collection.hpp
rodsLog.h
physPath.hpp
irods::log
void log(const error &)
Definition: irods_log.cpp:13
fileMkdirInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileMkdir.h:10
rodsDirent
Definition: rodsType.h:70
rsFileClosedir.hpp
rsFileClose
int rsFileClose(rsComm_t *rsComm, fileCloseInp_t *fileCloseInp)
Definition: rsFileClose.cpp:18
rsSubStructFileStat.hpp
irsPhyPathReg
int irsPhyPathReg(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp)
Definition: rsPhyPathReg.cpp:91
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
MSSO_STRUCT_FILE_STR
#define MSSO_STRUCT_FILE_STR
Definition: objInfo.h:71
icatDefines.h
rsComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:153
getDataObjInfo
int getDataObjInfo(rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t **dataObjInfoHead, char *accessPerm, int ignoreCondInput)
Definition: dataObjOpr.cpp:87
BytesBuf
Definition: rodsDef.h:197
irods::error
Definition: irods_error.hpp:23
FileReadInp::fileInx
int fileInx
Definition: fileRead.h:8
miscServerFunct.hpp
regReplica_t::srcDataObjInfo
dataObjInfo_t * srcDataObjInfo
Definition: regReplica.h:8
int
typedef int((*funcPtr)())
irods::lexical_cast
error lexical_cast(S _s, T &_t)
Definition: irods_lexical_cast.hpp:13
HIERARCHY_ERROR
@ HIERARCHY_ERROR
Definition: rodsErrorTable.h:752
irods.log
Definition: log.py:1
SYS_INVALID_FILE_PATH
@ SYS_INVALID_FILE_PATH
Definition: rodsErrorTable.h:99
DataObjInfo::chksum
char chksum[64]
Definition: objInfo.h:135
SpecColl::collection
char collection[(1024+64)]
Definition: objInfo.h:79
rsFileRead.hpp
irods_hierarchy_parser.hpp
SYS_COLL_LINK_PATH_ERR
@ SYS_COLL_LINK_PATH_ERR
Definition: rodsErrorTable.h:172
FORCE_FLAG_KW
#define FORCE_FLAG_KW
Definition: rodsKeyWdDef.h:13
fileOpenInp_t
Definition: fileOpen.h:14
TAR_STRUCT_FILE_T
@ TAR_STRUCT_FILE_T
Definition: objInfo.h:55
irods::resource_manager::hier_to_leaf_id
error hier_to_leaf_id(const std::string &, rodsLong_t &)
Definition: irods_resource_manager.cpp:1082
rsFileRead
int rsFileRead(rsComm_t *rsComm, fileReadInp_t *fileReadInp, bytesBuf_t *fileReadOutBBuf)
Definition: rsFileRead.cpp:19
irods::file_object
Definition: irods_file_object.hpp:19
chkFilePathPerm
int chkFilePathPerm(rsComm_t *rsComm, fileOpenInp_t *fileOpenInp, rodsServerHost_t *rodsServerHost, int chkType)
Definition: fileOpr.cpp:381
rodsServerHost
Definition: rodsConnect.h:62
DataObjInfo::rescName
char rescName[64]
Definition: objInfo.h:131
apiHeaderAll.h
fileStatInp_t::fileName
char fileName[(1024+64)]
Definition: fileStat.h:9
rodsHostAddr_t::hostAddr
char hostAddr[256]
Definition: rodsDef.h:297
rsFileClosedir
int rsFileClosedir(rsComm_t *rsComm, fileClosedirInp_t *fileClosedirInp)
Definition: rsFileClosedir.cpp:16
VERIFY_CHKSUM_KW
#define VERIFY_CHKSUM_KW
Definition: rodsKeyWdDef.h:16
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
RuleExecInfo
Definition: irods_re_structs.hpp:18
PURGE_STRUCT_FILE_CACHE
#define PURGE_STRUCT_FILE_CACHE
Definition: syncMountedColl.h:8
modAccessControlInp_t::zone
char * zone
Definition: modAccessControl.h:13
getLogPathFromPhyPath
int getLogPathFromPhyPath(char *phyPath, const char *rescVaultPath, char *outLogPath)
Definition: physPath.cpp:1083
EXCLUDE_FILE_KW
#define EXCLUDE_FILE_KW
Definition: rodsKeyWdDef.h:220
applyRule
int applyRule(char *inAction, msParamArray_t *inMsParamArray, ruleExecInfo_t *rei, int reiSaveFlag)
Definition: irods_re_structs.cpp:65
resource.hpp
readPathnamePatternsFromFile
pathnamePatterns_t * readPathnamePatternsFromFile(rsComm_t *rsComm, char *filename, char *)
Definition: rsPhyPathReg.cpp:1311
rsRegReplica.hpp
CollInp::collName
char collName[(1024+64)]
Definition: dataObjInpOut.h:158
rodsObjStat
Definition: objStat.h:8
DataObjInfo::objPath
char objPath[(1024+64)]
Definition: objInfo.h:130
rsRegDataObj.hpp
fileOpendirInp_t::addr
rodsHostAddr_t addr
Definition: fileOpendir.h:11
False
#define False
Definition: parseCommandLine.h:12
rodsObjStat::specColl
specColl_t * specColl
Definition: objStat.h:18
isCollEmpty
int isCollEmpty(rsComm_t *rsComm, char *collection)
Definition: collection.cpp:229
freePathnamePatterns
void freePathnamePatterns(pathnamePatterns_t *pp)
Definition: miscUtil.cpp:2282
userInfo_t::authInfo
authInfo_t authInfo
Definition: rodsUser.h:70
UNIX_FILE_STAT_ERR
@ UNIX_FILE_STAT_ERR
Definition: rodsErrorTable.h:306
_dataObjChksum
int _dataObjChksum(rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, char **chksumStr)
Definition: physPath.cpp:421
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
dataObjOpr.hpp
rsPhyPathReg.hpp
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
irods::get_loc_for_hier_string
error get_loc_for_hier_string(const std::string &_hier, std::string &_loc)
Definition: irods_resource_backport.cpp:633
regReplica_t
Definition: regReplica.h:7
fileReaddirInp_t
Definition: fileReaddir.h:7
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
rsCollCreate.hpp
authInfo_t::authFlag
int authFlag
Definition: rodsUser.h:42
COLLECTION_INFO1_KW
#define COLLECTION_INFO1_KW
Definition: rodsKeyWdDef.h:68
pathnamePatterns_t
Definition: miscUtil.h:134
clearKeyVal
int clearKeyVal(keyValPair_t *condInput)
Definition: rcMisc.cpp:1047
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
initDataObjInfoWithInp
int initDataObjInfoWithInp(dataObjInfo_t *dataObjInfo, dataObjInp_t *dataObjInp)
Definition: objDesc.cpp:217
FILE_PATH_KW
#define FILE_PATH_KW
Definition: rodsKeyWdDef.h:28
SpecColl::objPath
char objPath[(1024+64)]
Definition: objInfo.h:80
rsModAccessControl.hpp
DataObjInfo
Definition: objInfo.h:129
USER_INPUT_PATH_ERR
@ USER_INPUT_PATH_ERR
Definition: rodsErrorTable.h:248
rsModAccessControl
int rsModAccessControl(rsComm_t *rsComm, modAccessControlInp_t *modAccessControlInp)
Definition: rsModAccessControl.cpp:14
DataObjInfo::dataSize
rodsLong_t dataSize
Definition: objInfo.h:134
MSSO_STRUCT_FILE_T
@ MSSO_STRUCT_FILE_T
Definition: objInfo.h:56
irods::CREATE_OPERATION
const std::string CREATE_OPERATION("CREATE")
SpecCollCache::specColl
specColl_t specColl
Definition: objInfo.h:104
rsFileMkdir
int rsFileMkdir(rsComm_t *rsComm, fileMkdirInp_t *fileMkdirInp)
Definition: rsFileMkdir.cpp:17
SpecCollCache
Definition: objInfo.h:102
fileMkdirInp_t
Definition: fileMkdir.h:7
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
objMetaOpr.hpp
SpecColl::collClass
specCollClass_t collClass
Definition: objInfo.h:77
ERR_MSG_LEN
#define ERR_MSG_LEN
Definition: rodsError.h:16
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375
rodsHostAddr_t
Definition: rodsDef.h:296
mountFileDir
int mountFileDir(rsComm_t *rsComm, dataObjInp_t *phyPathRegInp, char *filePath, const char *rescVaultPath)
Definition: rsPhyPathReg.cpp:828
SYS_COLLECTION_NOT_EMPTY
@ SYS_COLLECTION_NOT_EMPTY
Definition: rodsErrorTable.h:146