XrdSfsAio.hh

Go to the documentation of this file.
00001 #ifndef __SFS_AIO_H__
00002 #define __SFS_AIO_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                          X r d S f s A i o . h h                           */
00006 /*                                                                            */
00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*       All Rights Reserved. See XrdInfo.cc for complete License Terms       */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC03-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 //        $Id: XrdSfsAio.hh 35287 2010-09-14 21:19:35Z ganis $
00014 
00015 #include <signal.h>
00016 #include <sys/types.h>
00017 #ifdef _POSIX_ASYNCHRONOUS_IO
00018 #ifdef __macos__
00019 #include <AvailabilityMacros.h>
00020 #include <sys/aio.h>
00021 #else
00022 #include <aio.h>
00023 #endif
00024 #else
00025 struct aiocb {           // Minimal structure to avoid compiler errors
00026        int    aio_fildes;
00027        void  *aio_buf;
00028        size_t aio_nbytes;
00029        off_t  aio_offset;
00030        int    aio_reqprio;
00031        struct sigevent aio_sigevent;
00032       };
00033 #endif
00034 
00035 // The XrdSfsAIO class is meant to be derived. This object provides the
00036 // basic interface to handle AIO control block queues not processing.
00037 //
00038 class XrdSfsAio
00039 {
00040 public:
00041 
00042 struct aiocb sfsAio;
00043 
00044 ssize_t      Result; // If >= 0 valid result; else is -errno
00045 
00046 const char  *TIdent; // Trace information (optional)
00047 
00048 // Method to handle completed reads
00049 //
00050 virtual void doneRead() = 0;
00051 
00052 // Method to hand completed writes
00053 //
00054 virtual void doneWrite() = 0;
00055 
00056 // Method to recycle free object
00057 //
00058 virtual void Recycle() = 0;
00059 
00060              XrdSfsAio() {
00061 #if defined(__macos__) && (!defined(MAC_OS_X_VERSION_10_4) || \
00062     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
00063                          sfsAio.aio_sigevent.sigev_value.sigval_ptr = (void *)this;
00064 #else
00065                          sfsAio.aio_sigevent.sigev_value.sival_ptr  = (void *)this;
00066 #endif
00067                          sfsAio.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
00068                          sfsAio.aio_reqprio = 0;
00069                          TIdent = (char *)"";
00070                         }
00071 virtual     ~XrdSfsAio() {}
00072 };
00073 #endif

Generated on Tue Jul 5 14:47:02 2011 for ROOT_528-00b_version by  doxygen 1.5.1