[rhmessaging-commits] rhmessaging commits: r3082 - store/trunk/cpp/lib/jrnl.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Jan 30 06:58:30 EST 2009


Author: kpvdr
Date: 2009-01-30 06:58:30 -0500 (Fri, 30 Jan 2009)
New Revision: 3082

Modified:
   store/trunk/cpp/lib/jrnl/aio.cpp
   store/trunk/cpp/lib/jrnl/aio.hpp
Log:
Additional comments for class aio

Modified: store/trunk/cpp/lib/jrnl/aio.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/aio.cpp	2009-01-29 21:06:00 UTC (rev 3081)
+++ store/trunk/cpp/lib/jrnl/aio.cpp	2009-01-30 11:58:30 UTC (rev 3082)
@@ -1,41 +1,39 @@
 /**
-* \file aio.cpp
-*
-* Red Hat Messaging - Message Journal
-*
-* File containing code for class mrg::journal::aio (libaio interface
-* encapsulation). See comments in file aio.hpp for details.
-*
-* Copyright (C) 2007, 2008 Red Hat Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
+ * \file aio.cpp
+ *
+ * Red Hat Messaging - Message Journal
+ *
+ * File containing code for class mrg::journal::aio (libaio interface
+ * encapsulation). See comments in file aio.hpp for details.
+ *
+ * Copyright (C) 2007, 2008 Red Hat Inc.
+ *
+ * This file is part of Red Hat Messaging.
+ *
+ * Red Hat Messaging is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
 
 #include "aio.hpp"
 
-
 namespace mrg
 {
 namespace journal
 {
 
-
 } // namespace journal
 } // namespace mrg

Modified: store/trunk/cpp/lib/jrnl/aio.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/aio.hpp	2009-01-29 21:06:00 UTC (rev 3081)
+++ store/trunk/cpp/lib/jrnl/aio.hpp	2009-01-30 11:58:30 UTC (rev 3082)
@@ -1,32 +1,32 @@
 /**
-* \file aio.hpp
-*
-* Red Hat Messaging - Message Journal
-*
-* This file contains an encapsulation of the libaio interface used
-* by the journal.
-*
-* Copyright 2007, 2008 Red Hat, Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
+ * \file aio.hpp
+ *
+ * Red Hat Messaging - Message Journal
+ *
+ * This file contains an encapsulation of the libaio interface used
+ * by the journal.
+ *
+ * Copyright 2007, 2008 Red Hat, Inc.
+ *
+ * This file is part of Red Hat Messaging.
+ *
+ * Red Hat Messaging is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
 
 #ifndef mrg_journal_aio_hpp
 #define mrg_journal_aio_hpp
@@ -44,6 +44,10 @@
 typedef iocb aio_cb;
 typedef io_event aio_event;
 
+/**
+ * \brief This class is a C++ wrapper class for the libaio functions used by the journal. Note that only those
+ * functions used by the journal are included here. This is not a complete implementation of all libaio functions.
+ */
 class aio
 {
 public:
@@ -62,24 +66,39 @@
         return ::io_submit(ctx, nr, aios);
     }
 
-    static inline int getevents(io_context_t ctx, long min_nr, long nr, aio_event* events,
-            timespec* timeout)
+    static inline int getevents(io_context_t ctx, long min_nr, long nr, aio_event* events, timespec* timeout)
     {
         return ::io_getevents(ctx, min_nr, nr, events, timeout);
     }
 
-    static inline void prep_pread(aio_cb* aiocbp, int fd, void* buf, std::size_t count,
-            int64_t offset)
+    /**
+     * \brief This function allows iocbs to be initialized with a pointer that can be re-used. This prepares an
+     * aio_cb struct for read use. (This is a wrapper for libaio's ::io_prep_pread() function.)
+     *
+     * \param aiocbp Pointer to the aio_cb struct to be prepared.
+     * \param fd File descriptor to be used for read.
+     * \param buf Pointer to buffer in which read data is to be placed.
+     * \param count Number of bytes to read - buffer must be large enough.
+     * \param offset Offset within file from which data will be read.
+     */
+    static inline void prep_pread(aio_cb* aiocbp, int fd, void* buf, std::size_t count, int64_t offset)
     {
         ::io_prep_pread(aiocbp, fd, buf, count, offset);
     }
 
-    // Special version of libaio's io_prep_pread() which preserves the value of the data
-    // pointer. This allows iocbs to be initialized with a pointer that can be re-used.
-    static inline void prep_pread_2(aio_cb* aiocbp, int fd, void* buf, std::size_t count,
-            int64_t offset)
+    /**
+     * \brief Special version of libaio's io_prep_pread() which preserves the value of the data pointer. This allows
+     * iocbs to be initialized with a pointer that can be re-used. This prepares a aio_cb struct for read use.
+     *
+     * \param aiocbp Pointer to the aio_cb struct to be prepared.
+     * \param fd File descriptor to be used for read.
+     * \param buf Pointer to buffer in which read data is to be placed.
+     * \param count Number of bytes to read - buffer must be large enough.
+     * \param offset Offset within file from which data will be read.
+     */
+    static inline void prep_pread_2(aio_cb* aiocbp, int fd, void* buf, std::size_t count, int64_t offset)
     {
-        std::memset((void*)((char*)aiocbp + sizeof(void*)), 0, sizeof(aio_cb) - sizeof(void*));
+        std::memset((void*) ((char*) aiocbp + sizeof(void*)), 0, sizeof(aio_cb) - sizeof(void*));
         aiocbp->aio_fildes = fd;
         aiocbp->aio_lio_opcode = IO_CMD_PREAD;
         aiocbp->aio_reqprio = 0;
@@ -88,18 +107,35 @@
         aiocbp->u.c.offset = offset;
     }
 
-    static inline void prep_pwrite(aio_cb* aiocbp, int fd, void* buf, std::size_t count,
-            int64_t offset)
+    /**
+     * \brief This function allows iocbs to be initialized with a pointer that can be re-used. This function prepares
+     * an aio_cb struct for write use. (This is a wrapper for libaio's ::io_prep_pwrite() function.)
+     *
+     * \param aiocbp Pointer to the aio_cb struct to be prepared.
+     * \param fd File descriptor to be used for write.
+     * \param buf Pointer to buffer in which data to be written is located.
+     * \param count Number of bytes to write.
+     * \param offset Offset within file to which data will be written.
+     */
+    static inline void prep_pwrite(aio_cb* aiocbp, int fd, void* buf, std::size_t count, int64_t offset)
     {
         ::io_prep_pwrite(aiocbp, fd, buf, count, offset);
     }
 
-    // Special version of libaio's io_prep_pwrite() which preserves the value of the data
-    // pointer. This allows iocbs to be initialized with a pointer that can be re-used.
-    static inline void prep_pwrite_2(aio_cb* aiocbp, int fd, void* buf, std::size_t count,
-            int64_t offset)
+    /**
+     * \brief Special version of libaio's io_prep_pwrite() which preserves the value of the data pointer. This allows
+     * iocbs to be initialized with a pointer that can be re-used. This function prepares an aio_cb struct for write
+     * use.
+     *
+     * \param aiocbp Pointer to the aio_cb struct to be prepared.
+     * \param fd File descriptor to be used for write.
+     * \param buf Pointer to buffer in which data to be written is located.
+     * \param count Number of bytes to write.
+     * \param offset Offset within file to which data will be written.
+     */
+    static inline void prep_pwrite_2(aio_cb* aiocbp, int fd, void* buf, std::size_t count, int64_t offset)
     {
-        std::memset((void*)((char*)aiocbp + sizeof(void*)), 0, sizeof(aio_cb) - sizeof(void*));
+        std::memset((void*) ((char*) aiocbp + sizeof(void*)), 0, sizeof(aio_cb) - sizeof(void*));
         aiocbp->aio_fildes = fd;
         aiocbp->aio_lio_opcode = IO_CMD_PWRITE;
         aiocbp->aio_reqprio = 0;




More information about the rhmessaging-commits mailing list