Loading...
Searching...
No Matches
XrdPss.hh
Go to the documentation of this file.
#ifndef _XRDPSS_API_H
#define _XRDPSS_API_H
/******************************************************************************/
/* */
/* X r d P s s . h h */
/* */
/* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */
/* All Rights Reserved */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <cerrno>
#include <unistd.h>
#include <sys/types.h>
#include <vector>
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdOuc/XrdOucECMsg.hh"
#include "XrdOuc/XrdOucExport.hh"
#include "XrdOuc/XrdOucName2Name.hh"
#include "XrdOuc/XrdOucPList.hh"
#include "XrdOuc/XrdOucSid.hh"
#include "XrdOss/XrdOss.hh"
/******************************************************************************/
/* X r d P s s D i r */
/******************************************************************************/
class XrdPssDir : public XrdOssDF
{
public:
int Close(long long *retsz=0);
int Opendir(const char *, XrdOucEnv &);
int Readdir(char *buff, int blen);
// Store the `buf` pointer in the directory object. Future calls to `Readdir`
// will, as a side-effect, fill in the corresponding `stat` information in
// the memory referred to from the pointer.
//
// Returns -errno on failure; otherwise, returns 0 and stashes away the pointer.
int StatRet(struct stat *buf);
// Constructor and destructor
XrdPssDir(const char *tid)
: XrdOssDF(tid, XrdOssDF::DF_isDir|XrdOssDF::DF_isProxy),
myDir(0) {}
~XrdPssDir() {if (myDir) Close();}
private:
DIR *myDir;
};
/******************************************************************************/
/* X r d P s s F i l e */
/******************************************************************************/
struct XrdOucIOVec;
class XrdSecEntity;
class XrdSfsAio;
class XrdPssFile : public XrdOssDF
{
public:
// The following two are virtual functions to allow for upcasting derivations
// of this implementation
//
virtual int Close(long long *retsz=0);
virtual int Open(const char *, int, mode_t, XrdOucEnv &);
int Fchmod(mode_t mode) {return XrdOssOK;}
int Fstat(struct stat *);
int Fsync();
int Fsync(XrdSfsAio *aiop);
int Ftruncate(unsigned long long);
ssize_t pgRead (void* buffer, off_t offset, size_t rdlen,
uint32_t* csvec, uint64_t opts);
int pgRead (XrdSfsAio* aioparm, uint64_t opts);
ssize_t pgWrite(void* buffer, off_t offset, size_t wrlen,
uint32_t* csvec, uint64_t opts);
int pgWrite(XrdSfsAio* aioparm, uint64_t opts);
ssize_t Read( off_t, size_t);
ssize_t Read( void *, off_t, size_t);
int Read(XrdSfsAio *aiop);
ssize_t ReadV(XrdOucIOVec *readV, int n);
ssize_t ReadRaw( void *, off_t, size_t);
ssize_t Write(const void *, off_t, size_t);
int Write(XrdSfsAio *aiop);
// Constructor and destructor
XrdPssFile(const char *tid)
: XrdOssDF(tid, XrdOssDF::DF_isFile|XrdOssDF::DF_isProxy),
rpInfo(0), tpcPath(0), entity(0) {}
virtual ~XrdPssFile() {if (fd >= 0) Close();
if (rpInfo) delete(rpInfo);
if (tpcPath) free(tpcPath);
}
private:
struct tprInfo
{char *tprPath;
char *dstURL;
size_t fSize;
tprInfo(const char *fn) : tprPath(strdup(fn)),dstURL(0),fSize(0)
{}
~tprInfo() {if (tprPath) free(tprPath);
if (dstURL) free(dstURL);
}
} *rpInfo;
char *tpcPath;
const XrdSecEntity *entity;
};
/******************************************************************************/
/* X r d P s s S y s */
/******************************************************************************/
class XrdNetSecurity;
class XrdOucEnv;
class XrdOucStream;
class XrdOucTList;
class XrdPssUrlInfo;
class XrdSecsssID;
class XrdSysError;
struct XrdVersionInfo;
class XrdPssSys : public XrdOss
{
public:
virtual XrdOssDF *newDir(const char *tident) override
{return (XrdOssDF *)new XrdPssDir(tident);}
virtual XrdOssDF *newFile(const char *tident) override
{return (XrdOssDF *)new XrdPssFile(tident);}
virtual void Connect(XrdOucEnv &) override;
virtual void Disc(XrdOucEnv &) override;
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override;
bool ConfigMapID();
virtual
int Create(const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override;
void EnvInfo(XrdOucEnv *envP) override;
uint64_t Features() override {return myFeatures;}
int Init(XrdSysLogger *, const char *) override {return -ENOTSUP;}
int Init(XrdSysLogger *, const char *, XrdOucEnv *envP) override;
int Lfn2Pfn(const char *Path, char *buff, int blen) override;
const
char *Lfn2Pfn(const char *Path, char *buff, int blen, int &rc) override;
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override;
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override;
int Rename(const char *, const char *,
XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override;
int Stat(const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override;
int Stats(char *bp, int bl) override;
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override;
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override;
static const int PolNum = 2;
enum PolAct {PolPath = 0, PolObj = 1};
static int Info(int rc);
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType,
const char *path);
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo);
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo,
bool doN2N=true);
static const char *ConfigFN; // -> Pointer to the config file name
static const char *myHost;
static const char *myName;
static
XrdOucPListAnchor XPList; // Exported path list
static XrdNetSecurity *Police[PolNum];
static XrdOucTList *ManList;
static char *fileOrgn;
static const char *protName;
static const char *hdrData;
static int hdrLen;
static int Streams;
static int Workers;
static int Trace;
static int dcaCTime;
static bool xLfn2Pfn;
static bool dcaCheck;
static bool dcaWorld;
static bool deferID; // Defer ID mapping until needed
static bool reProxy; // TPC requires reproxing
XrdPssSys();
virtual ~XrdPssSys() {}
private:
char *HostArena;// -> path qualification for remote origins
char *LocalRoot;// -> pss Local n2n root, if any
XrdOucName2Name *theN2N; // -> File mapper object
unsigned long long DirFlags; // Defaults for exports
XrdVersionInfo *myVersion;// -> Compilation version
XrdSecsssID *idMapper; // -> Auth ID mapper
uint64_t myFeatures;// Our feature set
int Configure(const char *, XrdOucEnv *);
int ConfigProc(const char *ConfigFN);
int ConfigXeq(char*, XrdOucStream&);
int xconf(XrdSysError *Eroute, XrdOucStream &Config);
int xdef( XrdSysError *Eroute, XrdOucStream &Config);
int xdca( XrdSysError *errp, XrdOucStream &Config);
int xexp( XrdSysError *Eroute, XrdOucStream &Config);
int xperm(XrdSysError *errp, XrdOucStream &Config);
int xpers(XrdSysError *errp, XrdOucStream &Config);
int xorig(XrdSysError *errp, XrdOucStream &Config);
};
#endif
tident
#define tident
Definition XrdBwmHandle.cc:109
Stat
struct stat Stat
Definition XrdCks.cc:49
XrdOss.hh
XrdOssOK
#define XrdOssOK
Definition XrdOss.hh:50
XrdOucECMsg.hh
XrdOucExport.hh
XrdOucName2Name.hh
XrdOucPList.hh
XrdOucSid.hh
stat
#define stat(a, b)
Definition XrdPosix.hh:101
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
Create
bool Create
Definition XrdSecpwdSrvAdmin.cc:176
opts
struct myOpts opts
XrdSysHeaders.hh
XrdNetSecurity
Definition XrdNetSecurity.hh:44
XrdOssDF
Definition XrdOss.hh:63
XrdOssDF::DF_isFile
static const uint16_t DF_isFile
Object is for a file.
Definition XrdOss.hh:393
XrdOssDF::XrdOssDF
XrdOssDF(const char *tid="", uint16_t dftype=0, int fdnum=-1)
Definition XrdOss.hh:444
XrdOssDF::fd
int fd
Definition XrdOss.hh:455
XrdOssDF::DF_isDir
static const uint16_t DF_isDir
Object is for a directory.
Definition XrdOss.hh:392
XrdOssDF::DF_isProxy
static const uint16_t DF_isProxy
Object is a proxy object.
Definition XrdOss.hh:394
XrdOss::XrdOss
XrdOss()
Constructor and Destructor.
Definition XrdOss.hh:897
XrdOucEnv
Definition XrdOucEnv.hh:42
XrdOucName2Name
Definition XrdOucName2Name.hh:49
XrdOucPListAnchor
Definition XrdOucPList.hh:89
XrdOucStream
Definition XrdOucStream.hh:47
XrdOucTList
Definition XrdOucTList.hh:42
XrdPssDir
Definition XrdPss.hh:50
XrdPssDir::~XrdPssDir
~XrdPssDir()
Definition XrdPss.hh:68
XrdPssDir::Close
int Close(long long *retsz=0)
Definition XrdPss.cc:748
XrdPssDir::Opendir
int Opendir(const char *, XrdOucEnv &)
Definition XrdPss.cc:650
XrdPssDir::Readdir
int Readdir(char *buff, int blen)
Definition XrdPss.cc:707
XrdPssDir::StatRet
int StatRet(struct stat *buf)
Definition XrdPss.cc:728
XrdPssDir::XrdPssDir
XrdPssDir(const char *tid)
Definition XrdPss.hh:64
XrdPssFile
Definition XrdPss.hh:82
XrdPssFile::ReadRaw
ssize_t ReadRaw(void *, off_t, size_t)
Definition XrdPss.cc:1145
XrdPssFile::Fsync
int Fsync()
Definition XrdPss.cc:1273
XrdPssFile::~XrdPssFile
virtual ~XrdPssFile()
Definition XrdPss.hh:115
XrdPssFile::Close
virtual int Close(long long *retsz=0)
Definition XrdPss.cc:919
XrdPssFile::Open
virtual int Open(const char *, int, mode_t, XrdOucEnv &)
Definition XrdPss.cc:783
XrdPssFile::Read
ssize_t Read(off_t, size_t)
Definition XrdPss.cc:1069
XrdPssFile::Fstat
int Fstat(struct stat *)
Definition XrdPss.cc:1187
XrdPssFile::Fchmod
int Fchmod(mode_t mode)
Definition XrdPss.hh:91
XrdPssFile::Write
ssize_t Write(const void *, off_t, size_t)
Definition XrdPss.cc:1165
XrdPssFile::XrdPssFile
XrdPssFile(const char *tid)
Definition XrdPss.hh:111
XrdPssFile::ReadV
ssize_t ReadV(XrdOucIOVec *readV, int n)
Definition XrdPss.cc:1107
XrdPssFile::pgRead
ssize_t pgRead(void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:960
XrdPssFile::Ftruncate
int Ftruncate(unsigned long long)
Definition XrdPss.cc:1302
XrdPssFile::pgWrite
ssize_t pgWrite(void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
Definition XrdPss.cc:1013
XrdPssSys::~XrdPssSys
virtual ~XrdPssSys()
Definition XrdPss.hh:218
XrdPssSys::PolNum
static const int PolNum
Definition XrdPss.hh:184
XrdPssSys::Mkdir
int Mkdir(const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:350
XrdPssSys::P2OUT
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1353
XrdPssSys::Features
uint64_t Features() override
Definition XrdPss.hh:169
XrdPssSys::dcaCTime
static int dcaCTime
Definition XrdPss.hh:209
XrdPssSys::Unlink
int Unlink(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:600
XrdPssSys::Streams
static int Streams
Definition XrdPss.hh:206
XrdPssSys::XrdPssSys
XrdPssSys()
Definition XrdPss.cc:165
XrdPssSys::Connect
virtual void Connect(XrdOucEnv &) override
Definition XrdPss.cc:234
XrdPssSys::Truncate
int Truncate(const char *, unsigned long long, XrdOucEnv *eP=0) override
Definition XrdPss.cc:559
XrdPssSys::Stats
int Stats(char *bp, int bl) override
Definition XrdPss.cc:541
XrdPssSys::Info
static int Info(int rc)
Definition XrdPss.cc:1313
XrdPssSys::deferID
static bool deferID
Definition XrdPss.hh:214
XrdPssSys::ConfigFN
static const char * ConfigFN
Definition XrdPss.hh:194
XrdPssSys::hdrLen
static int hdrLen
Definition XrdPss.hh:205
XrdPssSys::hdrData
static const char * hdrData
Definition XrdPss.hh:204
XrdPssSys::Init
int Init(XrdSysLogger *, const char *) override
Definition XrdPss.hh:170
XrdPssSys::ManList
static XrdOucTList * ManList
Definition XrdPss.hh:201
XrdPssSys::fileOrgn
static char * fileOrgn
Definition XrdPss.hh:202
XrdPssSys::P2DST
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1326
XrdPssSys::dcaCheck
static bool dcaCheck
Definition XrdPss.hh:212
XrdPssSys::reProxy
static bool reProxy
Definition XrdPss.hh:215
XrdPssSys::Chmod
int Chmod(const char *, mode_t mode, XrdOucEnv *eP=0) override
Definition XrdPss.cc:223
XrdPssSys::Workers
static int Workers
Definition XrdPss.hh:207
XrdPssSys::newDir
virtual XrdOssDF * newDir(const char *tident) override
Definition XrdPss.hh:155
XrdPssSys::PolAct
PolAct
Definition XrdPss.hh:185
XrdPssSys::PolObj
@ PolObj
Definition XrdPss.hh:185
XrdPssSys::PolPath
@ PolPath
Definition XrdPss.hh:185
XrdPssSys::EnvInfo
void EnvInfo(XrdOucEnv *envP) override
Definition XrdPss.cc:303
XrdPssSys::Police
static XrdNetSecurity * Police[PolNum]
Definition XrdPss.hh:101
XrdPssSys::myName
static const char * myName
Definition XrdPss.hh:196
XrdPssSys::newFile
virtual XrdOssDF * newFile(const char *tident) override
Definition XrdPss.hh:157
XrdPssSys::Trace
static int Trace
Definition XrdPss.hh:208
XrdPssSys::ConfigMapID
bool ConfigMapID()
Definition XrdPssConfig.cc:375
XrdPssSys::XPList
static XrdOucPListAnchor XPList
Definition XrdPss.hh:198
XrdPssSys::P2URL
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1417
XrdPssSys::myHost
static const char * myHost
Definition XrdPss.hh:195
XrdPssSys::Remdir
int Remdir(const char *, int Opts=0, XrdOucEnv *eP=0) override
Definition XrdPss.cc:389
XrdPssSys::Lfn2Pfn
int Lfn2Pfn(const char *Path, char *buff, int blen) override
Definition XrdPss.cc:318
XrdPssSys::xLfn2Pfn
static bool xLfn2Pfn
Definition XrdPss.hh:211
XrdPssSys::Disc
virtual void Disc(XrdOucEnv &) override
Definition XrdPss.cc:283
XrdPssSys::Rename
int Rename(const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
Definition XrdPss.cc:437
XrdPssSys::dcaWorld
static bool dcaWorld
Definition XrdPss.hh:213
XrdPssSys::protName
static const char * protName
Definition XrdPss.hh:203
XrdPssUrlInfo
Definition XrdPssUrlInfo.hh:38
XrdSecEntity
Definition XrdSecEntity.hh:65
XrdSecsssID
Definition XrdSecsssID.hh:54
XrdSfsAio
Definition XrdSfsAio.hh:59
XrdSysError
Definition XrdSysError.hh:90
XrdSysLogger
Definition XrdSysLogger.hh:53
XrdOucIOVec
Definition XrdOucIOVec.hh:41