]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DiskIO/AIO/AIODiskIOStrategy.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / AIO / AIODiskIOStrategy.cc
index 291d2f07baed75acacc249a3c6b27d4b59ba43d4..21c4685c22afcce320b22b231bf968714f3442af 100644 (file)
@@ -1,7 +1,5 @@
 
 /*
- * $Id$
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
  */
 
 #include "squid.h"
-#include "AIODiskIOStrategy.h"
 #include "AIODiskFile.h"
+#include "AIODiskIOStrategy.h"
 #include "DiskIO/IORequestor.h"
 #include "DiskIO/ReadRequest.h"
 #include "DiskIO/WriteRequest.h"
 
-AIODiskIOStrategy::AIODiskIOStrategy()
+AIODiskIOStrategy::AIODiskIOStrategy() :
+        fd(-1)
 {
+    aq.aq_state = AQ_STATE_NONE;
     aq.aq_numpending = 0;
+    memset(&aq.aq_queue, 0, sizeof(aq.aq_queue));
 }
 
 AIODiskIOStrategy::~AIODiskIOStrategy()
@@ -100,6 +101,12 @@ AIODiskIOStrategy::sync()
         callback();
 }
 
+bool
+AIODiskIOStrategy::unlinkdUseful() const
+{
+    return false;
+}
+
 void
 AIODiskIOStrategy::unlinkFile (char const *)
 {}
@@ -123,7 +130,6 @@ AIODiskIOStrategy::callback()
     void *cbdata;
     int callback_valid;
     void *buf;
-    int fd;
     async_queue_entry_t *aqe;
     async_queue_entry_type_t type;
 
@@ -131,7 +137,7 @@ AIODiskIOStrategy::callback()
 
     /* Loop through all slots */
 
-    for (i = 0; i < MAX_ASYNCOP; i++) {
+    for (i = 0; i < MAX_ASYNCOP; ++i) {
         if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_USED) {
             aqe = &aq.aq_queue[i];
             /* Active, get status */
@@ -148,7 +154,6 @@ AIODiskIOStrategy::callback()
                 /* Get the callback parameters */
                 freefunc = aqe->aq_e_free;
                 buf = aqe->aq_e_buf;
-                fd = aqe->aq_e_fd;
                 type = aqe->aq_e_type;
                 callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata);
                 AIODiskFile * theFile = NULL;
@@ -219,7 +224,7 @@ AIODiskIOStrategy::findSlot()
 {
     /* Later we should use something a little more .. efficient :) */
 
-    for (int i = 0; i < MAX_ASYNCOP; i++) {
+    for (int i = 0; i < MAX_ASYNCOP; ++i) {
         if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_FREE)
             /* Found! */
             return i;