1 #ifndef _XRDOSSCSICONFIG_H
2 #define _XRDOSSCSICONFIG_H
53 if (!path || !*path)
return false;
62 if (
prefix_.length() == s.length())
return true;
63 if (s[
prefix_.length()] ==
'/')
return true;
68 const size_t haystack = s.length();
69 const size_t needle = suffix_.length();
70 if (haystack >= needle && s.substr(haystack-needle, std::string::npos) == suffix_)
return true;
76 if (!v.empty() && v[0] !=
'/')
78 Eroute.
Emsg(
"Config",
"prefix must be empty or start with /");
92 if (!path || !*path ||
prefix_.empty())
return std::string();
96 simplePath(p,&wasabs);
98 if (p.length()>1) ret += p;
108 if (!path || !*path ||
prefix_.empty())
return false;
112 if (prefixstart_ == p)
return true;
126 if (!path || !*path)
return std::string();
129 simplePath(p,&wasabs);
130 if (wasabs)
return prefix_ + p + suffix_;
131 return prefix_.substr(1) + p + suffix_;
139 void calcPrefixElements()
141 prefixstart_.clear();
145 const size_t idx =
prefix_.rfind(
"/");
146 prefixstart_ =
prefix_.substr(0,idx);
147 if (prefixstart_.empty()) prefixstart_ = std::string(
"/");
148 prefixend_ =
prefix_.substr(idx+1,std::string::npos);
157 void simplePath(std::string &str,
bool *ls=
nullptr)
162 i = str.find(
"//", i);
163 if (i == std::string::npos)
break;
165 }
while (!str.empty());
168 if (str.length()>1 && str[str.length()-1] ==
'/')
170 str.erase( str.end()-1 );
173 if (ls) *ls=(str.length() ? true :
false);
175 if (str.length() && str[0] !=
'/')
182 std::string prefixstart_;
183 std::string prefixend_;
184 const std::string suffix_;
191 XrdOssCsiConfig() : fillFileHole_(true), xrdtSpaceName_(
"public"), allowMissingTags_(true), disablePgExtend_(false), disableLooseWrite_(false) { }
216 std::string xrdtSpaceName_;
217 bool allowMissingTags_;
218 bool disablePgExtend_;
219 bool disableLooseWrite_;
std::string getPrefixName()
bool matchPrefixDir(const char *path)
std::string makeBaseDirname(const char *path)
std::string makeTagFilename(const char *path)
bool isTagFile(const char *path)
int SetPrefix(XrdSysError &Eroute, const std::string &v)
bool fillFileHole() const
std::string xrdtSpaceName() const
int Init(XrdSysError &, const char *, const char *, XrdOucEnv *)
bool disableLooseWrite() const
bool disablePgExtend() const
bool allowMissingTags() const
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)