23 DOUT2(
"Close existing connection to RFIO data mover");
33 if (((opt==0) || (*opt==0)) && (fRemote==0)) {
43 std::string rfioLustrePath =
"/hera/hades/may14raw";
47 std::string rfioOptions =
"wb";
50 rfioCopyMode = url.
GetOptionInt(
"rfioCopyMode", rfioCopyMode);
55 rfioCopyFrac = url.
GetOptionInt(
"rfioCopyFrac", rfioCopyFrac);
60 rfioMaxFile = url.
GetOptionInt(
"rfioMaxFile", rfioMaxFile);
65 rfioPathConv = url.
GetOptionInt(
"rfioPathConv", rfioPathConv);
70 rfioLustrePath = url.
GetOptionStr(
"rfioLustrePath", rfioLustrePath);
75 rfioOptions = url.
GetOptionStr(
"rfioOptions", rfioOptions);
83 strncpy(rfioBase, fname,
sizeof(rfioBase)-1);
85 char* pcc = (
char*) strrchr(rfioBase,
':');
92 strncpy(fDataMoverName,
"",
sizeof(fDataMoverName)-1);
95 DOUT1(
"Try to connect to RFIO mover rfioBase=%s rfioOptions=%s rfioLustrePath=%s rfioCopyMode=%d rfioCopyFrac=%d rfioMaxFile=%d rfioPathConv=%d",
96 rfioBase, rfioOptions.c_str(), rfioLustrePath.c_str(), rfioCopyMode, rfioCopyFrac, rfioMaxFile, rfioPathConv);
99 fDataMoverName, &fDataMoverIndx,
100 rfioCopyMode, (
char*) rfioLustrePath.c_str(),
101 rfioCopyFrac, rfioMaxFile, rfioPathConv);
103 EOUT(
"Fail to create connection with RFIO, using following arguments"
104 "rfioBase=%s rfioOptions=%s rfioLustrePath=%s rfioCopyMode=%d rfioCopyFrac=%d rfioMaxFile=%d rfioPathConv=%d",
105 rfioBase, rfioOptions.c_str(), rfioLustrePath.c_str(), rfioCopyMode, rfioCopyFrac, rfioMaxFile, rfioPathConv);
109 DOUT2(
"Successfully opened connection to datamover %d %s", fDataMoverIndx, fDataMoverName);
116 DOUT3(
"Calling rfio_fnewfile %s", fname);
120 DOUT3(
"Did call rfio_fnewfile %s rev = %d", fname, rev);
123 EOUT(
"Fail to create new RFIO file %s via existing datamover %d %s connection", fname, fDataMoverIndx, fDataMoverName);
129 if (fOpenedCounter > 100)
EOUT(
"Too many (%d) files, opened via RFIO connection", fOpenedCounter);
137 if (strcmp(parname,
"RFIO")==0)
return 8;
138 if (fRemote && strcmp(parname,
"DataMoverIndx")==0)
return fDataMoverIndx;
144 if (fRemote && strcmp(parname,
"DataMoverName")==0)
145 if (strlen(fDataMoverName) < (
unsigned) sbuflen) {
146 strncpy(sbuf, fDataMoverName, sbuflen);
156 if ((fRemote!=0) && (f==fRemote)) {
159 if (fOpenedCounter < 0)
EOUT(
"Too many close operations - counter (%d) is negative", fOpenedCounter);
163 if (fRemote!=0)
EOUT(
"Get RFIO::fclose with unexpected argument when fRemote!=0 cnt %d", fOpenedCounter);
171 return ((f==0) || (ptr==0) || (sz==0)) ? 0 :
rfio_fwrite((
const char*)ptr, sz, nmemb, (
RFILE*) f) / sz;
176 return ((f==0) || (ptr==0) || (sz==0)) ? 0 :
rfio_fread((
char*) ptr, sz, nmemb, (
RFILE*) f) / sz;
181 if (f==0)
return false;
185 printf(
"rfio::FileInterface::fseek not working with original version of ADSM library\n");
190 if (fileid<0)
return false;
192 return rfio_lseek(fileid, offset, relative ? SEEK_CUR : SEEK_SET) >= 0;
void * Handle
File handle descriptor.
Base class for most of the DABC classes.
Uniform Resource Locator interpreter.
std::string GetOptionStr(const std::string &optname, const std::string &dflt="") const
bool HasOption(const std::string &optname) const
int GetOptionInt(const std::string &optname, int dflt=0) const
void SetOptions(const std::string &opt)
Method allows to set URL options directly to be able use all Get methods.
char fDataMoverName[64]
obtained data mover index
virtual void fclose(Handle f)
virtual bool fseek(Handle f, long int offset, bool realtive=true)
virtual bool feof(Handle f)
virtual bool GetFileStrPar(Handle h, const char *parname, char *sbuf, int sbuflen)
Method returns file-specific string parameter.
virtual size_t fread(void *ptr, size_t sz, size_t nmemb, Handle f)
virtual int GetFileIntPar(Handle h, const char *parname)
Method returns file-specific int parameter.
FileInterface()
obtained data mover name
virtual size_t fwrite(const void *ptr, size_t sz, size_t nmemb, Handle f)
virtual Handle fopen(const char *fname, const char *mode, const char *opt=0)
virtual dabc::Object * fmatch(const char *fmask, bool select_files=true)
Produce list of files, object must be explicitly destroyed with ref.Destroy call One could decide if ...
virtual bool fflush(Handle f)
RFILE * rfio_fopen(char *pcFile, char *pcOptions)
size_t rfio_fwrite(const char *pcBuffer, size_t iSize, size_t iItems, RFILE *pRemFile)
int rfio_lseek(int iFileId, int ilocOffset, int ilocSeekMode)
int rfio_fclose(RFILE *pRemFile)
RFILE * rfio_fopen_gsidaq_dm(char *pcFile, char *pcOptions, char *pcDataMover, int *piDataMover, int iCopyMode, char *pcCopyPath, int iCopyFraction, int iMaxFile, int iPathConvention)
int rfio_fendfile(RFILE *pRemFile)
int rfio_fnewfile(RFILE *pRemFile, char *pcFile)
size_t rfio_fread(char *pcBuffer, size_t iSize, size_t iItems, RFILE *pRemFile)
int rfio_ffileid(RFILE *fRemoteFile)