1 #ifndef __SFS_INTERFACE_H__ 2 #define __SFS_INTERFACE_H__ 34 #include <sys/types.h> 45 #define SFS_O_RDONLY 0 // open read/only 46 #define SFS_O_WRONLY 1 // open write/only 47 #define SFS_O_RDWR 2 // open read/write 48 #define SFS_O_CREAT 0x100 // used for file creation 49 #define SFS_O_TRUNC 0x200 // used for file truncation 50 #define SFS_O_MULTIW 0x400 // used for multi-write locations 51 #define SFS_O_POSC 0x0100000 // persist on successful close 52 #define SFS_O_FORCE 0x0200000 // used for locate only 53 #define SFS_O_HNAME 0x0400000 // used for locate only 54 #define SFS_O_LOCAL 0x0800000 // used for locate only (local cmd) 55 #define SFS_O_NOWAIT 0x01000000 // do not impose operational delays 56 #define SFS_O_RAWIO 0x02000000 // allow client-side decompression 57 #define SFS_O_RESET 0x04000000 // Reset any cached information 58 #define SFS_O_REPLICA 0x08000000 // Open for replication 63 #define SFS_O_MKPTH 0x00004000 // Make directory path if missing 68 #define SFS_O_LOCATE 0x10000000 // This request generated by locate() 69 #define SFS_O_STAT 0x20000000 // This request generated by stat() 70 #define SFS_O_META 0x40000000 // This request generated by metaop 78 #define SFS_FCTL_GETFD 1 // Return file descriptor if possible 79 #define SFS_FCTL_STATV 2 // Return visa information 80 #define SFS_FCTL_SPEC1 3 // Return implementation defined information 82 #define SFS_SFIO_FDVAL 0x80000000 // Use SendData() method GETFD response value 86 #define SFS_FSCTL_CMD 255 88 #define SFS_FSCTL_LOCATE 1 // Locate a file 89 #define SFS_FSCTL_STATFS 2 // Return FS data 90 #define SFS_FSCTL_STATLS 3 // Return LS data 91 #define SFS_FSCTL_STATXA 4 // Return XA data 92 #define SFS_FSCTL_STATCC 5 // Return Cluster Config status 93 #define SFS_FSCTL_PLUGIN 8 // Return Implementation Dependent Data 94 #define SFS_FSCTL_PLUGIO 16 // Return Implementation Dependent Data 98 #define SFS_STALL 1 // Return value -> Seconds to stall client 99 #define SFS_OK 0 // ErrInfo code -> All is well 100 #define SFS_ERROR -1 // ErrInfo code -> Error occurred 101 #define SFS_REDIRECT -256 // ErrInfo code -> Port number to redirect to 102 #define SFS_STARTED -512 // ErrInfo code -> Estimated seconds to completion 103 #define SFS_DATA -1024 // ErrInfo code -> Length of data 104 #define SFS_DATAVEC -2048 // ErrInfo code -> Num iovec elements in msgbuff 108 #define SFS_LCLPRFX "/=/" 109 #define SFS_LCLPLEN 3 110 #define SFS_LCLPATH(x) !strncmp(x, SFS_LCLPRFX, SFS_LCLPLEN) 111 #define SFS_LCLPRFY "/=" 112 #define SFS_LCLROOT(x) !strncmp(x, SFS_LCLPRFX, SFS_LCLPLEN-1) \ 113 && (*(x+SFS_LCLPLEN-1) == '/' || *(x+SFS_LCLPLEN-1) == 0) 139 #define Prep_SENDAOK 4 140 #define Prep_SENDERR 8 141 #define Prep_SENDACK 12 142 #define Prep_WMODE 16 143 #define Prep_STAGE 32 144 #define Prep_COLOC 64 145 #define Prep_FRESH 128 146 #define Prep_CANCEL 256 147 #define Prep_QUERY 512 148 #define Prep_EVICT 1024 174 class XrdSfsDirectory;
209 class XrdSfsFileSystem
225 virtual XrdSfsDirectory *newDir(
char *user=0,
int MonID=0) = 0;
239 virtual XrdSfsFile *newFile(
char *user=0,
int MonID=0) = 0;
262 enum csFunc {csCalc = 0, csGet, csSize};
264 virtual int chksum( csFunc Func,
269 const char *opaque = 0)
271 (void)Func; (void)csName; (void)path; (void)eInfo; (void)client;
289 virtual int chmod(
const char *path,
293 const char *opaque = 0) = 0;
348 virtual int FSctl(
const int cmd,
353 (void)cmd; (void)args; (void)eInfo; (void)client;
375 virtual int fsctl(
const int cmd,
392 virtual int getStats(
char *buff,
int blen) = 0;
400 virtual const char *getVersion() = 0;
420 virtual int exists(
const char *path,
424 const char *opaque = 0) = 0;
438 virtual int mkdir(
const char *path,
442 const char *opaque = 0) = 0;
469 virtual int rem(
const char *path,
472 const char *opaque = 0) = 0;
485 virtual int remdir(
const char *path,
488 const char *opaque = 0) = 0;
503 virtual int rename(
const char *oPath,
507 const char *opaqueO = 0,
508 const char *opaqueN = 0) = 0;
523 virtual int stat(
const char *Name,
527 const char *opaque = 0) = 0;
543 virtual int stat(
const char *path,
547 const char *opaque = 0) = 0;
561 virtual int truncate(
const char *path,
565 const char *opaque = 0) = 0;
571 XrdSfsFileSystem() {}
572 virtual ~XrdSfsFileSystem() {}
613 typedef XrdSfsFileSystem *(*XrdSfsFileSystem_t) (XrdSfsFileSystem *nativeFS,
615 const char *configFn);
617 typedef XrdSfsFileSystem *(*XrdSfsFileSystem2_t)(XrdSfsFileSystem *nativeFS,
619 const char *configFn,
685 virtual int open(
const char *fileName,
689 const char *opaque = 0) = 0;
697 virtual int close() = 0;
718 virtual int fctl(
const int cmd,
737 virtual int fctl(
const int cmd,
742 (void)cmd; (void)alen; (void)args; (void)client;
752 virtual const char *FName() = 0;
764 virtual int getMmap(
void **Addr, off_t &Size) = 0;
820 for (
int i = 0; i < rdvCnt; i++)
821 {rdsz =
read(readV[i].offset,
822 readV[i].data, readV[i].size);
823 if (rdsz != readV[i].size)
824 {
if (rdsz < 0)
return rdsz;
849 (void)sfDio; (void)offset; (void)size;
894 for (
int i = 0; i < wdvCnt; i++)
895 {wrsz =
write(writeV[i].offset,
896 writeV[i].data, writeV[i].size);
897 if (wrsz != writeV[i].size)
898 {
if (wrsz < 0)
return wrsz;
916 virtual int stat(
struct stat *buf) = 0;
924 virtual int sync() = 0;
955 virtual int getCXinfo(
char cxtype[4],
int &cxrsz) = 0;
963 virtual void setXio(
XrdSfsXio *xioP) { (void)xioP; }
974 XrdSfsFile(
const char *user=0,
int MonID=0)
975 : error(user, MonID) {}
981 virtual ~XrdSfsFile() {}
994 class XrdSfsDirectory
1015 virtual int open(
const char *path,
1017 const char *opaque = 0) = 0;
1029 virtual const char *nextEntry() = 0;
1037 virtual int close() = 0;
1045 virtual const char *FName() = 0;
1055 virtual int autoStat(
struct stat *buf)
1070 XrdSfsDirectory(
const char *user=0,
int MonID=0)
1071 : error(user, MonID) {}
1077 virtual ~XrdSfsDirectory() {}
#define rename(a, b)
Definition: XrdPosix.hh:87
int opts
Prep_xxx.
Definition: XrdSfsInterface.hh:164
#define truncate(a, b)
Definition: XrdPosix.hh:106
XrdOucTList * oinfo
1-to-1 correspondence of opaque info
Definition: XrdSfsInterface.hh:166
#define writev(a, b, c)
Definition: XrdPosix.hh:112
#define SFS_OK
Definition: XrdSfsInterface.hh:99
const char * Arg1
PLUGIO & PLUGIN.
Definition: XrdSfsInterface.hh:154
int XrdSfsXferSize
Definition: XrdSfsInterface.hh:122
char * notify
Notification path or 0.
Definition: XrdSfsInterface.hh:163
XrdSfsFileExistence
Definition: XrdSfsInterface.hh:124
long long XrdSfsFileOffset
Definition: XrdSfsInterface.hh:119
int Arg1Len
Length.
Definition: XrdSfsInterface.hh:155
Definition: XrdSfsInterface.hh:126
< SFS_FSCTL_PLUGIN/PLUGIO parameters
Definition: XrdSfsInterface.hh:152
#define write(a, b, c)
Definition: XrdPosix.hh:110
Definition: XrdOucErrInfo.hh:99
Definition: XrdSfsInterface.hh:127
Definition: XrdSfsInterface.hh:129
#define SFS_ERROR
Definition: XrdSfsInterface.hh:100
Definition: XrdOucEnv.hh:41
Definition: XrdOucIOVec.hh:40
const char * Arg2
PLUGIN opaque string.
Definition: XrdSfsInterface.hh:157
Definition: XrdOucTList.hh:41
XrdOucTList * paths
List of paths.
Definition: XrdSfsInterface.hh:165
Definition: XrdSysLogger.hh:52
#define stat(a, b)
Definition: XrdPosix.hh:96
char * reqid
Request ID.
Definition: XrdSfsInterface.hh:162
#define close(a)
Definition: XrdPosix.hh:43
int XrdSfsMode
Definition: XrdSfsInterface.hh:121
#define open
Definition: XrdPosix.hh:71
int Arg2Len
Length.
Definition: XrdSfsInterface.hh:156
Definition: XrdSfsDio.hh:46
Definition: XrdSecEntity.hh:51
Definition: XrdSfsInterface.hh:130
#define read(a, b, c)
Definition: XrdPosix.hh:77
Definition: XrdSfsAio.hh:57
< Prepare parameters
Definition: XrdSfsInterface.hh:160
#define mkdir(a, b)
Definition: XrdPosix.hh:69
int XrdSfsFileOpenMode
Definition: XrdSfsInterface.hh:120
int setErrInfo(int code, const char *emsg)
Definition: XrdOucErrInfo.hh:146
Definition: XrdSfsXio.hh:80
#define readv(a, b, c)
Definition: XrdPosix.hh:79
Definition: XrdSfsInterface.hh:128