54#if defined(_GFAL2_API_) || defined(GFAL2_API_) || defined(_GFAL2_API) || defined(_GFAL2_API_H_) || defined(GFAL2_API_H_) || defined(_GFAL2_API_H)
55#define gfal_lseek64 gfal_lseek
56#define gfal_open64 gfal_open
57#define gfal_readdir64 gfal_readdir
58#define gfal_stat64 gfal_stat
59#define dirent64 dirent
82 :
TFile(url,
"NET", ftitle, compress)
96 if (!create && !recreate && !
update && !read) {
106 fname = (
char *)stmp.
Data();
114 ::gfal_unlink(fname);
119 if (create && ::gfal_access(fname,
kFileExists) == 0) {
120 Error(
"TGFALFile",
"file %s already exists", fname);
129 Error(
"TGFALFile",
"no write permission, could not open file %s", fname);
134#ifdef GFAL_ACCESS_FIXED
136 Error(
"TGFALFile",
"file %s does not exist", fname);
140 Error(
"TGFALFile",
"no read permission, could not open file %s", fname);
151 fD =
SysOpen(fname, O_RDWR | O_CREAT, 0644);
156 SysError(
"TGFALFile",
"file %s can not be opened", fname);
167 SysError(
"TGFALFile",
"file %s can not be opened for reading", fname);
196 Int_t ret = ::gfal_open64(pathname, flags, (
Int_t) mode);
206 Int_t ret = ::gfal_close(fd);
216 Int_t ret = ::gfal_read(fd, buf, len);
226 Int_t ret = ::gfal_write(fd, buf, len);
238 Long64_t ret = ::gfal_lseek64(fd, offset, whence);
256 if (::gfal_stat64(
fRealName, &statbuf) >= 0)
262 *
id = (statbuf.st_dev << 24) + statbuf.st_ino;
264 *size = statbuf.st_size;
266 *modtime = statbuf.st_mtime;
269 if (statbuf.st_mode & ((S_IEXEC)|(S_IEXEC>>3)|(S_IEXEC>>6)))
271 if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
273 if ((statbuf.st_mode & S_IFMT) != S_IFREG &&
274 (statbuf.st_mode & S_IFMT) != S_IFDIR)
371 Error(
"OpenDirectory",
"invalid directory pointer (should never happen)");
382 if ((finfo.st_mode & S_IFMT) != S_IFDIR)
396 Error(
"FreeDirectory",
"invalid directory pointer (should never happen)");
401 ::gfal_closedir((DIR*)dirp);
412 Error(
"GetDirEntry",
"invalid directory pointer (should never happen)");
419 dp = ::gfal_readdir64((DIR*)dirp);
441 buf.
fDev = sbuf.st_dev;
442 buf.
fIno = sbuf.st_ino;
443 buf.
fMode = sbuf.st_mode;
444 buf.
fUid = sbuf.st_uid;
445 buf.
fGid = sbuf.st_gid;
446 buf.
fSize = sbuf.st_size;
447 buf.
fMtime = sbuf.st_mtime;
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
R__EXTERN TSystem * gSystem
Bool_t fWritable
True if directory is writable.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Close(Option_t *option="")
Close a file.
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
virtual void Init(Bool_t create)
Initialize a TFile object.
TString fOption
File options.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
TString fRealName
Effective real file name (not original url)
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Read and write data via the underlying Grid access mechanism.
Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
~TGFALFile()
GFAL file dtor. Close and flush directory structure.
Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close.
struct stat64 fStatBuffer
! (transient) Cached file status buffer (for performance)
Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write.
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Interface to TSystem:GetPathInfo().
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via GFAL.
Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read.
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via GFAL.
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open.
Bool_t fStatCached
! (transient) is file status cached?
Directory handler for GFAL.
void * OpenDirectory(const char *name)
Open a directory via GFAL.
const char * GetDirEntry(void *dirp)
Get directory entry via GFAL. Returns 0 in case no more entries.
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
TGFALSystem()
Create helper class that allows directory access via GFAL.
void FreeDirectory(void *dirp)
Free directory via GFAL.
Int_t MakeDirectory(const char *name)
Make a directory via GFAL.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
void ToUpper()
Change string to upper case.
Abstract base class defining a generic interface to the underlying Operating System.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
This class represents a WWW compatible URL.
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).