rbb         99/04/12 10:48:28

  Modified:    apr/file_io/unix Makefile open.c
  Added:       apr/file_io/unix fileacc.c fileio.h
  Log:
  Abstracted out the types a bit more for both files and directories.  This 
should
  make it easier for Other platforms to define their own types.  I am also 
adding
  accessor functions for both files and directories.
  
  Revision  Changes    Path
  1.6       +3 -3      apache-apr/apr/file_io/unix/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/Makefile,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile  1999/04/09 14:36:57     1.5
  +++ Makefile  1999/04/12 17:48:19     1.6
  @@ -17,7 +17,7 @@
   EXTRA_DEPS=
   OSDIR=
   INCDIR=../../../include
  -INCLUDES0=-I $(INCDIR)
  +INCLUDES0=-I . -I $(INCDIR)
   SHELL=/bin/sh
   CC=gcc
   CPP=gcc -E
  @@ -48,7 +48,7 @@
   LIB=  libfile.a
   
   OBJS= open.o readwrite.o filedup.o filestat.o seek.o dir.o\
  -
  +      fileacc.o
   .c.o:
        $(CC) -c $(INCLUDES) $(CFLAGS) $<
   
  @@ -88,4 +88,4 @@
   filestat.o: filestat.c
   seek.o: seek.c
   dir.o: dir.c
  -
  +fileacc.o: fileacc.c
  
  
  
  1.13      +1 -0      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- open.c    1999/04/09 18:09:25     1.12
  +++ open.c    1999/04/12 17:48:19     1.13
  @@ -54,6 +54,7 @@
    */
   
   #include "apr_file_io.h"
  +#include "apr_general.h"
   #include <errno.h>
   #include <string.h>
   
  
  
  
  1.1                  apache-apr/apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  /* ====================================================================
   * Copyright (c) 1999 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *    software must display the following acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * 4. The names "Apache Server" and "Apache Group" must not be used to
   *    endorse or promote products derived from this software without
   *    prior written permission. For written permission, please contact
   *    [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *    acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see <http://www.apache.org/>.
   *
   */
  
  #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 apr_file_t types. */
  
  apr_status_t apr_valid_file(apr_file_t *thefile) 
  {
      if (thefile != NULL && thefile->filedes > 0) {
          return APR_SUCCESS;
      }
      else {
          return APR_FAILURE;
      }
  }
  
  char * apr_get_filename(apr_file_t *thefile)
  {
      if (thefile != NULL) {
          return thefile->fname;
      }
      else {
          return NULL;
      }
  }
  
  
  
  
  
  1.1                  apache-apr/apr/file_io/unix/fileio.h
  
  Index: fileio.h
  ===================================================================
  /* ====================================================================
   * Copyright (c) 1999 The Apache Group.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. All advertising materials mentioning features or use of this
   *    software must display the following acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * 4. The names "Apache Server" and "Apache Group" must not be used to
   *    endorse or promote products derived from this software without
   *    prior written permission. For written permission, please contact
   *    [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 6. Redistributions of any form whatsoever must retain the following
   *    acknowledgment:
   *    "This product includes software developed by the Apache Group
   *    for use in the Apache HTTP server project (http://www.apache.org/)."
   *
   * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
   * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Group.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see <http://www.apache.org/>.
   *
   */
  
  #ifndef FILE_IO_H
  #define FILE_IO_H
  
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <fcntl.h>
  #include <time.h>
  #include <dirent.h>
  #include <sys/uio.h>
  
  /* Permissions flags */
  #define UREAD     S_IRUSR
  #define UWRITE    S_IWUSR
  #define UEXECUTE  S_IXUSR
  
  #define GREAD     S_IRGRP
  #define GWRITE    S_IWGRP
  #define GEXECUTE  S_IXGRP
  
  #define WREAD     S_IROTH
  #define WWRITE    S_IWOTH
  #define WEXECUTE  S_IXOTH
  
  struct file_t {
      int filedes;
      char * fname;
      int buffered;
      mode_t protection;
      uid_t user;
      gid_t group;
      off_t size;
      time_t atime;
      time_t mtime;
      time_t ctime;
  };
  
  struct dir_t {
      char *dirname;
      DIR *dirstruct;
  };
  
  typedef mode_t            fileperms_t;
  typedef struct dirent     dirent_t;
  typedef struct iovec      iovec_t;
  
  #endif  /* ! FILE_IO_H */
  
  
  
  

Reply via email to