httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/apr/file_io/unix dir.c fileacc.c filedup.c fileio.h filestat.c open.c pipe.c readwrite.c seek.c
Date Wed, 12 May 1999 18:03:54 GMT
rbb         99/05/12 11:03:51

  Modified:    include  apr_file_io.h
               docs     fileio.txt
               apr/file_io/unix dir.c fileacc.c filedup.c fileio.h
                        filestat.c open.c pipe.c readwrite.c seek.c
  Log:
  Makes the file I/O code MUCH more portable, because programmers now only have
  to include apr_file_io.h, and apr takes care of the rest.  I will be doing this
  for the rest of the apr functions today.  This also begins to implement the
  new directory functions.  I have ignored the stuff to get the time and the
  filename, but it was just easier to change the other stuff while I was there.
  
  Revision  Changes    Path
  1.24      +5 -7      apache-apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- apr_file_io.h	1999/05/12 12:31:16	1.23
  +++ apr_file_io.h	1999/05/12 18:02:51	1.24
  @@ -56,7 +56,6 @@
   #ifndef APR_FILE_IO_H
   #define APR_FILE_IO_H
   
  -#include "fileio.h"
   #include "apr_general.h"
   #include "apr_errno.h"
   
  @@ -96,11 +95,10 @@
   /* should be same as whence type in lseek, POSIZ defines this as int */
   typedef ap_int32_t       ap_seek_where_t;
   
  -typedef struct file_t     ap_file_t;
  -typedef struct dir_t      ap_dir_t;
  -typedef fileperms_t       ap_fileperms_t;
  -typedef dirent_t          ap_dirent_t;
  -typedef iovec_t           ap_iovec_t;
  +typedef struct file_t            ap_file_t;
  +typedef struct dir_t             ap_dir_t;
  +typedef iovec_t                  ap_iovec_t;
  +typedef fileperms_t              ap_fileperms_t;
   
   /*   Function definitions */
   ap_file_t *ap_open(ap_context_t *, char *, ap_int32_t, ap_fileperms_t);
  @@ -118,7 +116,7 @@
   
   ap_dir_t *ap_opendir(ap_context_t *, const char *);
   ap_status_t ap_closedir(ap_context_t *, ap_dir_t *);
  -ap_dirent_t *ap_readdir(ap_context_t *, ap_dir_t *);
  +ap_status_t ap_readdir(ap_context_t *, ap_dir_t *);
   ap_status_t ap_rewinddir(ap_context_t *, ap_dir_t *);
   ap_status_t ap_make_dir(ap_context_t *, const char *, ap_fileperms_t);
   ap_status_t ap_remove_dir(ap_context_t *, const char *);
  
  
  
  1.21      +2 -2      apache-apr/docs/fileio.txt
  
  Index: fileio.txt
  ===================================================================
  RCS file: /home/cvs/apache-apr/docs/fileio.txt,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- fileio.txt	1999/05/10 14:36:17	1.20
  +++ fileio.txt	1999/05/12 18:03:01	1.21
  @@ -128,12 +128,12 @@
   	arg 2)  abstracted directory descriptor structure to be closed.
           return) APR_SUCCESS or APR_FAILURE
   
  - ap_dirent_t *ap_readdir(ap_context_t *, ap_dir_t *)
  + ap_status_t *ap_readdir(ap_context_t *, ap_dir_t *)
   	Retrieve the next directory entry from the specified directory.
        Arguments:
           arg 1)  The context to use.
   	arg 2)  Abstracted directory descriptor to read from.
  -	return) the next directory entry.
  +	return) APR_SUCCESS or APR_FAILURE.
   
    ap_status_t *ap_rewinddir(ap_context_t *, ap_dir_t *)
           Rewind directory to beginning of stream
  
  
  
  1.4       +15 -9     apache-apr/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/dir.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- dir.c	1999/05/10 14:36:24	1.3
  +++ dir.c	1999/05/12 18:03:08	1.4
  @@ -53,12 +53,13 @@
    *
    */
   
  -#include "apr_file_io.h"
   #include <errno.h>
   #include <string.h>
   #include <dirent.h>
  +#include "fileio.h"
  +#include "apr_file_io.h"
   
  -ap_status_t dir_cleanup(ap_dir_t *thedir)
  +ap_status_t dir_cleanup(struct dir_t *thedir)
   {
       if (closedir(thedir->dirstruct) == 0) {
           return APR_SUCCESS;
  @@ -68,9 +69,9 @@
       }
   } 
   
  -ap_dir_t *ap_opendir(ap_context_t *cont, const char *dirname)
  +struct dir_t *ap_opendir(ap_context_t *cont, const char *dirname)
   {
  -    ap_dir_t *thedir = (ap_dir_t *)ap_palloc(cont->pool, sizeof(ap_dir_t));
  +    struct dir_t *thedir = (struct dir_t *)ap_palloc(cont->pool, sizeof(struct dir_t));
   
       thedir->dirname = strdup(dirname);
       thedir->dirstruct = opendir(dirname);
  @@ -81,11 +82,12 @@
       }    
       else {
           ap_register_cleanup(cont->pool, (void *)thedir, dir_cleanup, NULL);
  +        thedir->entry = NULL;
           return thedir;
       }
   }
   
  -ap_status_t ap_closedir(ap_context_t *cont, ap_dir_t *thedir)
  +ap_status_t ap_closedir(ap_context_t *cont, struct dir_t *thedir)
   {
       if (dir_cleanup(thedir) == APR_SUCCESS) {
           ap_kill_cleanup(cont->pool, thedir, dir_cleanup);
  @@ -94,18 +96,22 @@
       return APR_FAILURE;
   }
   
  -ap_dirent_t *ap_readdir(ap_context_t *cont, ap_dir_t *thedir)
  +ap_status_t ap_readdir(ap_context_t *cont, struct dir_t *thedir)
   {
  -    return readdir(thedir->dirstruct);
  +    thedir->entry = readdir(thedir->dirstruct);
  +    if (thedir->entry == NULL) {
  +        return APR_FAILURE;
  +    }    
  +    return APR_SUCCESS;
   }
   
  -ap_status_t ap_rewinddir(ap_context_t *cont, ap_dir_t *thedir)
  +ap_status_t ap_rewinddir(ap_context_t *cont, struct dir_t *thedir)
   {
       rewinddir(thedir->dirstruct);
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t mode)
  +ap_status_t ap_make_dir(ap_context_t *cont, const char *path, fileperms_t mode)
   {
       if (mkdir(path, mode) == 0) {
           return APR_SUCCESS;
  
  
  
  1.5       +3 -2      apache-apr/apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/fileacc.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- fileacc.c	1999/05/10 14:36:24	1.4
  +++ fileacc.c	1999/05/12 18:03:11	1.5
  @@ -53,14 +53,15 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include <errno.h>
   #include <string.h>
   
  -/* A file to put ALL of the accessor functions for ap_file_t types. */
  +/* A file to put ALL of the accessor functions for struct file_t types. */
   
  -char * ap_get_filename(ap_context_t *cont, ap_file_t *thefile)
  +char * ap_get_filename(ap_context_t *cont, struct file_t *thefile)
   {
       if (thefile != NULL) {
           return thefile->fname;
  
  
  
  1.8       +5 -4      apache-apr/apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/filedup.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- filedup.c	1999/05/10 14:36:24	1.7
  +++ filedup.c	1999/05/12 18:03:12	1.8
  @@ -52,14 +52,15 @@
    * project, please see <http://www.apache.org/>.
    *
    */
  -#include <strings.h>
  +
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
  -#include "fileio.h"
  +#include <strings.h>
   
  -ap_file_t *ap_dupfile(ap_context_t *cont, ap_file_t *old_file)
  +struct file_t *ap_dupfile(ap_context_t *cont, struct file_t *old_file)
   {
  -    ap_file_t *new_file = (ap_file_t *)ap_palloc(cont->pool, sizeof(ap_file_t));
  +    struct file_t *new_file = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
       
       if (new_file == NULL) {
           errno = ENOMEM;
  
  
  
  1.5       +2 -2      apache-apr/apr/file_io/unix/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/fileio.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- fileio.h	1999/05/10 14:36:24	1.4
  +++ fileio.h	1999/05/12 18:03:14	1.5
  @@ -93,10 +93,10 @@
   struct dir_t {
       char *dirname;
       DIR *dirstruct;
  +    struct dirent *entry;
   };
   
  -typedef mode_t            fileperms_t;
  -typedef struct dirent     dirent_t;
  +typedef mode_t            fileperms_t; 
   typedef struct iovec      iovec_t;
   
   ap_status_t file_cleanup(void *);
  
  
  
  1.4       +3 -2      apache-apr/apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/filestat.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- filestat.c	1999/05/10 14:36:25	1.3
  +++ filestat.c	1999/05/12 18:03:17	1.4
  @@ -53,11 +53,12 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_errno.h"
   
  -ap_status_t ap_getfileinfo(ap_context_t *cont, char * fname, ap_file_t *thefile)
  +ap_status_t ap_getfileinfo(ap_context_t *cont, char * fname, struct file_t *thefile)
   {
       struct stat info;
       int rv = stat(fname, &info);
  @@ -78,7 +79,7 @@
       }
   }
   
  -ap_status_t ap_updatefileinfo(ap_context_t *cont, ap_file_t *thefile)
  +ap_status_t ap_updatefileinfo(ap_context_t *cont, struct file_t *thefile)
   {
       struct stat info;
       int rv = fstat(thefile->filedes, &info);
  
  
  
  1.18      +6 -5      apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- open.c	1999/05/10 14:36:25	1.17
  +++ open.c	1999/05/12 18:03:19	1.18
  @@ -53,6 +53,7 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_lib.h"
  @@ -61,7 +62,7 @@
   
   ap_status_t file_cleanup(void *thefile)
   {
  -    ap_file_t *file = thefile;
  +    struct file_t *file = thefile;
       if (close(file->filedes) == 0) {
           file->filedes = -1;
           return APR_SUCCESS;
  @@ -72,13 +73,13 @@
       }
   }
   
  -ap_file_t *ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  ap_fileperms_t mode)
  +struct file_t *ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  fileperms_t mode)
   {
       int oflags = 0;
  -    ap_file_t *dafile;
  +    struct file_t *dafile;
       struct stat info;
       
  -    dafile = (ap_file_t *)ap_palloc(cont->pool, sizeof(ap_file_t));
  +    dafile = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
   
       if ((flag & APR_READ) && (flag & APR_WRITE)) {
           oflags = O_RDWR;
  @@ -138,7 +139,7 @@
       }
   }
   
  -ap_status_t ap_close(ap_context_t *cont, ap_file_t *file)
  +ap_status_t ap_close(ap_context_t *cont, struct file_t *file)
   {
       if (file_cleanup(file) == APR_SUCCESS) {
           ap_kill_cleanup(cont->pool, file, file_cleanup);
  
  
  
  1.4       +3 -2      apache-apr/apr/file_io/unix/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/pipe.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pipe.c	1999/05/10 14:36:25	1.3
  +++ pipe.c	1999/05/12 18:03:21	1.4
  @@ -53,6 +53,7 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include <errno.h>
  @@ -61,7 +62,7 @@
   #include <sys/types.h>
   #include <sys/stat.h>
   
  -ap_status_t ap_create_pipe(ap_context_t *cont, ap_file_t *in, ap_file_t *out)
  +ap_status_t ap_create_pipe(ap_context_t *cont, struct file_t *in, struct file_t *out)
   {
       int filedes[2];
   
  @@ -78,7 +79,7 @@
       return APR_SUCCESS;
   }
   
  -char *ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t mode)
  +char *ap_create_namedpipe(ap_context_t *cont, char *dirpath, fileperms_t mode)
   {
       char *tmp;
   
  
  
  
  1.7       +5 -3      apache-apr/apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- readwrite.c	1999/05/10 14:36:25	1.6
  +++ readwrite.c	1999/05/12 18:03:24	1.7
  @@ -53,13 +53,15 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_errno.h"
   #include <errno.h>
   #include <unistd.h>
   #include <sys/uio.h>
  -ap_ssize_t ap_read(ap_context_t *cont, ap_file_t *thefile, void *buf, ap_ssize_t nbytes)
  +
  +ap_ssize_t ap_read(ap_context_t *cont, struct file_t *thefile, void *buf, ap_ssize_t nbytes)
   {
       ap_size_t rv;
   
  @@ -73,7 +75,7 @@
       return rv;
   }
   
  -ap_ssize_t ap_write(ap_context_t *cont, ap_file_t *thefile, void *buf, ap_ssize_t nbytes)
  +ap_ssize_t ap_write(ap_context_t *cont, struct file_t *thefile, void *buf, ap_ssize_t nbytes)
   {
       ap_size_t rv;
       struct stat info;
  @@ -94,7 +96,7 @@
       return rv;
   }
   
  -ap_ssize_t ap_writev(ap_context_t *cont, ap_file_t *thefile, const ap_iovec_t * vec, ap_ssize_t
iocnt)
  +ap_ssize_t ap_writev(ap_context_t *cont, struct file_t *thefile, const iovec_t * vec, ap_ssize_t
iocnt)
   {
       int bytes;
       if ((bytes = writev(thefile->filedes, vec, iocnt)) < 0) {
  
  
  
  1.4       +2 -1      apache-apr/apr/file_io/unix/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/seek.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- seek.c	1999/05/10 14:36:25	1.3
  +++ seek.c	1999/05/12 18:03:27	1.4
  @@ -53,11 +53,12 @@
    *
    */
   
  +#include "fileio.h"
   #include "apr_file_io.h"
   #include <errno.h>
   #include <string.h>
   
  -ap_off_t ap_seek(ap_context_t *cont, ap_file_t *thefile, ap_off_t offset, ap_seek_where_t
where)
  +ap_off_t ap_seek(ap_context_t *cont, struct file_t *thefile, ap_off_t offset, ap_seek_where_t
where)
   {
       return lseek(thefile->filedes, offset, where);
   }
  
  
  

Mime
View raw message