httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/dav/main mod_dav.c mod_dav.h providers.c
Date Sat, 07 Oct 2000 01:29:39 GMT
gstein      00/10/06 18:29:39

  Modified:    src/modules/dav/fs mod_dav_fs.c repos.c
               src/modules/dav/main mod_dav.c mod_dav.h providers.c
  Log:
  clean up the provider stuff some more: don't allow pick-and-choose of
  pieces, but just a complete provider. they aren't really separable anyways.
  
  Revision  Changes    Path
  1.8       +0 -3      apache-2.0/src/modules/dav/fs/mod_dav_fs.c
  
  Index: mod_dav_fs.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/mod_dav_fs.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mod_dav_fs.c	2000/09/09 23:23:40	1.7
  +++ mod_dav_fs.c	2000/10/07 01:29:38	1.8
  @@ -121,9 +121,6 @@
   
   static void register_hooks(void)
   {
  -    ap_hook_get_lock_hooks(dav_fs_get_lock_hooks, NULL, NULL, AP_HOOK_MIDDLE);
  -    ap_hook_get_propdb_hooks(dav_fs_get_propdb_hooks, NULL, NULL,
  -                             AP_HOOK_MIDDLE);
       ap_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
                               AP_HOOK_MIDDLE);
       ap_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, AP_HOOK_MIDDLE);
  
  
  
  1.24      +8 -10     apache-2.0/src/modules/dav/fs/repos.c
  
  Index: repos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- repos.c	2000/10/06 19:45:52	1.23
  +++ repos.c	2000/10/07 01:29:38	1.24
  @@ -1999,16 +1999,14 @@
       dav_fs_patch_rollback,
   };
   
  -
  -const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r)
  +static const dav_provider dav_fs_provider =
   {
  -    return &dav_hooks_locks_fs;
  -}
  -
  -const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r)
  -{
  -    return &dav_hooks_db_dbm;
  -}
  +    &dav_hooks_repository_fs,
  +    &dav_hooks_db_dbm,
  +    &dav_hooks_locks_fs,
  +    &dav_hooks_liveprop_fs,
  +    NULL
  +};
   
   void dav_fs_gather_propsets(apr_array_header_t *uris)
   {
  @@ -2046,5 +2044,5 @@
       }
   
       /* register the repository provider */
  -    dav_register_repository(p, "filesystem", &dav_hooks_repository_fs);
  +    dav_register_provider(p, "filesystem", &dav_fs_provider);
   }
  
  
  
  1.23      +28 -50    apache-2.0/src/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/mod_dav.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_dav.c	2000/10/07 00:50:42	1.22
  +++ mod_dav.c	2000/10/07 01:29:38	1.23
  @@ -216,52 +216,31 @@
       return conf->d_params;
   }
   
  -const dav_hooks_locks *dav_get_lock_hooks(request_rec *r)
  +static const dav_provider * dav_get_provider(request_rec *r)
   {
  -    void *data;
  -    const dav_hooks_locks *hooks;
  +    dav_dir_conf *conf;
   
  -    (void) apr_get_userdata(&data, DAV_KEY_LOCK_HOOKS, r->pool);
  -    if (data == NULL) {
  -        hooks = ap_run_get_lock_hooks(r);
  -        (void) apr_set_userdata(hooks, DAV_KEY_LOCK_HOOKS, apr_null_cleanup,
  -                               r->pool);
  -    }
  -    else
  -        hooks = data;
  -    return hooks;
  +    conf = ap_get_module_config(r->per_dir_config, &dav_module);
  +    /* assert: conf->provider != NULL
  +       (otherwise, DAV is disabled, and we wouldn't be here */
  +
  +    /* ### assert that we find it? (return value != NULL) */
  +    return dav_lookup_provider(conf->provider);
   }
   
  -const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r)
  +const dav_hooks_locks *dav_get_lock_hooks(request_rec *r)
   {
  -    void *data;
  -    const dav_hooks_db *hooks;
  +    return dav_get_provider(r)->locks;
  +}
   
  -    (void) apr_get_userdata(&data, DAV_KEY_PROPDB_HOOKS, r->pool);
  -    if (data == NULL) {
  -        hooks = ap_run_get_propdb_hooks(r);
  -        (void) apr_set_userdata(hooks, DAV_KEY_PROPDB_HOOKS, apr_null_cleanup,
  -                               r->pool);
  -    }
  -    else
  -        hooks = data;
  -    return hooks;
  +const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r)
  +{
  +    return dav_get_provider(r)->propdb;
   }
   
   const dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r)
   {
  -    void *data;
  -    const dav_hooks_vsn *hooks;
  -
  -    (void) apr_get_userdata(&data, DAV_KEY_VSN_HOOKS, r->pool);
  -    if (data == NULL) {
  -        hooks = ap_run_get_vsn_hooks(r);
  -        (void) apr_set_userdata(hooks, DAV_KEY_VSN_HOOKS, apr_null_cleanup,
  -                               r->pool);
  -    }
  -    else
  -        hooks = data;
  -    return hooks;
  +    return dav_get_provider(r)->vsn;
   }
   
   /*
  @@ -280,6 +259,14 @@
       else {
           conf->provider = apr_pstrdup(cmd->pool, arg1);
       }
  +    if (conf->provider != NULL
  +        && dav_lookup_provider(conf->provider) == NULL) {
  +
  +        /* by the time they use it, the provider should be loaded and
  +           registered with us. */
  +        return apr_psprintf(cmd->pool,
  +                            "Unknown DAV provider: %s", conf->provider);
  +    }
   
       return NULL;
   }
  @@ -610,7 +597,7 @@
   {
       void *data;
       dav_dir_conf *conf;
  -    const dav_hooks_repository *repos_hooks;
  +    const dav_provider *provider;
       const char *workspace = NULL;
       const char *target_selector = NULL;
       int is_label = 0;
  @@ -625,8 +612,8 @@
   
       conf = ap_get_module_config(r->per_dir_config, &dav_module);
   
  -    /* assert: provider != NULL */
  -    repos_hooks = dav_lookup_repository(conf->provider);
  +    /* assert: conf->provider != NULL */
  +    provider = dav_lookup_provider(conf->provider);
   
       /* get any workspace header */
       if ((result = dav_get_workspace(r, &workspace)) != OK)
  @@ -641,8 +628,8 @@
       }
   
       /* resolve the resource */
  -    *res_p = (*repos_hooks->get_resource)(r, conf->dir, workspace,
  -                                          target_selector, is_label);
  +    *res_p = (*provider->repos->get_resource)(r, conf->dir, workspace,
  +                                              target_selector, is_label);
       if (*res_p == NULL) {
           /* Apache will supply a default error for this. */
           return HTTP_NOT_FOUND;
  @@ -3269,19 +3256,10 @@
   };
   
   AP_HOOK_STRUCT(
  -    AP_HOOK_LINK(get_lock_hooks)
  -    AP_HOOK_LINK(get_propdb_hooks)
  -    AP_HOOK_LINK(get_vsn_hooks)
       AP_HOOK_LINK(gather_propsets)
       AP_HOOK_LINK(find_liveprop)
       AP_HOOK_LINK(insert_all_liveprops)
       )
  -AP_IMPLEMENT_HOOK_RUN_FIRST(const dav_hooks_locks *, get_lock_hooks,
  -                            (request_rec *r), (r), NULL);
  -AP_IMPLEMENT_HOOK_RUN_FIRST(const dav_hooks_db *, get_propdb_hooks,
  -                            (request_rec *r), (r), NULL);
  -AP_IMPLEMENT_HOOK_RUN_FIRST(const dav_hooks_vsn *, get_vsn_hooks,
  -                            (request_rec *r), (r), NULL);
   AP_IMPLEMENT_HOOK_VOID(gather_propsets, (apr_array_header_t *uris), (uris))
   AP_IMPLEMENT_HOOK_RUN_FIRST(int, find_liveprop,
                               (request_rec *r,
  
  
  
  1.18      +23 -9     apache-2.0/src/modules/dav/main/mod_dav.h
  
  Index: mod_dav.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/mod_dav.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_dav.h	2000/10/07 00:50:42	1.17
  +++ mod_dav.h	2000/10/07 01:29:38	1.18
  @@ -410,10 +410,26 @@
   
   /* ### docco ... */
   
  -AP_DECLARE_HOOK(const dav_hooks_locks *, get_lock_hooks, (request_rec *r))
  -AP_DECLARE_HOOK(const dav_hooks_propdb *, get_propdb_hooks, (request_rec *r))
  -AP_DECLARE_HOOK(const dav_hooks_vsn *, get_vsn_hooks, (request_rec *r))
  +/*
  +** dav_provider
  +**
  +** This structure wraps up all of the hooks that a mod_dav provider can
  +** supply. The provider MUST supply <repos> and <propdb>. The rest are
  +** optional and should contain NULL if that feature is not supplied.
  +**
  +** Note that a provider cannot pick and choose portions. There are too many
  +** dependencies between a dav_resource (defined by <repos>) and the other
  +** functionality.
  +*/
  +typedef struct {
  +    const dav_hooks_repository *repos;
  +    const dav_hooks_propdb *propdb;
  +    const dav_hooks_locks *locks;
  +    const dav_hooks_liveprop *liveprop;
  +    const dav_hooks_vsn *vsn;
   
  +} dav_provider;
  +
   AP_DECLARE_HOOK(void, gather_propsets, (apr_array_header_t *uris))
   AP_DECLARE_HOOK(int, find_liveprop, (request_rec *r,
                                        const char *ns_uri, const char *name,
  @@ -423,18 +439,16 @@
                                                int insvalue,
                                                ap_text_header *phdr))
   
  +/* ### make this internal to mod_dav.c ? */
   #define DAV_KEY_RESOURCE        "dav-resource"
  -#define DAV_KEY_LOCK_HOOKS      "dav-lock-hooks"
  -#define DAV_KEY_PROPDB_HOOKS    "dav-propdb-hooks"
  -#define DAV_KEY_VSN_HOOKS       "dav-vsn-hooks"
   
   const dav_hooks_locks *dav_get_lock_hooks(request_rec *r);
   const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r);
   const dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r);
   
  -void dav_register_repository(apr_pool_t *p, const char *name,
  -                             const dav_hooks_repository *hooks);
  -const dav_hooks_repository * dav_lookup_repository(const char *name);
  +void dav_register_provider(apr_pool_t *p, const char *name,
  +                           const dav_provider *hooks);
  +const dav_provider * dav_lookup_provider(const char *name);
   
   void dav_register_liveprop_namespace(apr_pool_t *pool, const char *uri);
   int dav_get_liveprop_ns_index(const char *uri);
  
  
  
  1.2       +4 -4      apache-2.0/src/modules/dav/main/providers.c
  
  Index: providers.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/providers.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- providers.c	2000/09/09 23:23:42	1.1
  +++ providers.c	2000/10/07 01:29:39	1.2
  @@ -69,8 +69,8 @@
       return APR_SUCCESS;
   }
   
  -void dav_register_repository(apr_pool_t *p, const char *name,
  -                             const dav_hooks_repository *hooks)
  +void dav_register_provider(apr_pool_t *p, const char *name,
  +                           const dav_provider *provider)
   {
       /* ### ignore the pool; it is NULL right now */
       p = ap_global_hook_pool;
  @@ -81,10 +81,10 @@
       }
   
       /* just set it. no biggy if it was there before. */
  -    apr_hash_set(dav_repos_providers, name, 0, hooks);
  +    apr_hash_set(dav_repos_providers, name, 0, provider);
   }
   
  -const dav_hooks_repository * dav_lookup_repository(const char *name)
  +const dav_provider * dav_lookup_provider(const char *name)
   {
       return apr_hash_get(dav_repos_providers, name, 0);
   }
  
  
  

Mime
View raw message