00001 #ifndef __XRDOSSMIO_H__ 00002 #define __XRDOSSMIO_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d o s s M i o . h h */ 00006 /* */ 00007 /* (c) 2005 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: XrdOssMio.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 #include "XrdSys/XrdSysError.hh" 00016 #include "XrdOuc/XrdOucHash.hh" 00017 #include "XrdSys/XrdSysPthread.hh" 00018 #include "XrdOss/XrdOssMioFile.hh" 00019 00020 // The following are options passed to Map() 00021 // 00022 #define OSSMIO_MLOK 0x0001 00023 #define OSSMIO_MMAP 0x0002 00024 #define OSSMIO_MPRM 0x0004 00025 00026 class XrdOssMio 00027 { 00028 public: 00029 static void Display(XrdSysError &Eroute); 00030 00031 static int getOpts(char *path, int popts); 00032 00033 static char isAuto() {return MM_chk;} 00034 00035 static char isOn() {return MM_on;} 00036 00037 static XrdOssMioFile *Map(char *path, int fd, int opts); 00038 00039 static void *preLoad(void *arg); 00040 00041 static void Recycle(XrdOssMioFile *mp); 00042 00043 static void Set(int V_off, int V_preld, int V_chklok, 00044 int V_chkmap, int V_chkkeep); 00045 00046 static void Set(long long V_max); 00047 00048 private: 00049 static int Reclaim(off_t amount); 00050 static int Reclaim(XrdOssMioFile *mp); 00051 00052 static XrdOucHash<XrdOssMioFile> MM_Hash; 00053 00054 static XrdSysMutex MM_Mutex; 00055 static XrdOssMioFile *MM_Perm; 00056 static XrdOssMioFile *MM_Idle; 00057 static XrdOssMioFile *MM_IdleLast; 00058 00059 static char MM_on; 00060 static char MM_chk; 00061 static char MM_chklok; 00062 static char MM_chkmap; 00063 static char MM_chkkeep; 00064 static char MM_okmlock; 00065 static char MM_preld; 00066 static long long MM_max; 00067 static long long MM_pagsz; 00068 static long long MM_pages; 00069 static long long MM_inuse; 00070 }; 00071 #endif