Skip to content

Commit

Permalink
Removal of unsupported rfio protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jfernan2 committed May 10, 2017
1 parent 9556e93 commit 5812d91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
36 changes: 2 additions & 34 deletions IORawData/DTCommissioning/plugins/RawFile.cc
Expand Up @@ -11,18 +11,9 @@

using namespace std;

extern "C" {
extern FILE* rfio_fopen(char *path, char *mode);
extern int rfio_fread(void*, size_t, size_t, void*);
extern int rfio_fclose(FILE *fd);
extern int rfio_fseek(FILE *fp, long offset, int whence);
extern int rfio_feof(FILE *fp);
extern long rfio_ftell(FILE *fp);
}

RawFile::RawFile() : inputFile(0), rfioFlag(false), xrootdFlag(false) {}
RawFile::RawFile() : inputFile(0), xrootdFlag(false) {}

RawFile::RawFile(const char* path) : inputFile(0), rfioFlag(false), xrootdFlag(false) {
RawFile::RawFile(const char* path) : inputFile(0), xrootdFlag(false) {
open(path);
}

Expand All @@ -39,16 +30,11 @@ RawFile* RawFile::open(const char* path) {
if (strlen(prefix)<strlen(path)) filename = strtok(0,":");
//cout << " Filename: " << filename << endl;

if (strcmp(prefix,"rfio")==0) rfioFlag = true;
if (strcmp(prefix,"castor")==0) rfioFlag = true;
if (strcmp(prefix,"root")==0) xrootdFlag = true;

if (xrootdFlag) {
char chopt[] = "rb";
inputFile = XrdPosix_Fopen(path,chopt);
} else if (rfioFlag) {
char chopt[] = "r";
inputFile = rfio_fopen(filename,chopt);
} else {
char chopt[] = "rb";
inputFile = fopen(filename,chopt);
Expand All @@ -69,9 +55,6 @@ int RawFile::close() {

if (xrootdFlag) {
flag = XrdPosix_Fclose(inputFile);
}
else if (rfioFlag) {
flag = rfio_fclose(inputFile);
} else {
flag = fclose(inputFile);
}
Expand All @@ -87,16 +70,11 @@ bool RawFile::ok(){ return (inputFile!=0);}

bool RawFile::fail(){ return !ok();}

bool RawFile::isRFIO() { return rfioFlag;}

bool RawFile::isXROOTD() { return xrootdFlag;}

int RawFile::read(void* data, size_t nbytes) {
if (xrootdFlag) {
return XrdPosix_Fread(data,nbytes,1,inputFile);
}
else if (rfioFlag) {
return rfio_fread(data, nbytes, 1, inputFile);
} else {
return fread(data, nbytes, 1, inputFile);
}
Expand All @@ -105,9 +83,6 @@ int RawFile::read(void* data, size_t nbytes) {
int RawFile::seek(long offset, int whence) {
if (xrootdFlag) {
return XrdPosix_Fseek(inputFile, offset, whence);
}
else if (rfioFlag) {
return rfio_fseek(inputFile, offset, whence);
} else {
return fseek(inputFile, offset, whence);
}
Expand All @@ -116,19 +91,12 @@ int RawFile::seek(long offset, int whence) {
int RawFile::ignore(long offset) { return seek(offset, SEEK_CUR);}

int RawFile::eof() {
if (rfioFlag) {
return rfio_feof(inputFile);
} else {
return feof(inputFile); // Also for XROOTD
}
}

long RawFile::tell() {
if (xrootdFlag) {
return XrdPosix_Ftell(inputFile);
}
else if (rfioFlag) {
return rfio_ftell(inputFile);
} else {
return ftell(inputFile);
}
Expand Down
1 change: 0 additions & 1 deletion IORawData/DTCommissioning/plugins/RawFile.h
Expand Up @@ -61,7 +61,6 @@ class RawFile {
private:

FILE* inputFile;
bool rfioFlag;
bool xrootdFlag;
};
#endif

0 comments on commit 5812d91

Please sign in to comment.