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 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
00031 /******************************************************************************/
00032 
00033 #include <time.h>
00034 #include <sys/stat.h>
00035 #include "XrdOuc/XrdOucDLlist.hh"
00036 #include "XrdSys/XrdSysError.hh"
00037 #include "XrdSys/XrdSysPthread.hh"
00038 
00039 /******************************************************************************/
00040 /*                       X r d O s s S t a g e _ R e q                        */
00041 /******************************************************************************/
00042   
00043 // Flag values
00044 //
00045 #define XRDOSS_REQ_FAIL 0x00C0
00046 #define XRDOSS_REQ_ENOF 0x0040
00047 #define XRDOSS_REQ_ACTV 0x0001
00048 
00049 class XrdOssStage_Req
00050 {
00051 public:
00052 
00053 XrdOucDLlist<XrdOssStage_Req> fullList;
00054 XrdOucDLlist<XrdOssStage_Req> pendList;
00055 
00056 unsigned long               hash;         // Hash value for the path
00057 const    char              *path;
00058 unsigned long long          size;
00059 int                         flags;
00060 time_t                      sigtod;
00061 int                         prty;
00062 
00063 static XrdSysMutex          StageMutex;
00064 static XrdSysSemaphore      ReadyRequest;
00065 static XrdOssStage_Req      StageQ;
00066 
00067        XrdOssStage_Req(unsigned long xhash=0, const char *xpath=0)
00068                       {fullList.setItem(this); pendList.setItem(this);
00069                        hash  = xhash; path = (xpath ? strdup(xpath) : 0);
00070                        flags=0; sigtod=0; size= 2ULL<<31LL; prty=0;
00071                       }
00072 
00073        XrdOssStage_Req(XrdOssStage_Req *that)
00074                       {fullList.setItem(that); pendList.setItem(that);
00075                        hash  = 0; path = 0; flags=0; sigtod=0; size= 0; prty=0;
00076                       }
00077 
00078       ~XrdOssStage_Req() {if (path) free((void *)path);
00079                           fullList.Remove();
00080                           pendList.Remove();
00081                          }
00082 };
00083 #endif