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.
![]() ![]() |
#include <unistd.h>
#include <fcntl.h>
#include "rcMisc.h"
#include "rodsDef.h"
#include "rodsConnect.h"
#include "physPath.hpp"
#include "dataObjOpr.hpp"
#include "rodsPath.h"
#include "rsGlobalExtern.hpp"
#include "fileChksum.h"
#include "modDataObjMeta.h"
#include "objMetaOpr.hpp"
#include "collection.hpp"
#include "resource.hpp"
#include "dataObjClose.h"
#include "rcGlobalExtern.h"
#include "rsDataObjClose.hpp"
#include "genQuery.h"
#include "phyBundleColl.h"
#include "collCreate.h"
#include "rsFileChksum.hpp"
#include "rsModDataObjMeta.hpp"
#include "rsFileRename.hpp"
#include "rsGenQuery.hpp"
#include "rsCollCreate.hpp"
#include <iostream>
#include <boost/lexical_cast.hpp>
#include "irods_resource_backport.hpp"
#include "irods_hierarchy_parser.hpp"
#include "irods_stacktrace.hpp"
#include "irods_server_properties.hpp"
#include "irods_log.hpp"
#include "irods_get_full_path_for_config_file.hpp"
#include "irods_random.hpp"
Go to the source code of this file.
Functions | |
int | getLeafRescPathName (const std::string &_resc_hier, std::string &_ret_string) |
int | getFileMode (dataObjInp_t *dataObjInp) |
int | getFileFlags (int l1descInx) |
int | getFilePathName (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, dataObjInp_t *dataObjInp) |
int | getVaultPathPolicy (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, vaultPathPolicy_t *outVaultPathPolicy) |
int | setPathForRandomScheme (char *objPath, const char *vaultPath, char *userName, char *outPath) |
int | setPathForGraftPathScheme (char *objPath, const char *vaultPath, int addUserName, char *userName, int trimDirCnt, char *outPath) |
int | resolveDupFilePath (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, dataObjInp_t *dataObjInp) |
int | getchkPathPerm (rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t *dataObjInfo) |
int | getCopiesFromCond (keyValPair_t *condInput) |
int | getWriteFlag (int openFlag) |
rodsLong_t | getSizeInVault (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo) |
int | _dataObjChksum (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, char **chksumStr) |
int | dataObjChksumAndReg (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, char **chksumStr) |
int | chkAndHandleOrphanFile (rsComm_t *rsComm, char *objPath, char *rescHier, char *filePath, const char *_resc_name, int replStatus) |
int | renameFilePathToNewDir (rsComm_t *rsComm, char *newDir, fileRenameInp_t *fileRenameInp, int renameFlag, char *new_fn) |
int | syncDataObjPhyPath (rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t *dataObjInfoHead, char *acLCollection) |
int | syncDataObjPhyPathS (rsComm_t *rsComm, dataObjInp_t *dataObjInp, dataObjInfo_t *dataObjInfo, char *acLCollection) |
int | syncCollPhyPath (rsComm_t *rsComm, char *collection) |
int | isInVault (dataObjInfo_t *dataObjInfo) |
int | getDefFileMode () |
int | getDefDirMode () |
int | getLogPathFromPhyPath (char *phyPath, const char *rescVaultPath, char *outLogPath) |
int | rsMkOrphanPath (rsComm_t *rsComm, char *objPath, char *orphanPath) |
int | getDataObjLockPath (char *objPath, char **outLockPath) |
int | executeFilesystemLockCommand (int cmd, int type, int fd, struct flock *lock) |
int | fsDataObjLock (char *objPath, int cmd, int type) |
int | fsDataObjUnlock (int cmd, int type, int fd) |
rodsLong_t | getFileMetadataFromVault (rsComm_t *rsComm, dataObjInfo_t *dataObjInfo) |
int _dataObjChksum | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo, | ||
char ** | chksumStr | ||
) |
Definition at line 421 of file physPath.cpp.
References FileChksumInp::addr, CHKSUM_LEN, DataObjInfo::condInput, DIRECT_ARCHIVE_ACCESS, FILE_CAT, FileChksumInp::fileName, DataObjInfo::filePath, irods::get_loc_for_hier_string(), getValByKey(), rodsHostAddr_t::hostAddr, FileChksumInp::in_pdmo, DataObjInfo::in_pdmo, irods::log(), LOG_DEBUG, LOG_NOTICE, MAX_NAME_LEN, NAME_LEN, FileChksumInp::objPath, DataObjInfo::objPath, irods::error::ok(), FileChksumInp::orig_chksum, ORIG_CHKSUM_KW, PASSMSG, FileChksumInp::rescHier, DataObjInfo::rescHier, rodsLog(), rsFileChksum(), rstrcpy(), irods.pypyodbc::status, and SYS_INVALID_RESC_TYPE.
Referenced by dataObjChksumAndReg(), dataObjChksumAndRegInfo(), filePathReg(), procChksumForClose(), and verifyDatObjChksum().
int chkAndHandleOrphanFile | ( | rsComm_t * | rsComm, |
char * | objPath, | ||
char * | rescHier, | ||
char * | filePath, | ||
const char * | _resc_name, | ||
int | replStatus | ||
) |
Definition at line 526 of file physPath.cpp.
References addKeyVal(), chkOrphanFile(), clearKeyVal(), modDataObjMeta_t::dataObjInfo, FILE_PATH_KW, isTrashPath(), LOG_ERROR, MAX_NAME_LEN, fileRenameInp_t::newFileName, NULL, fileRenameInp_t::objPath, DataObjInfo::objPath, OLD_COPY, fileRenameInp_t::oldFileName, ORPHAN_DIR, modDataObjMeta_t::regParam, renameFilePathToNewDir(), REPL_DIR, fileRenameInp_t::rescHier, DataObjInfo::rescHier, rodsErrorName(), rodsLog(), rsFileRename(), rsModDataObjMeta(), rstrcpy(), and irods.pypyodbc::status.
Referenced by resolveDupFilePath(), and syncDataObjPhyPathS().
int dataObjChksumAndReg | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo, | ||
char ** | chksumStr | ||
) |
Definition at line 478 of file physPath.cpp.
References _dataObjChksum(), addKeyVal(), CHKSUM_KW, clearKeyVal(), modDataObjMeta_t::dataObjInfo, IN_PDMO_KW, LOG_NOTICE, DataObjInfo::objPath, modDataObjMeta_t::regParam, DataObjInfo::rescHier, rodsLog(), rsModDataObjMeta(), and irods.pypyodbc::status.
Referenced by _rsDataObjGet().
Definition at line 1246 of file physPath.cpp.
References generate_iadmin_commands_for_41_to_42_upgrade::cmd, irods.pypyodbc::lock, irods.pypyodbc::status, SYS_FS_LOCK_ERR, and type.
Referenced by fsDataObjLock(), and fsDataObjUnlock().
Definition at line 1268 of file physPath.cpp.
References generate_iadmin_commands_for_41_to_42_upgrade::cmd, executeFilesystemLockCommand(), FILE_OPEN_ERR, getDataObjLockPath(), irods.pypyodbc::lock, LOG_DEBUG, LOG_ERROR, NULL, rodsLogError(), irods.pypyodbc::status, and type.
Referenced by _rsDataObjLock().
Definition at line 1302 of file physPath.cpp.
References generate_iadmin_commands_for_41_to_42_upgrade::cmd, executeFilesystemLockCommand(), irods.pypyodbc::lock, LOG_DEBUG, rodsLogError(), irods.pypyodbc::status, and type.
Referenced by _rsDataObjUnlock().
int getchkPathPerm | ( | rsComm_t * | rsComm, |
dataObjInp_t * | dataObjInp, | ||
dataObjInfo_t * | dataObjInfo | ||
) |
Definition at line 312 of file physPath.cpp.
References applyRule(), authInfo_t::authFlag, userInfo_t::authInfo, clearKeyVal(), rsComm_t::clientUser, DataObjInp::condInput, RuleExecInfo::condInputData, DISALLOW_PATH_REG, RuleExecInfo::doi, FILE_PATH_KW, irods::get_resc_properties_as_kvp(), getValByKey(), initReiWithDataObjInp(), LOCAL_PRIV_USER_AUTH, irods::log(), NO_CHK_PATH_PERM, NO_SAVE_REI, NULL, irods::error::ok(), PASS, DataObjInfo::rescHier, DataObjInfo::rescId, DataObjInfo::rescName, irods::RESOURCE_CHECK_PATH_PERM(), and RuleExecInfo::status.
Referenced by _rsPhyPathReg(), l3CreateByObjInfo(), and l3FilePutSingleBuf().
int getCopiesFromCond | ( | keyValPair_t * | condInput | ) |
Definition at line 369 of file physPath.cpp.
References ALL_COPIES, COPIES_KW, getValByKey(), and NULL.
int getDataObjLockPath | ( | char * | objPath, |
char ** | outLockPath | ||
) |
Definition at line 1185 of file physPath.cpp.
References irods::error::code(), irods::get_full_path_for_unmoved_configs(), LOCK_FILE_DIR, LOCK_FILE_TRAILER, irods::log(), MAX_NAME_LEN, NULL, irods::error::ok(), PASS, rstrcpy(), and USER__NULL_INPUT_ERR.
Referenced by fsDataObjLock().
int getDefDirMode | ( | ) |
Definition at line 1070 of file physPath.cpp.
References irods::CFG_DEFAULT_DIR_MODE_KW(), DEFAULT_DIR_MODE, and terminate_irods_processes::e.
Referenced by _rsFileCreate(), _rsFileStageToCache(), _rsFileSyncToArch(), _rsStructFileBundle(), bulkProcAndRegSubfile(), createBunDirForBulkPut(), createPhyBundleDir(), l3Mkdir(), mountFileDir(), procCacheDir(), regPhySubFile(), regSubfile(), univ_mss_file_chmod(), and univ_mss_file_mkdir().
int getDefFileMode | ( | ) |
Definition at line 1057 of file physPath.cpp.
References irods::CFG_DEFAULT_FILE_MODE_KW(), DEFAULT_FILE_MODE, and terminate_irods_processes::e.
Referenced by getFileMode(), irods_file_open(), test_source_replica_for_write_permissions(), and univ_mss_file_chmod().
Definition at line 70 of file physPath.cpp.
References l1desc::dataObjInp, L1desc, NULL, and DataObjInp::openFlags.
Referenced by l3Open().
rodsLong_t getFileMetadataFromVault | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo | ||
) |
Definition at line 1315 of file physPath.cpp.
References addKeyVal(), DataObjInfo::condInput, FILE_CTIME_KW, FILE_GID_KW, FILE_MODE_KW, FILE_MTIME_KW, FILE_UID_KW, DataObjInfo::filePath, l3Stat(), LOG_DEBUG, NULL, rodsLog(), SHORT_STR_LEN, rodsStat::st_ctim, rodsStat::st_gid, rodsStat::st_mode, rodsStat::st_mtim, rodsStat::st_size, rodsStat::st_uid, irods.pypyodbc::status, SYS_PATH_IS_NOT_A_FILE, and TIME_LEN.
Referenced by filePathReg().
int getFileMode | ( | dataObjInp_t * | dataObjInp | ) |
Definition at line 48 of file physPath.cpp.
References DataObjInp::createMode, getDefFileMode(), and NULL.
Referenced by l3Create(), l3CreateByObjInfo(), l3FileGetSingleBuf(), l3FilePutSingleBuf(), l3FileStage(), l3FileSync(), and l3Open().
int getFilePathName | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo, | ||
dataObjInp_t * | dataObjInp | ||
) |
Definition at line 87 of file physPath.cpp.
References vaultPathPolicy_t::addUserName, rsComm_t::clientUser, DataObjInp::condInput, FILE_PATH_KW, DataObjInfo::filePath, getLeafRescPathName(), getValByKey(), getVaultPathPolicy(), GRAFT_PATH_S, irods::log(), LOG_ERROR, MAX_NAME_LEN, NO_CREATE_PATH, NULL, DataObjInp::objPath, irods::error::ok(), PASS, DataObjInfo::rescHier, DataObjInfo::rescId, DataObjInfo::rescName, irods::RESOURCE_CHECK_PATH_PERM(), rodsLog(), rstrcpy(), vaultPathPolicy_t::scheme, setPathForGraftPathScheme(), setPathForRandomScheme(), irods.pypyodbc::status, SYS_INTERNAL_NULL_INPUT_ERR, SYS_INVALID_RESC_INPUT, vaultPathPolicy_t::trimDirCnt, and userInfo_t::userName.
Referenced by _rsDataObjCreateWithResc(), bulkProcAndRegSubfile(), createBunDirForBulkPut(), createEmptyRepl(), dataObjOpenForRepl(), moveMountedCollDataObj(), regPhySubFile(), regSubfile(), and syncDataObjPhyPathS().
int getLeafRescPathName | ( | const std::string & | _resc_hier, |
std::string & | _ret_string | ||
) |
Definition at line 1358 of file physPath.cpp.
References irods::error::code(), irods::resource_manager::hier_to_leaf_id(), irods::log(), LOG_ERROR, irods::error::ok(), PASS, resc_mgr, and irods::RESOURCE_PATH().
Referenced by getFilePathName().
int getLogPathFromPhyPath | ( | char * | phyPath, |
const char * | rescVaultPath, | ||
char * | outLogPath | ||
) |
Definition at line 1083 of file physPath.cpp.
References getLocalZoneInfo(), MAX_NAME_LEN, NULL, irods.pypyodbc::status, USER__NULL_INPUT_ERR, and zoneInfo::zoneName.
Referenced by mountFileDir().
rodsLong_t getSizeInVault | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo | ||
) |
Definition at line 396 of file physPath.cpp.
References DataObjInfo::filePath, l3Stat(), LOG_DEBUG, NULL, rodsLog(), rodsStat::st_mode, rodsStat::st_size, irods.pypyodbc::status, and SYS_PATH_IS_NOT_A_FILE.
Referenced by _rsDataObjClose(), resolveDupFilePath(), and syncDataObjPhyPathS().
int getVaultPathPolicy | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo, | ||
vaultPathPolicy_t * | outVaultPathPolicy | ||
) |
Definition at line 154 of file physPath.cpp.
References vaultPathPolicy_t::addUserName, applyRule(), clearKeyVal(), clearMsParamArray(), RuleExecInfo::condInputData, DEF_ADD_USER_FLAG, DEF_TRIM_DIR_CNT, DEF_VAULT_PATH_SCHEME, RuleExecInfo::doi, irods::get_resc_properties_as_kvp(), getMsParamByLabel(), initReiWithDataObjInp(), RuleExecInfo::inOutMsParamArray, MsParam::inOutStruct, LOG_ERROR, NO_SAVE_REI, NULL, DataObjInfo::rescHier, rodsLog(), vaultPathPolicy_t::scheme, irods.pypyodbc::status, SYS_INTERNAL_NULL_INPUT_ERR, vaultPathPolicy_t::trimDirCnt, and VAULT_PATH_POLICY.
Referenced by getFilePathName(), and syncDataObjPhyPathS().
Definition at line 386 of file physPath.cpp.
Referenced by _rsDataObjOpen(), getDataObjInfo(), getDataObjInfoIncSpecColl(), msiSetDataObjAvoidResc(), msiSetDataObjPreferredResc(), and rsGetRemoteZoneResc().
int isInVault | ( | dataObjInfo_t * | dataObjInfo | ) |
Definition at line 1034 of file physPath.cpp.
References irods::error::code(), DataObjInfo::filePath, irods::get_vault_path_for_hier_string(), has_prefix(), irods::log(), irods::error::ok(), PASSMSG, DataObjInfo::rescHier, and SYS_INTERNAL_NULL_INPUT_ERR.
Referenced by syncDataObjPhyPathS().
int renameFilePathToNewDir | ( | rsComm_t * | rsComm, |
char * | newDir, | ||
fileRenameInp_t * | fileRenameInp, | ||
int | renameFlag, | ||
char * | new_fn | ||
) |
Definition at line 652 of file physPath.cpp.
References fileRenameInp_t::addr, irods::error::code(), ERROR, fileRenameOut_t::file_name, FILE_NOT_IN_VAULT, irods::get_loc_for_hier_string(), irods::get_vault_path_for_hier_string(), rodsHostAddr_t::hostAddr, irods::log(), LOG_NOTICE, MAX_NAME_LEN, NAME_LEN, fileRenameInp_t::newFileName, irods::error::ok(), fileRenameInp_t::oldFileName, PASSMSG, fileRenameInp_t::rescHier, RESCVAULTPATH_EMPTY_IN_STRUCT_ERR, rodsLog(), rsFileRename(), rstrcpy(), and irods.pypyodbc::status.
Referenced by bulkProcAndRegSubfile(), chkAndHandleOrphanFile(), moveMountedCollDataObj(), regSubfile(), and unbunPhyBunFile().
int resolveDupFilePath | ( | rsComm_t * | rsComm, |
dataObjInfo_t * | dataObjInfo, | ||
dataObjInp_t * | dataObjInp | ||
) |
Definition at line 279 of file physPath.cpp.
References chkAndHandleOrphanFile(), DataObjInp::condInput, FILE_PATH_KW, DataObjInfo::filePath, getSizeInVault(), getValByKey(), MAX_NAME_LEN, NAME_LEN, NULL, DataObjInfo::objPath, DataObjInfo::replNum, DataObjInfo::replStatus, DataObjInfo::rescHier, DataObjInfo::rescName, and SYS_PATH_IS_NOT_A_FILE.
Referenced by l3CreateByObjInfo(), l3FilePutSingleBuf(), and regPhySubFile().
Definition at line 1127 of file physPath.cpp.
References addKeyVal(), CAT_NAME_EXISTS_AS_COLLECTION, rsComm_t::clientUser, CollInp::collName, CollInp::condInput, LOG_ERROR, MAX_NAME_LEN, RECURSIVE_OPR__KW, rodsLog(), rodsLogError(), userInfo_t::rodsZone, rsCollCreate(), rstrcpy(), splitPathByKey(), irods.pypyodbc::status, and userInfo_t::userName.
Referenced by dataObjUnlinkS().
int setPathForGraftPathScheme | ( | char * | objPath, |
const char * | vaultPath, | ||
int | addUserName, | ||
char * | userName, | ||
int | trimDirCnt, | ||
char * | outPath | ||
) |
Definition at line 230 of file physPath.cpp.
References LOG_ERROR, MAX_NAME_LEN, NULL, rodsLog(), and USER_STRLEN_TOOLONG.
Referenced by getFilePathName().
int setPathForRandomScheme | ( | char * | objPath, |
const char * | vaultPath, | ||
char * | userName, | ||
char * | outPath | ||
) |
Definition at line 202 of file physPath.cpp.
References LOG_ERROR, MAX_NAME_LEN, NULL, rodsLog(), splitPathByKey(), and irods.pypyodbc::status.
Referenced by getFilePathName().
Definition at line 912 of file physPath.cpp.
References CAT_NO_ROWS_FOUND, clearGenQueryInp(), COL_COLL_NAME, COL_D_DATA_ID, COL_D_DATA_PATH, COL_D_RESC_ID, COL_D_RESC_NAME, COL_DATA_NAME, COL_DATA_REPL_NUM, GenQueryInp::continueInx, GenQueryOut::continueInx, DataObjInfo::dataId, DataObjInfo::filePath, freeGenQueryOut(), getSqlResultByInx(), irods::resource_manager::leaf_id_to_hier(), SqlResult::len, LOG_ERROR, MAX_NAME_LEN, NAME_LEN, NULL, DataObjInfo::objPath, DataObjInfo::replNum, resc_mgr, DataObjInfo::rescHier, DataObjInfo::rescId, DataObjInfo::rescName, rodsLog(), GenQueryOut::rowCnt, rsGenQuery(), rsQueryDataObjInCollReCur(), rstrcpy(), irods.pypyodbc::status, syncDataObjPhyPathS(), UNMATCHED_KEY_OR_INDEX, and SqlResult::value.
Referenced by _rsDataObjRename().
int syncDataObjPhyPath | ( | rsComm_t * | rsComm, |
dataObjInp_t * | dataObjInp, | ||
dataObjInfo_t * | dataObjInfoHead, | ||
char * | acLCollection | ||
) |
Definition at line 742 of file physPath.cpp.
References DataObjInfo::next, NULL, irods.pypyodbc::status, and syncDataObjPhyPathS().
Referenced by _rsDataObjRename().
int syncDataObjPhyPathS | ( | rsComm_t * | rsComm, |
dataObjInp_t * | dataObjInp, | ||
dataObjInfo_t * | dataObjInfo, | ||
char * | acLCollection | ||
) |
Definition at line 763 of file physPath.cpp.
References ACL_COLLECTION_KW, addKeyVal(), fileRenameInp_t::addr, BUNDLE_RESC, chkAndHandleOrphanFile(), clearKeyVal(), irods::error::code(), modDataObjMeta_t::dataObjInfo, fileRenameOut_t::file_name, FILE_PATH_KW, DataObjInfo::filePath, irods::get_loc_for_hier_string(), getFilePathName(), getSizeInVault(), getVaultPathPolicy(), GRAFT_PATH_S, rodsHostAddr_t::hostAddr, irods::is_resc_live(), isInVault(), irods::log(), LOG_ERROR, LOG_NOTICE, MAX_NAME_LEN, NAME_LEN, fileRenameInp_t::newFileName, NO_CREATE_PATH, NULL, DataObjInp::objPath, fileRenameInp_t::objPath, DataObjInfo::objPath, irods::error::ok(), OLD_COPY, fileRenameInp_t::oldFileName, PASS, PASSMSG, modDataObjMeta_t::regParam, fileRenameInp_t::rescHier, DataObjInfo::rescHier, DataObjInfo::rescId, DataObjInfo::rescName, irods::RESOURCE_CREATE_PATH(), rodsLog(), rsFileRename(), rsModDataObjMeta(), rstrcpy(), vaultPathPolicy_t::scheme, irods.pypyodbc::status, and SYS_PHY_PATH_INUSE.
Referenced by syncCollPhyPath(), and syncDataObjPhyPath().