apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr-util/include apr_buckets.h
Date Tue, 23 Jan 2001 07:28:44 GMT
rbb         01/01/22 23:28:44

  Modified:    buckets  apr_buckets_file.c
               include  apr_buckets.h
  Log:
  Implement native file splitting and copying.  This forced us to add
  refcounting to the file bucket, but we are able to split a file bucket
  without reading anything from it.
  
  Revision  Changes    Path
  1.23      +27 -7     apr-util/buckets/apr_buckets_file.c
  
  Index: apr_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -d -b -w -u -r1.22 -r1.23
  --- apr_buckets_file.c	2001/01/23 01:05:42	1.22
  +++ apr_buckets_file.c	2001/01/23 07:28:43	1.23
  @@ -89,8 +89,9 @@
   static apr_status_t file_read(apr_bucket *e, const char **str,
   			      apr_size_t *len, apr_read_type_e block)
   {
  -    apr_bucket_file *a = (apr_bucket_file *)e->data;
  -    apr_file_t *f = (apr_file_t *) a->fd;
  +    apr_bucket_shared *s = e->data;
  +    apr_bucket_file *a = s->data;
  +    apr_file_t *f = a->fd;
       apr_bucket *b = NULL;
       char *buf;
       apr_status_t rv;
  @@ -163,6 +164,22 @@
       return APR_SUCCESS;
   }
   
  +static apr_status_t file_split(apr_bucket *e, apr_off_t offset)
  +{
  +    apr_bucket *b;
  +    apr_bucket_shared *s;
  +    apr_bucket_file *f;
  +
  +    apr_bucket_split_shared(e, offset);
  +    b = APR_BUCKET_NEXT(e);
  +
  +    s = b->data;
  +    f = s->data;
  +    f->offset = offset;
  +
  +    return APR_SUCCESS;
  +}
  +
   APU_DECLARE(apr_bucket *) apr_bucket_make_file(apr_bucket *b, apr_file_t *fd,
                                               apr_off_t offset, apr_size_t len)
   {
  @@ -172,13 +189,16 @@
       if (f == NULL) {
           return NULL;
       }
  - 
       f->fd = fd;
       f->offset = offset;
   
  +    b = apr_bucket_make_shared(b, f, offset, offset + len);
  +    if (b == NULL) {
  +        free(f);
  +        return NULL;
  +    }
  +    
       b->type = &apr_bucket_type_file;
  -    b->data = f;
  -    b->length = len;
   
       return b;
   }
  @@ -194,6 +214,6 @@
       free,
       file_read,
       apr_bucket_setaside_notimpl,
  -    apr_bucket_split_notimpl,
  -    apr_bucket_copy_notimpl
  +    file_split,
  +    apr_bucket_copy_shared
   };
  
  
  
  1.66      +2 -0      apr-util/include/apr_buckets.h
  
  Index: apr_buckets.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -d -b -w -u -r1.65 -r1.66
  --- apr_buckets.h	2001/01/22 23:11:32	1.65
  +++ apr_buckets.h	2001/01/23 07:28:44	1.66
  @@ -555,6 +555,8 @@
    * A bucket referring to an file
    */
   struct apr_bucket_file {
  +    /** Number of buckets using this memory */
  +    apr_bucket_refcount  refcount;
       /** The file this bucket refers to */
       apr_file_t *fd;
       /** The offset into the file */
  
  
  

Mime
View raw message