#include <XrdPosixXrootdPath.hh>
|
static bool | AddProto (const char *proto) |
|
static const char * | P2L (const char *who, const char *inP, char *&relP, bool ponly=false) |
|
Definition at line 35 of file XrdPosixXrootdPath.hh.
◆ XrdPosixXrootPath()
XrdPosixXrootPath::XrdPosixXrootPath |
( |
| ) |
|
Definition at line 73 of file XrdPosixXrootdPath.cc.
78 char *plist = 0, *colon = 0, *subs = 0, *lp = 0, *tp = 0;
81 cwdPath = 0; cwdPlen = 0;
83 if (!(plist = getenv(
"XROOTD_VMP")) || !*plist)
return;
84 pBase = strdup(plist);
86 thePaths.Attach(pBase);
88 if ((lp = thePaths.GetLine()))
while((tp = thePaths.GetToken()))
90 if ((colon = rindex(tp, (
int)
':')) && *(colon+1) ==
'/')
91 {
if (!(subs = index(colon, (
int)
'='))) subs = 0;
92 else if (*(subs+1) ==
'/') {*subs =
'\0'; subs++;}
93 else if (*(subs+1)) aOK = 0;
94 else {*subs =
'\0'; subs = (
char*)
"";}
99 while(*(colon+1) ==
'/') colon++;
100 xplist =
new xpath(xplist, tp, colon, subs);
101 }
else DMSG(
"Path",
"Invalid XROOTD_VMP token '" <<tp <<
'"');
References XrdOucTokenizer::Attach(), DMSG, XrdOucTokenizer::GetLine(), and XrdOucTokenizer::GetToken().
◆ ~XrdPosixXrootPath()
XrdPosixXrootPath::~XrdPosixXrootPath |
( |
| ) |
|
Definition at line 109 of file XrdPosixXrootdPath.cc.
113 while((xpnow = xplist))
114 {xplist = xplist->next;
delete xpnow;}
◆ AddProto()
bool XrdPosixXrootPath::AddProto |
( |
const char * |
proto | ) |
|
|
static |
◆ CWD()
void XrdPosixXrootPath::CWD |
( |
const char * |
path | ) |
|
Definition at line 143 of file XrdPosixXrootdPath.cc.
145 if (cwdPath) free(cwdPath);
146 cwdPlen = strlen(path);
147 if (*(path+cwdPlen-1) ==
'/') cwdPath = strdup(path);
148 else if (cwdPlen <= MAXPATHLEN)
149 {
char buff[MAXPATHLEN+8];
151 *(buff+cwdPlen ) =
'/';
152 *(buff+cwdPlen+1) =
'\0';
153 cwdPath = strdup(buff); cwdPlen++;
Referenced by XrdPosix_Chdir().
◆ P2L()
const char * XrdPosixXrootPath::P2L |
( |
const char * |
who, |
|
|
const char * |
inP, |
|
|
char *& |
relP, |
|
|
bool |
ponly = false |
|
) |
| |
|
static |
Definition at line 161 of file XrdPosixXrootdPath.cc.
167 const char *urlP, *slash, *quest;
168 char *outP, *lfnP, lfnBuff[1032];
169 int cgiLen, lfnLen, pfnLen, pfxLen, n;
189 if (notOurs)
return inP;
194 if (!(slash = index(urlP,
'/')))
return inP;
196 pfxLen = slash - inP;
201 if ((quest = index(slash,
'?')))
202 {cgiLen = strlen(quest);
203 pfnLen = quest - slash;
206 pfnLen = strlen(slash);
213 char *pfnBP = (
char *)alloca(pfnLen + 5 + pfxLen + n + 1);
217 strncpy(pfnBP, slash, pfnLen);
222 else {
char *bP = pfnBP+pfnLen;
223 memcpy(bP,
"?src=", 5); bP += 5;
224 strncpy(bP, inP, pfxLen);
227 {
if (*(quest+1) !=
'&') *bP++ =
'&';
244 if (ponly) pfxLen = cgiLen = 0;
248 lfnLen = strlen(lfnP);
249 if (!(relP = (
char *)malloc(pfxLen + lfnLen + cgiLen + 1)))
257 if (pfxLen) {strncpy(outP, inP, pfxLen); outP += pfxLen;}
259 if (cgiLen) strcpy(outP+lfnLen, quest);
263 DEBUG(who <<
' ' <<pfnBP <<
" pfn2lfn " <<lfnBuff);
References DEBUG, EPNAME, XrdPosixGlobals::oidsOK, XrdPosixGlobals::p2lSGI, XrdPosixGlobals::p2lSRC, XrdPosixGlobals::protoTab, and XrdPosixGlobals::theN2N.
Referenced by XrdPosixFile::XrdPosixFile().
◆ URL()
char * XrdPosixXrootPath::URL |
( |
const char * |
path, |
|
|
char * |
buff, |
|
|
int |
blen |
|
) |
| |
Definition at line 274 of file XrdPosixXrootdPath.cc.
276 struct xpath *xpnow = xplist;
278 int plen, pathlen = 0;
290 if (path[0] ==
'.' && path[1] ==
'/' && cwdPath)
291 {pathlen = (strlen(path) + cwdPlen - 2);
292 if (pathlen < (
int)
sizeof(tmpbuff))
293 {strcpy(tmpbuff, cwdPath);
294 strcpy(tmpbuff+cwdPlen, path+2);
295 path = (
const char *)tmpbuff;
301 while(*(path+1) ==
'/') path++;
303 if (!strncmp(path, xpnow->path, xpnow->plen))
break;
304 else xpnow = xpnow->next;
308 if (!xpnow)
return 0;
309 if (!buff)
return (
char *)1;
313 if (!pathlen) pathlen = strlen(path);
314 plen = pathlen + xpnow->servln + 2;
315 if (xpnow->nath) plen = plen - xpnow->plen + xpnow->nlen;
316 if (plen >= blen)
return 0;
321 strcat(buff, xpnow->server);
323 if (xpnow->nath) {strcat(buff, xpnow->nath); path += xpnow->plen;}
324 if (*path !=
'/') strcat(buff,
"/");
References XrdPosixGlobals::protoTab.
Referenced by main(), XrdPosix_Access(), XrdPosix_Acl(), XrdPosix_Fopen(), XrdPosix_isMyPath(), XrdPosix_Lstat(), XrdPosix_Mkdir(), XrdPosix_Open(), XrdPosix_Opendir(), XrdPosix_Pathconf(), XrdPosix_Rename(), XrdPosix_Rmdir(), XrdPosix_Stat(), XrdPosix_Statfs(), XrdPosix_Statvfs(), XrdPosix_Truncate(), XrdPosix_Unlink(), and XrdPosix_URL().
The documentation for this class was generated from the following files: