httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/buckets ap_buf.c ap_eos_buf.c ap_mmap_buf.c ap_rmem_buf.c ap_rwmem_buf.c apr_buf.h
Date Sun, 23 Jul 2000 05:43:36 GMT
rbb         00/07/22 22:43:36

  Modified:    src/lib/apr/buckets ap_buf.c ap_eos_buf.c ap_mmap_buf.c
                        ap_rmem_buf.c ap_rwmem_buf.c apr_buf.h
  Log:
  Change some function pointer names to reflect what they do better.
  And, add some docs about what the bucket brigades do and how they are
  used.
  
  Revision  Changes    Path
  1.17      +4 -4      apache-2.0/src/lib/apr/buckets/ap_buf.c
  
  Index: ap_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ap_buf.c	2000/07/21 22:24:28	1.16
  +++ ap_buf.c	2000/07/23 05:43:35	1.17
  @@ -206,7 +206,7 @@
   APR_EXPORT(const char *) ap_get_bucket_char_str(ap_bucket *b)
   {
       if (b) {
  -        return b->getstr(b);
  +        return b->read(b);
       }
       return NULL;
   }    
  @@ -241,7 +241,7 @@
                   break;
               j = strlen(x);
              
  -            rv = rw->insert(rw, x, j, &i);
  +            rv = rw->write(rw, x, j, &i);
               if (i != j) {
                   /* Do we need better error reporting?  */
                   return -1;
  @@ -259,7 +259,7 @@
           j = strlen(x);
          
           r = ap_bucket_rwmem_create();
  -        rv = r->insert(r, x, j, &i);
  +        rv = r->write(r, x, j, &i);
           if (i != j) {
               /* Do we need better error reporting?  */
               return -1;
  @@ -295,7 +295,7 @@
       res = ap_vsnprintf(buf, 4096, fmt, va);
   
       r = ap_bucket_rwmem_create();
  -    res = r->insert(r, buf, strlen(buf), &i);
  +    res = r->write(r, buf, strlen(buf), &i);
       ap_bucket_brigade_append_buckets(b, r);
   
       return res;
  
  
  
  1.5       +2 -2      apache-2.0/src/lib/apr/buckets/ap_eos_buf.c
  
  Index: ap_eos_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_eos_buf.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ap_eos_buf.c	2000/07/20 16:14:24	1.4
  +++ ap_eos_buf.c	2000/07/23 05:43:35	1.5
  @@ -76,9 +76,9 @@
       newbuf            = calloc(1, sizeof(*newbuf));
   
       newbuf->color     = AP_BUCKET_eos;
  -    newbuf->getstr    = eos_get_str;
  +    newbuf->read      = eos_get_str;
       newbuf->getlen    = eos_get_len;
  -    newbuf->insert    = NULL;
  +    newbuf->write     = NULL;
       newbuf->split     = NULL;
       newbuf->free      = NULL;
       newbuf->data      = NULL;
  
  
  
  1.9       +2 -2      apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c
  
  Index: ap_mmap_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_mmap_buf.c	2000/07/21 22:25:25	1.8
  +++ ap_mmap_buf.c	2000/07/23 05:43:35	1.9
  @@ -115,9 +115,9 @@
       b->len            = 0;
   
       newbuf->color     = AP_BUCKET_mmap;
  -    newbuf->getstr    = mmap_get_str;
  +    newbuf->read      = mmap_get_str;
       newbuf->getlen    = mmap_get_len;
  -    newbuf->insert    = mmap_bucket_insert;
  +    newbuf->write     = mmap_bucket_insert;
       newbuf->split     = mmap_split;
       newbuf->free      = NULL;
       newbuf->data      = b;
  
  
  
  1.9       +2 -2      apache-2.0/src/lib/apr/buckets/ap_rmem_buf.c
  
  Index: ap_rmem_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rmem_buf.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_rmem_buf.c	2000/07/20 16:14:24	1.8
  +++ ap_rmem_buf.c	2000/07/23 05:43:35	1.9
  @@ -136,9 +136,9 @@
       b->start = b->end     = NULL;
   
       newbuf->color         = AP_BUCKET_rmem;
  -    newbuf->getstr        = rmem_get_str;
  +    newbuf->read          = rmem_get_str;
       newbuf->getlen        = rmem_get_len;
  -    newbuf->insert        = rmem_insert;
  +    newbuf->write         = rmem_insert;
       newbuf->split         = rmem_split;
       newbuf->free          = NULL;
       newbuf->data          = b;
  
  
  
  1.9       +2 -2      apache-2.0/src/lib/apr/buckets/ap_rwmem_buf.c
  
  Index: ap_rwmem_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rwmem_buf.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ap_rwmem_buf.c	2000/07/20 16:14:24	1.8
  +++ ap_rwmem_buf.c	2000/07/23 05:43:35	1.9
  @@ -155,9 +155,9 @@
       b->end        = b->alloc_addr;
   
       newbuf->color      = AP_BUCKET_rwmem;
  -    newbuf->getstr     = rwmem_get_str;
  +    newbuf->read       = rwmem_get_str;
       newbuf->getlen     = rwmem_get_len;
  -    newbuf->insert     = rwmem_insert;
  +    newbuf->write      = rwmem_insert;
       newbuf->split      = rwmem_split;
       newbuf->free       = rwmem_destroy;
       newbuf->data       = b;
  
  
  
  1.17      +56 -4     apache-2.0/src/lib/apr/buckets/apr_buf.h
  
  Index: apr_buf.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/apr_buf.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- apr_buf.h	2000/07/20 16:14:24	1.16
  +++ apr_buf.h	2000/07/23 05:43:35	1.17
  @@ -66,6 +66,49 @@
   #include <stdarg.h>
   #endif
   
  +
  +/* The basic concept behind bucket_brigades.....
  + *
  + * A bucket brigade is simply a Queue of buckets, where we aren't limited
  + * to inserting at the front and removing at the end.
  + *
  + * Buckets are just data stores.  They can be files, mmap areas, or just
  + * pre-allocated memory.  The point of buckets is to store data.  Along with
  + * that data, come some functions to access it.  The functions are relatively
  + * simple, read, write, getlen, split, and free.
  + *
  + * read reads a string of data.  Currently, it assumes we read all of the 
  + * data in the bucket.  This should be changed to only read the specified 
  + * amount.
  + *
  + * getlen gets the number of bytes stored in the bucket.
  + * 
  + * write writes the specified data to the bucket.  Depending on the type of
  + * bucket, this may append to the end of previous data, or wipe out the data
  + * currently in the bucket.  rwmem buckets append currently, all others 
  + * erase the current bucket.
  + *
  + * split just makes one bucket into two at the spefied location.  To implement
  + * this correctly, we really need to implement reference counting.
  + *
  + * free just destroys the data associated with the bucket.
  + *
  + * We may add more functions later.  There has been talk of needing a stat,
  + * which would probably replace the getlen.  And, we definately need a convert
  + * function.  Convert would make one bucket type into another bucket type.
  + *
  + * To write a bucket brigade, they are first made into an iovec, so that we
  + * don't write too little data at one time.  Currently we ignore compacting the
  + * buckets into as few buckets as possible, but if we really want to be
  + * performant, then we need to compact the buckets before we convert to an
  + * iovec, or possibly while we are converting to an iovec.
  + *
  + * I'm not really sure what else to say about the buckets.  They are relatively
  + * simple and straight forward IMO.  It is just a way to organize data in
  + * memory that allows us to modify that data and move it around quickly and
  + * easily.
  + */
  +
   typedef enum {
       AP_BUCKET_rwmem,
       AP_BUCKET_rmem,
  @@ -82,11 +125,16 @@
   typedef struct ap_bucket ap_bucket;
   struct ap_bucket {
       ap_bucket_color_e color;              /* what type of bucket is it */
  -    void (*free)(void *e);                /* can be NULL */
       void *data;				  /* for use by free() */
  -    const char *(*getstr)(ap_bucket *e);  /* Get the string */
  +
  +    /* All of the function pointers that can act on a bucket. */
  +    void (*free)(void *e);                /* can be NULL */
       int (*getlen)(ap_bucket *e);          /* Get the length of the string */
  -    /* Insert into a bucket.  The buf is a different type based on the
  +
  +    /* Read the data from the bucket. */
  +    const char *(*read)(ap_bucket *e);  /* Get the string */
  +
  +    /* Write into a bucket.  The buf is a different type based on the
        * bucket type used.  For example, with AP_BUCKET_mmap it is an ap_mmap_t
        * for AP_BUCKET_file it is an ap_file_t, and for AP_BUCKET_rwmem it is
        * a char *.  The nbytes is the amount of actual data in buf.  This is
  @@ -94,7 +142,9 @@
        * that buf resolves to.  written is how much of that data was inserted
        * into the bucket.
        */ 
  -    int (*insert)(ap_bucket *e, const void *buf, ap_size_t nbytes, ap_ssize_t *w);
  +    int (*write)(ap_bucket *e, const void *buf, ap_size_t nbytes, ap_ssize_t *w);
  +   
  +    /* Split one bucket into to at the specified position */
       ap_status_t (*split)(ap_bucket *e, ap_size_t nbytes);
   
       ap_bucket *next;                     /* The next node in the bucket list */
  @@ -195,6 +245,8 @@
   
   /* get the length of the data in the bucket */
   APR_EXPORT(int) ap_get_bucket_len(ap_bucket *b);
  +
  +/****** Functions to Create Buckets of varying type ******/
   
   /* Create a read/write memory bucket */
   APR_EXPORT(ap_bucket *) ap_bucket_rwmem_create(void);
  
  
  

Mime
View raw message