|
|
|||
File indexing completed on 2026-01-08 10:33:39
0001 #ifndef __SFS_AIO_H__ 0002 #define __SFS_AIO_H__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d S f s A i o . h h */ 0006 /* */ 0007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0009 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0010 /* */ 0011 /* This file is part of the XRootD software suite. */ 0012 /* */ 0013 /* XRootD is free software: you can redistribute it and/or modify it under */ 0014 /* the terms of the GNU Lesser General Public License as published by the */ 0015 /* Free Software Foundation, either version 3 of the License, or (at your */ 0016 /* option) any later version. */ 0017 /* */ 0018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0020 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0021 /* License for more details. */ 0022 /* */ 0023 /* You should have received a copy of the GNU Lesser General Public License */ 0024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0025 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0026 /* */ 0027 /* The copyright holder's institutional names and contributor's names may not */ 0028 /* be used to endorse or promote products derived from this software without */ 0029 /* specific prior written permission of the institution or contributor. */ 0030 /******************************************************************************/ 0031 0032 #include <cstdint> 0033 #include <signal.h> 0034 #include <sys/types.h> 0035 // _POSIX_ASYNCHRONOUS_IO, if it is defined, is in unistd.h. 0036 #include <unistd.h> 0037 #ifdef _POSIX_ASYNCHRONOUS_IO 0038 #ifdef __APPLE__ 0039 #include <AvailabilityMacros.h> 0040 #include <sys/aio.h> 0041 #else 0042 #include <aio.h> 0043 #endif 0044 #else 0045 struct aiocb { // Minimal structure to avoid compiler errors 0046 int aio_fildes; 0047 void *aio_buf; 0048 size_t aio_nbytes; 0049 off_t aio_offset; 0050 int aio_reqprio; 0051 struct sigevent aio_sigevent; 0052 }; 0053 #endif 0054 0055 // The XrdSfsAIO class is meant to be derived. This object provides the 0056 // basic interface to handle AIO control block queues not processing. 0057 // 0058 class XrdSfsAio 0059 { 0060 public: 0061 0062 struct aiocb sfsAio; 0063 uint32_t *cksVec; // For pgRead and pgWrite 0064 0065 ssize_t Result; // If >= 0 valid result; else is -errno 0066 0067 const char *TIdent; // Trace information (optional) 0068 0069 // Method to handle completed reads 0070 // 0071 virtual void doneRead() = 0; 0072 0073 // Method to hand completed writes 0074 // 0075 virtual void doneWrite() = 0; 0076 0077 // Method to recycle free object 0078 // 0079 virtual void Recycle() = 0; 0080 0081 XrdSfsAio() { 0082 #if defined(__APPLE__) && (!defined(MAC_OS_X_VERSION_10_4) || \ 0083 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4) 0084 sfsAio.aio_sigevent.sigev_value.sigval_ptr = (void *)this; 0085 #else 0086 sfsAio.aio_sigevent.sigev_value.sival_ptr = (void *)this; 0087 #endif 0088 sfsAio.aio_sigevent.sigev_notify = SIGEV_SIGNAL; 0089 sfsAio.aio_reqprio = 0; 0090 cksVec = 0; 0091 TIdent = ""; 0092 } 0093 virtual ~XrdSfsAio() {} 0094 }; 0095 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|