xrootd

XrdOssStage.hh

Go to the documentation of this file.
00001 #ifndef __XRDOSS_STAGE_H__
00002 #define __XRDOSS_STAGE_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d O s s S t a g e . h h                         */
00006 /*                                                                            */
00007 /* (c) 2008 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 <time.h>
00016 #include <sys/stat.h>
00017 #include "XrdOuc/XrdOucDLlist.hh"
00018 #include "XrdSys/XrdSysError.hh"
00019 #include "XrdSys/XrdSysPthread.hh"
00020 
00021 /******************************************************************************/
00022 /*                       X r d O s s S t a g e _ R e q                        */
00023 /******************************************************************************/
00024   
00025 // Flag values
00026 //
00027 #define XRDOSS_REQ_FAIL 0x00C0
00028 #define XRDOSS_REQ_ENOF 0x0040
00029 #define XRDOSS_REQ_ACTV 0x0001
00030 
00031 class XrdOssStage_Req
00032 {
00033 public:
00034 
00035 XrdOucDLlist<XrdOssStage_Req> fullList;
00036 XrdOucDLlist<XrdOssStage_Req> pendList;
00037 
00038 unsigned long               hash;         // Hash value for the path
00039 const    char              *path;
00040 unsigned long long          size;
00041 int                         flags;
00042 time_t                      sigtod;
00043 int                         prty;
00044 
00045 static XrdSysMutex          StageMutex;
00046 static XrdSysSemaphore      ReadyRequest;
00047 static XrdOssStage_Req      StageQ;
00048 
00049        XrdOssStage_Req(unsigned long xhash=0, const char *xpath=0)
00050                       {fullList.setItem(this); pendList.setItem(this);
00051                        hash  = xhash; path = (xpath ? strdup(xpath) : 0);
00052                        flags=0; sigtod=0; size= 2ULL<<31LL; prty=0;
00053                       }
00054 
00055        XrdOssStage_Req(XrdOssStage_Req *that)
00056                       {fullList.setItem(that); pendList.setItem(that);
00057                        hash  = 0; path = 0; flags=0; sigtod=0; size= 0; prty=0;
00058                       }
00059 
00060       ~XrdOssStage_Req() {if (path) free((void *)path);
00061                           fullList.Remove();
00062                           pendList.Remove();
00063                          }
00064 };
00065 #endif