xrootd
|
00001 #ifndef _XRDCMSXMIREQ_H_ 00002 #define _XRDCMSXMIREQ_H_ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s X m i R e q . h h */ 00006 /* */ 00007 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id$ 00014 00015 #include "XrdCms/XrdCmsReq.hh" 00016 #include "XrdCms/XrdCmsXmi.hh" 00017 #include "XrdSys/XrdSysPthread.hh" 00018 00019 class XrdCmsXmiReq : XrdCmsXmi 00020 { 00021 public: 00022 00023 enum ReqType {do_chmod, do_mkdir, do_mkpath,do_mv, 00024 do_prep, do_rm, do_rmdir, do_stage, do_stat}; 00025 00026 int Chmod ( XrdCmsReq *Request, 00027 mode_t mode, 00028 const char *path, 00029 const char *opaque) 00030 {return Qit(Request, do_chmod, (int)mode, path, opaque);} 00031 00032 int Mkdir ( XrdCmsReq *Request, 00033 mode_t mode, 00034 const char *path, 00035 const char *opaque) 00036 {return Qit(Request, do_mkdir, (int)mode, path, opaque);} 00037 00038 int Mkpath( XrdCmsReq *Request, 00039 mode_t mode, 00040 const char *path, 00041 const char *opaque) 00042 {return Qit(Request, do_mkpath, (int)mode, path, opaque);} 00043 00044 int Prep (const char *ReqID, 00045 int opts, 00046 const char *path, 00047 const char *opaque) 00048 {return Qit(0, do_prep, 0, path, opaque, ReqID);} 00049 00050 int Rename( XrdCmsReq *Request, 00051 const char *oldpath, 00052 const char *oldopaque, 00053 const char *newpath, 00054 const char *newopaque) 00055 {return Qit(Request, do_mv, 0, oldpath, oldopaque, 00056 newpath, newopaque);} 00057 00058 int Remdir( XrdCmsReq *Request, 00059 const char *path, 00060 const char *opaque) 00061 {return Qit(Request, do_rmdir, 0, path, opaque);} 00062 00063 int Remove( XrdCmsReq *Request, 00064 const char *path, 00065 const char *opaque) 00066 {return Qit(Request, do_rm, 0, path, opaque);} 00067 00068 int Select( XrdCmsReq *Request, 00069 int opts, 00070 const char *path, 00071 const char *opaque) 00072 {return Qit(Request, do_stage, opts, path, opaque);} 00073 00074 int Stat ( XrdCmsReq *Request, 00075 const char *path, 00076 const char *opaque) 00077 {return Qit(Request, do_stat, 0, path, opaque);} 00078 00079 static void processPrpQ(); 00080 00081 static void processReqQ(); 00082 00083 static void processStgQ(); 00084 00085 XrdCmsXmiReq(XrdCmsXmi *xp); 00086 00087 XrdCmsXmiReq(XrdCmsReq *reqp, ReqType rqtype, int parms, 00088 const char *path, const char *opaque, 00089 const char *path2=0, const char *opaque2=0); 00090 00091 virtual ~XrdCmsXmiReq(); 00092 00093 private: 00094 void Start(); 00095 int Qit(XrdCmsReq *rp, ReqType, int parms, 00096 const char *path, const char *opaque, 00097 const char *path2=0, const char *opaque2=0); 00098 00099 static XrdCmsXmi *XmiP; 00100 static XrdSysMutex prpMutex; 00101 static XrdSysSemaphore prpReady; 00102 static XrdCmsXmiReq *prpFirst; 00103 static XrdCmsXmiReq *prpLast; 00104 static XrdSysMutex reqMutex; 00105 static XrdSysSemaphore reqReady; 00106 static XrdCmsXmiReq *reqFirst; 00107 static XrdCmsXmiReq *reqLast; 00108 static XrdSysMutex stgMutex; 00109 static XrdSysSemaphore stgReady; 00110 static XrdCmsXmiReq *stgFirst; 00111 static XrdCmsXmiReq *stgLast; 00112 XrdCmsXmiReq *Next; 00113 XrdCmsReq *ReqP; 00114 int Parms; 00115 ReqType Rtype; 00116 char *Path; 00117 char *Opaque; 00118 char *Path2; 00119 char *Opaque2; 00120 }; 00121 #endif