]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
* oops - move the aiocb array to the queue, rather than the queue entry.
authoradrian <>
Sun, 12 Aug 2001 20:02:01 +0000 (20:02 +0000)
committeradrian <>
Sun, 12 Aug 2001 20:02:01 +0000 (20:02 +0000)
* Write some comments outlining what the code is going to ahve to do.

src/fs/coss/async_io.cc
src/fs/coss/async_io.h

index 53851f18456b3dafcb477b182e1d86acd6bff77b..3288d977ee5df60c0ea60d4fcf1d4d5495bd584d 100644 (file)
@@ -11,7 +11,7 @@
  * supports are read/write, and since COSS works on a single file
  * per storedir it should work just fine.
  *
- * $Id: async_io.cc,v 1.1 2001/08/12 10:20:41 adrian Exp $
+ * $Id: async_io.cc,v 1.2 2001/08/12 14:02:01 adrian Exp $
  */
 
 #include "squid.h"
  * with the dequeueing)
  */
 
+
+/* Internal routines */
+
+/*
+ * find a free aio slot.
+ * Return the index, or -1 if we can't find one.
+ */
+static int
+a_file_findslot(async_queue_t *q)
+{
+       int i;
+
+       /* Later we should use something a little more .. efficient :) */
+       for (i = 0; i < MAX_ASYNCOP; i++) {
+               if (q->aq_queue[i].aq_e_state == AQ_ENTRY_FREE)
+                       /* Found! */
+                       return i;
+       }
+       /* found nothing */
+       return -1;
+}
+
+
+
+
+/* Exported routines */
+
 void
 a_file_read(async_queue_t *q, int fd, void *buf, int req_len, off_t offset,
   DRCB *callback, void *data)
 {
        assert(q->aq_state == AQ_STATE_SETUP);
 
+#if 0
        file_read(fd, buf, req_len, offset, callback, data);
+#endif
+       /* Find a free slot */
+               /* No free slot? Callback error, and return */
+
+       /* Mark slot as ours */
+       /* Initiate aio */
 }
 
 
@@ -42,15 +76,36 @@ a_file_write(async_queue_t *q, int fd, off_t offset, void *buf, int len,
 {
        assert(q->aq_state == AQ_STATE_SETUP);
 
+#if 0
        file_write(fd, offset, buf, len, callback, data, freefunc);
+#endif
+       /* Find a free slot */
+               /* No free slot? Callback error, and return */
+       /* Mark slot as ours */
+       /* Initiate aio */
 }
 
 
+/*
+ * Note: we grab the state and free the state before calling the callback
+ * because this allows us to cut down the amount of time it'll take
+ * to find a free slot (since if we call the callback first, we're going
+ * to probably be allocated the slot _after_ this one..)
+ *
+ * I'll make it much more optimal later.
+ */
 int
 a_file_callback(async_queue_t *q)
 {
        assert(q->aq_state == AQ_STATE_SETUP);
 
+       /* Loop through all slots */
+               /* Active, get status */
+                       /* Ready? Grab the state locally */
+                       /* Free the state */
+                       /* Call callback */
+
+
        return 0;
 }
 
@@ -76,6 +131,7 @@ a_file_syncqueue(async_queue_t *q)
 {
        assert(q->aq_state == AQ_STATE_SETUP);
 
+       /* Good point? :-) */
 }
 
 
index 8202545ce525271bc528de2cded05399a09b11fd..348a5a58f290457fdfab0d4a5c884de38f75864e 100644 (file)
@@ -20,7 +20,7 @@ typedef struct _async_queue async_queue_t;
 /* An async queue entry */
 struct _async_queue_entry {
        async_queue_entry_state_t aq_e_state;
-       struct aiocb aq_e_queue[MAX_ASYNCOP];
+       struct aiocb aq_e_aiocb;
        union {
                DRCB *read;
                DWCB *write;
@@ -31,7 +31,7 @@ struct _async_queue_entry {
 /* An async queue */
 struct _async_queue {
        async_queue_state_t aq_state;
-       async_queue_entry_t aq_queue;           /* queued operations */
+       async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */
        int aq_numpending;                      /* Num of pending ops */
 };