XrdPssAio.cc

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /*                          X r d P s s A i o . c c                           */
00004 /*                                                                            */
00005 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University  */
00006 /*                            All Rights Reserved                             */
00007 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00008 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00009 /******************************************************************************/
00010 
00011 #include <stdio.h>
00012 #include <unistd.h>
00013 
00014 #include "XrdPss/XrdPss.hh"
00015 #include "XrdSfs/XrdSfsAio.hh"
00016 
00017 // All AIO interfaces are defined here.
00018  
00019 
00020 // Currently we disable aio support for proxies because the client does not
00021 // support async reads and writes. It should to make proxy I/O more scalable.
00022 
00023 /******************************************************************************/
00024 /*                                 F s y n c                                  */
00025 /******************************************************************************/
00026   
00027 /*
00028   Function: Async fsync() a file
00029 
00030   Input:    aiop      - A aio request object
00031 */
00032 
00033 int XrdPssFile::Fsync(XrdSfsAio *aiop)
00034 {
00035 
00036 // Execute this request in a synchronous fashion
00037 //
00038    if ((aiop->Result = Fsync())) aiop->Result = -errno;
00039 
00040 // Simply call the write completion routine and return as if all went well
00041 //
00042    aiop->doneWrite();
00043    return 0;
00044 }
00045 
00046 /******************************************************************************/
00047 /*                                  R e a d                                   */
00048 /******************************************************************************/
00049 
00050 /*
00051   Function: Async read `blen' bytes from the associated file, placing in 'buff'
00052 
00053   Input:    aiop      - An aio request object
00054 
00055    Output:  <0 -> Operation failed, value is negative errno value.
00056             =0 -> Operation queued
00057             >0 -> Operation not queued, system resources unavailable or
00058                                         asynchronous I/O is not supported.
00059 */
00060   
00061 int XrdPssFile::Read(XrdSfsAio *aiop)
00062 {
00063 
00064 // Execute this request in a synchronous fashion
00065 //
00066    aiop->Result = this->Read((void *)aiop->sfsAio.aio_buf,
00067                               (off_t)aiop->sfsAio.aio_offset,
00068                              (size_t)aiop->sfsAio.aio_nbytes);
00069 
00070 // Simple call the read completion routine and return as if all went well
00071 //
00072    aiop->doneRead();
00073    return 0;
00074 }
00075 
00076 /******************************************************************************/
00077 /*                                 W r i t e                                  */
00078 /******************************************************************************/
00079   
00080 /*
00081   Function: Async write `blen' bytes from 'buff' into the associated file
00082 
00083   Input:    aiop      - An aio request object.
00084 
00085    Output:  <0 -> Operation failed, value is negative errno value.
00086             =0 -> Operation queued
00087             >0 -> Operation not queued, system resources unavailable or
00088                                         asynchronous I/O is not supported.
00089 */
00090   
00091 int XrdPssFile::Write(XrdSfsAio *aiop)
00092 {
00093 
00094 // Execute this request in a synchronous fashion
00095 //
00096    aiop->Result = this->Write((const void *)aiop->sfsAio.aio_buf,
00097                                      (off_t)aiop->sfsAio.aio_offset,
00098                                     (size_t)aiop->sfsAio.aio_nbytes);
00099 
00100 // Simply call the write completion routine and return as if all went well
00101 //
00102    aiop->doneWrite();
00103    return 0;
00104 }

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