apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/include/arch/netware fileio.h
Date Wed, 06 Nov 2002 17:08:53 GMT
bnicholes    2002/11/06 09:08:53

  Modified:    file_io/unix open.c
               file_io/netware filestat.c
               file_io/win32 filepath.c
               include/arch/netware fileio.h
  Log:
  Store and use the path context to each directory and file rather than relying
  on the directory path alone.  This allows for direct access into the file system on
  every stat() and open() call rather than having to traverse the file system each
  time.
  
  Revision  Changes    Path
  1.100     +0 -8      apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- open.c	23 Oct 2002 22:21:18 -0000	1.99
  +++ open.c	6 Nov 2002 17:08:52 -0000	1.100
  @@ -58,13 +58,11 @@
   #include "apr_thread_mutex.h"
   #include "inherit.h"
   
  -#ifdef FAST_STAT
   #ifdef NETWARE
   #include "nks/dirio.h"
   #include "apr_hash.h"
   #include "fsio.h"
   #endif
  -#endif
   
   apr_status_t apr_unix_file_cleanup(void *thefile)
   {
  @@ -105,12 +103,10 @@
       apr_status_t rv;
   #endif
   
  -#ifdef FAST_STAT
   #ifdef NETWARE
       apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
       apr_stat_entry_t *stat_entry;
   #endif
  -#endif
   
       (*new) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
       (*new)->pool = pool;
  @@ -173,7 +169,6 @@
       }
   #endif
       
  -#ifdef FAST_STAT
   #ifdef NETWARE
       stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, fname, APR_HASH_KEY_STRING);
       if (stat_entry) {
  @@ -181,17 +176,14 @@
       }
       else {
   #endif
  -#endif
       if (perm == APR_OS_DEFAULT) {
           (*new)->filedes = open(fname, oflags, 0666);
       }
       else {
           (*new)->filedes = open(fname, oflags, apr_unix_perms2mode(perm));
       } 
  -#ifdef FAST_STAT
   #ifdef NETWARE
       }
  -#endif
   #endif
   
       if ((*new)->filedes < 0) {
  
  
  
  1.19      +0 -137    apr/file_io/netware/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- filestat.c	23 Oct 2002 22:21:19 -0000	1.18
  +++ filestat.c	6 Nov 2002 17:08:52 -0000	1.19
  @@ -53,9 +53,7 @@
    */
   
   #include "fileio.h"
  -#ifdef FAST_STAT
   #include "fsio.h"
  -#endif
   #include "nks/dirio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
  @@ -107,32 +105,6 @@
        */
   }
   
  -#ifndef FAST_STAT
  -char *case_filename(apr_pool_t *pPool, const char *szFile)
  -{
  -    char *casedFileName = NULL;
  -    char name[1024];
  -    int rc;
  -
  -    rc = realname(szFile, name);
  -    if (rc == 0) {
  -        casedFileName = apr_pstrdup(pPool, name);
  -    }
  -    else
  -    {
  -        char *s;
  -        s = strrchr(szFile, '/');
  -        if (!s)
  -            s = strrchr(szFile, ':');
  -        if (s) {
  -            casedFileName = apr_pstrdup(pPool, &s[1]);
  -        }
  -    }
  -    return casedFileName;
  -}
  -#endif
  -
  -
   APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, 
                                               apr_int32_t wanted,
                                               apr_file_t *thefile)
  @@ -210,7 +182,6 @@
       return apr_file_perms_set(fname, finfo.protection);
   }
   
  -#ifdef FAST_STAT
   int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *pool)
   {
       apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
  @@ -310,7 +281,6 @@
                       }
                   }
   
  -/* xxx Need to handle error codes here */
                   err = NXCreatePathContext(pathCtx, dirPath, 0, NULL, &pathCtx);
   
                   key = apr_pstrdup (gPool, path);
  @@ -379,113 +349,6 @@
       }
       return 0;
   }
  -#else
  -int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *pool)
  -{
  -    apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
  -    apr_pool_t *gPool = (apr_pool_t *)getGlobalPool(CpuCurrentProcessor);
  -    apr_stat_entry_t *stat_entry;
  -    struct stat *info;
  -    apr_time_t now = apr_time_now();
  -    char *key;
  -    int ret;
  -    int found = 0;
  -
  -    *casedName = NULL;
  -
  -    /* If there isn't a global pool then just stat the file
  -       and return */
  -    if (!gPool) {
  -        char poolname[50];
  -
  -        if (apr_pool_create(&gPool, NULL) != APR_SUCCESS) {
  -            ret = stat(path, buf);
  -            if (ret == 0)
  -                *casedName = case_filename(pool, path);
  -            return ret;
  -        }
  -
  -        sprintf (poolname, "cstat_mem_pool_%d", CpuCurrentProcessor);
  -        apr_pool_tag(gPool, poolname);
  -
  -        setGlobalPool(gPool, CpuCurrentProcessor);
  -    }
  -
  -    /* If we have a statCache hash table then use it.
  -       Otherwise we need to create it and initialized it
  -       with a new mutex lock. */
  -    if (!statCache) {
  -        statCache = apr_hash_make(gPool);
  -        setStatCache((void*)statCache, CpuCurrentProcessor);
  -    }
  -
  -    /* If we have a statCache then try to pull the information
  -       from the cache.  Otherwise just stat the file and return.*/
  -    if (statCache) {
  -        stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, path, APR_HASH_KEY_STRING);
  -        /* If we got an entry then check the expiration time.  If the entry
  -           hasn't expired yet then copy the information and return. */
  -        if (stat_entry) {
  -            if ((now - stat_entry->expire) <= APR_USEC_PER_SEC) {
  -                memcpy (buf, &(stat_entry->info), sizeof(struct stat));
  -                if (stat_entry->casedName)
  -                    *casedName = apr_pstrdup (pool, stat_entry->casedName);
  -                else
  -                    *casedName = case_filename(pool, path);
  -                found = 1;
  -            }
  -        }
  -
  -        /* Since we are creating a separate stat cache for each processor, we
  -           don't need to worry about locking the hash table before manipulating
  -           it. */
  -        if (!found) {
  -            /* Bind the thread to the current cpu so that we don't wake
  -               up on some other cpu and try to manipulate the wrong cache. */
  -            NXThreadBind (CpuCurrentProcessor);
  -            ret = stat(path, buf);
  -            if (ret == 0) {
  -                *casedName = case_filename(pool, path);
  -                /* If we don't have a stat_entry then create one, copy
  -                   the data and add it to the hash table. */
  -                if (!stat_entry) {
  -                    key = apr_pstrdup (gPool, path);
  -                    stat_entry = apr_palloc (gPool, sizeof(apr_stat_entry_t));
  -                    memcpy (&(stat_entry->info), buf, sizeof(struct stat));
  -                    if (*casedName)
  -                        stat_entry->casedName = apr_pstrdup (gPool, *casedName);
  -                    stat_entry->expire = now;
  -                    apr_hash_set(statCache, key, APR_HASH_KEY_STRING, stat_entry);
  -                }
  -                else {
  -                    /* If we do have a stat_entry then it must have expired.  Just
  -                       copy the data and reset the expiration. */
  -                    memcpy (&(stat_entry->info), buf, sizeof(struct stat));
  -
  -                    /* If we have a casedName and don't have a cached name or the names
don't
  -                       compare, then cache the name. */
  -                    if (*casedName && (!stat_entry->casedName || strcmp(*casedName,
stat_entry->casedName))) {
  -                        stat_entry->casedName = apr_pstrdup (gPool, *casedName);
  -                    }
  -                    stat_entry->expire = now;
  -                }
  -                NXThreadBind (NX_THR_UNBOUND);
  -            }
  -            else{
  -                NXThreadBind (NX_THR_UNBOUND);
  -                return ret;
  -			}
  -        }
  -    }
  -    else {
  -        ret = stat(path, buf);
  -        if (ret == 0)
  -            *casedName = case_filename(pool, path);
  -        return ret;
  -    }
  -    return 0;
  -}
  -#endif
   
   APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, 
                                      const char *fname, 
  
  
  
  1.27      +0 -2      apr/file_io/win32/filepath.c
  
  Index: filepath.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filepath.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- filepath.c	23 Oct 2002 22:21:19 -0000	1.26
  +++ filepath.c	6 Nov 2002 17:08:52 -0000	1.27
  @@ -61,9 +61,7 @@
   
   #ifdef NETWARE
   #include <unistd.h>
  -#ifdef FAST_STAT
   #include <fsio.h>
  -#endif
   #endif
   
    /* WinNT accepts several odd forms of a 'root' path.  Under Unicode
  
  
  
  1.10      +0 -6      apr/include/arch/netware/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/netware/fileio.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- fileio.h	23 Oct 2002 22:21:19 -0000	1.9
  +++ fileio.h	6 Nov 2002 17:08:53 -0000	1.10
  @@ -55,8 +55,6 @@
   #ifndef FILE_IO_H
   #define FILE_IO_H
   
  -//#define FAST_STAT
  -
   #include "apr.h"
   #include "apr_private.h"
   #include "apr_general.h"
  @@ -104,11 +102,7 @@
   #include <sys/time.h>
   #endif
   
  -#ifdef FAST_STAT
   #include <fsio.h>
  -#else
  -#include <nks\fsio.h>
  -#endif
   
   /* End System headers */
   
  
  
  

Mime
View raw message