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 props.c
Date Sat, 08 Jul 2000 13:22:15 GMT
gstein      00/07/08 06:22:15

  Modified:    src/modules/dav/fs mod_dav_fs.c repos.c repos.h
               src/modules/dav/main mod_dav.c mod_dav.h props.c
  Log:
  get rid of more of the old module/provider mechanisms -- use ap_hooks to
  look up the plugins' function hook tables.
  
  Revision  Changes    Path
  1.3       +2 -0      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mod_dav_fs.c	2000/07/07 10:38:22	1.2
  +++ mod_dav_fs.c	2000/07/08 13:22:07	1.3
  @@ -122,6 +122,8 @@
   static void register_hooks(void)
   {
       ap_hook_get_resource(dav_fs_hook_get_resource, NULL, NULL, AP_HOOK_MIDDLE);
  +    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);
   }
   
   module MODULE_VAR_EXPORT dav_fs_module =
  
  
  
  1.11      +11 -14    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- repos.c	2000/07/07 10:38:22	1.10
  +++ repos.c	2000/07/08 13:22:07	1.11
  @@ -2027,20 +2027,7 @@
           &dav_hooks_liveprop_fs,
           NULL
       },
  -    /* propdb provider */
  -    {
  -	DAV_FS_PROVIDER_ID,
  -        DAV_DYN_TYPE_PROPDB,
  -        &dav_hooks_db_dbm,
  -        NULL
  -    },
  -    /* locks provider */
  -    {
  -	DAV_FS_PROVIDER_ID,
  -        DAV_DYN_TYPE_LOCKS,
  -        &dav_hooks_locks_fs,
  -        NULL
  -    },
  +
       /* must always be last */
       DAV_DYN_END_MARKER
   };
  @@ -2072,4 +2059,14 @@
       (void) ap_set_userdata(resource, DAV_KEY_RESOURCE, ap_null_cleanup,
                              r->pool);
       return OK;
  +}
  +
  +const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r)
  +{
  +    return &dav_hooks_locks_fs;
  +}
  +
  +const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r)
  +{
  +    return &dav_hooks_db_dbm;
   }
  
  
  
  1.7       +2 -0      apache-2.0/src/modules/dav/fs/repos.h
  
  Index: repos.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- repos.h	2000/07/07 10:38:22	1.6
  +++ repos.h	2000/07/08 13:22:11	1.7
  @@ -97,5 +97,7 @@
   
   int dav_fs_hook_get_resource(request_rec *r, const char *root_dir,
                                const char *workspace);
  +const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r);
  +const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r);
   
   #endif /* _DAV_FS_REPOS_H_ */
  
  
  
  1.10      +56 -77    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_dav.c	2000/07/07 10:38:23	1.9
  +++ mod_dav.c	2000/07/08 13:22:13	1.10
  @@ -112,10 +112,7 @@
       ap_table_t *d_params;	/* per-directory DAV config parameters */
       struct dav_dyn_mod_ctx *dmc;
   
  -    dav_dyn_hooks propdb;
  -    dav_dyn_hooks locks;
       dav_dyn_hooks *liveprop;
  -    dav_dyn_hooks vsn;
   } dav_dir_conf;
   
   /* per-server configuration */
  @@ -157,26 +154,6 @@
   
   	switch (provider->type) {
   
  -	case DAV_DYN_TYPE_PROPDB:
  -	    conf->propdb = hooks;
  -	    break;
  -
  -	case DAV_DYN_TYPE_LOCKS:
  -	    conf->locks = hooks;
  -	    break;
  -
  -	case DAV_DYN_TYPE_QUERY_GRAMMAR:
  -	    /* ### not yet defined */
  -	    break;
  -
  -	case DAV_DYN_TYPE_ACL:
  -	    /* ### not yet defined */
  -	    break;
  -
  -	case DAV_DYN_TYPE_VSN:
  -	    conf->vsn = hooks;
  -	    break;
  -
   	case DAV_DYN_TYPE_LIVEPROP:
   	{
   	    dav_dyn_hooks *ddh = ap_palloc(p, sizeof(*ddh));
  @@ -278,21 +255,6 @@
       ap_overlap_tables(newconf->d_params, child->d_params,
   		      AP_OVERLAP_TABLES_SET);
   
  -    if (child->propdb.hooks != NULL)
  -        newconf->propdb = child->propdb;
  -    else
  -        newconf->propdb = parent->propdb;
  -    
  -    if (child->locks.hooks != NULL)
  -        newconf->locks = child->locks;
  -    else
  -        newconf->locks = parent->locks;
  -
  -    if (child->vsn.hooks != NULL)
  -        newconf->vsn = child->vsn;
  -    else
  -        newconf->vsn = parent->vsn;
  -
       if (child->liveprop != NULL)
           newconf->liveprop = child->liveprop;
       else
  @@ -328,51 +290,62 @@
       return (size_t)conf->limit_xml_body;
   }
   
  -const dav_dyn_hooks *dav_get_provider_hooks(request_rec *r, int provider_type)
  +const dav_hooks_locks *dav_get_lock_hooks(request_rec *r)
   {
  -    dav_dir_conf *conf;
  -    const dav_dyn_hooks *hooks;
  -    static const dav_dyn_hooks null_hooks = { { 0 } };
  +    void *data;
  +    const dav_hooks_locks *hooks;
   
  -    conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config,
  -						 &dav_module);
  -    switch (provider_type) {
  +    (void) ap_get_userdata(&data, DAV_KEY_LOCK_HOOKS, r->pool);
  +    if (data == NULL) {
  +        hooks = ap_run_get_lock_hooks(r);
  +        (void) ap_set_userdata(hooks, DAV_KEY_LOCK_HOOKS, ap_null_cleanup,
  +                               r->pool);
  +    }
  +    else
  +        hooks = data;
  +    return hooks;
  +}
   
  -    case DAV_DYN_TYPE_PROPDB:
  -        hooks = &conf->propdb;
  -        break;
  -
  -    case DAV_DYN_TYPE_LOCKS:
  -        hooks = &conf->locks;
  -        break;
  -
  -    case DAV_DYN_TYPE_QUERY_GRAMMAR:
  -        /* ### not yet defined */
  -        hooks = &null_hooks;
  -        break;
  -
  -    case DAV_DYN_TYPE_ACL:
  -        /* ### not yet defined */
  -        hooks = &null_hooks;
  -        break;
  -
  -    case DAV_DYN_TYPE_VSN:
  -        hooks = &conf->vsn;
  -        break;
  -
  -    case DAV_DYN_TYPE_LIVEPROP:
  -        hooks = conf->liveprop;
  -        break;
  +const dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r)
  +{
  +    void *data;
  +    const dav_hooks_db *hooks;
   
  -    default:
  -        /* unknown provider type */
  -        hooks = &null_hooks;
  -	break;
  +    (void) ap_get_userdata(&data, DAV_KEY_PROPDB_HOOKS, r->pool);
  +    if (data == NULL) {
  +        hooks = ap_run_get_propdb_hooks(r);
  +        (void) ap_set_userdata(hooks, DAV_KEY_PROPDB_HOOKS, ap_null_cleanup,
  +                               r->pool);
       }
  +    else
  +        hooks = data;
  +    return hooks;
  +}
  +
  +const dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r)
  +{
  +    void *data;
  +    const dav_hooks_vsn *hooks;
   
  +    (void) ap_get_userdata(&data, DAV_KEY_VSN_HOOKS, r->pool);
  +    if (data == NULL) {
  +        hooks = ap_run_get_vsn_hooks(r);
  +        (void) ap_set_userdata(hooks, DAV_KEY_VSN_HOOKS, ap_null_cleanup,
  +                               r->pool);
  +    }
  +    else
  +        hooks = data;
       return hooks;
   }
   
  +const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r)
  +{
  +    dav_dir_conf *conf;
  +
  +    conf = ap_get_module_config(r->per_dir_config, &dav_module);
  +    return conf->liveprop;
  +}
  +
   /*
    * Command handler for the DAV directive, which is FLAG.
    */
  @@ -3264,9 +3237,9 @@
   
   AP_HOOK_STRUCT(
       AP_HOOK_LINK(get_resource)
  -    AP_HOOK_LINK(set_lock_hooks)
  -    AP_HOOK_LINK(set_propdb_hooks)
  -    AP_HOOK_LINK(set_vsn_hooks)
  +    AP_HOOK_LINK(get_lock_hooks)
  +    AP_HOOK_LINK(get_propdb_hooks)
  +    AP_HOOK_LINK(get_vsn_hooks)
       AP_HOOK_LINK(find_liveprop)
       AP_HOOK_LINK(insert_all_liveprops)
       )
  @@ -3274,3 +3247,9 @@
                               (request_rec *r, const char *root_dir,
                                const char *workspace),
                               (r, root_dir, workspace), DECLINED);
  +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);
  
  
  
  1.10      +25 -24    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_dav.h	2000/07/07 10:38:23	1.9
  +++ mod_dav.h	2000/07/08 13:22:14	1.10
  @@ -226,13 +226,16 @@
   */
   
   /* forward-declare this structure */
  -typedef struct dav_hooks_db dav_hooks_db;
  +typedef struct dav_hooks_propdb dav_hooks_propdb;
   typedef struct dav_hooks_locks dav_hooks_locks;
   typedef struct dav_hooks_vsn dav_hooks_vsn;
   typedef struct dav_hooks_repository dav_hooks_repository;
   typedef struct dav_hooks_liveprop dav_hooks_liveprop;
   
  +/* ### deprecated name */
  +typedef dav_hooks_propdb dav_hooks_db;
   
  +
   /* --------------------------------------------------------------------
   **
   ** RESOURCE HANDLING
  @@ -384,12 +387,14 @@
   
   AP_DECLARE_HOOK(int, get_resource, (request_rec *r, const char *root_dir,
                                       const char *workspace))
  -AP_DECLARE_HOOK(int, set_lock_hooks, (request_rec *r))
  -AP_DECLARE_HOOK(int, set_propdb_hooks, (request_rec *r))
  -AP_DECLARE_HOOK(int, set_vsn_hooks, (request_rec *r))
  -AP_DECLARE_HOOK(int, find_liveprop, (const char *ns_uri, const char *name,
  -                                     struct dav_hooks_liveprop **hooks))
  -AP_DECLARE_HOOK(void, insert_all_liveprops, (const dav_resource *resource,
  +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))
  +AP_DECLARE_HOOK(int, find_liveprop, (request_rec *r,
  +                                     const char *ns_uri, const char *name,
  +                                     const dav_hooks_liveprop **hooks))
  +AP_DECLARE_HOOK(void, insert_all_liveprops, (request_rec *r,
  +                                             const dav_resource *resource,
                                                int insvalue, ap_hash_t *ns_map,
                                                ap_text_header *phdr))
   
  @@ -398,6 +403,10 @@
   #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);
  +
   
   /* --------------------------------------------------------------------
   **
  @@ -554,23 +563,15 @@
   		       const dav_dyn_provider **provider,
   		       dav_dyn_hooks *output);
   
  -/* handy macros to assist with dav_dyn_hooks.hooks usage */
  -#define DAV_AS_HOOKS_PROPDB(ph)		((const dav_hooks_db *)((ph)->hooks))
  -#define DAV_AS_HOOKS_LOCKS(ph)		((const dav_hooks_locks *)((ph)->hooks))
  -#define DAV_AS_HOOKS_QUERY_GRAMMAR(ph)	((void *)((ph)->hooks))
  -#define DAV_AS_HOOKS_ACL(ph)		((void *)((ph)->hooks))
  -#define DAV_AS_HOOKS_VSN(ph)		((const dav_hooks_vsn *)((ph)->hooks))
  -#define DAV_AS_HOOKS_LIVEPROP(ph)	((const dav_hooks_liveprop *)((ph)->hooks))
  +/* ### deprecated */
  +#define DAV_GET_HOOKS_PROPDB(r)         dav_get_propdb_hooks(r)
  +#define DAV_GET_HOOKS_LOCKS(r)          dav_get_lock_hooks(r)
  +#define DAV_GET_HOOKS_VSN(r)            dav_get_vsn_hooks(r)
   
  -/* get provider hooks, given a request record */
  -const dav_dyn_hooks *dav_get_provider_hooks(request_rec *r, int provider_type);
  -
  -#define DAV_GET_HOOKS_PROPDB(r)         DAV_AS_HOOKS_PROPDB(dav_get_provider_hooks(r, DAV_DYN_TYPE_PROPDB))
  -#define DAV_GET_HOOKS_LOCKS(r)          DAV_AS_HOOKS_LOCKS(dav_get_provider_hooks(r, DAV_DYN_TYPE_LOCKS))
  -#define DAV_GET_HOOKS_QUERY_GRAMMAR(r)  DAV_AS_HOOKS_QUERY_GRAMMAR(dav_get_provider_hooks(r,
DAV_DYN_TYPE_QUERY_GRAMMAR))
  -#define DAV_GET_HOOKS_ACL(r)            DAV_AS_HOOKS_ACL(dav_get_provider_hooks(r, DAV_DYN_TYPE_ACL))
  -#define DAV_GET_HOOKS_VSN(r)            DAV_AS_HOOKS_VSN(dav_get_provider_hooks(r, DAV_DYN_TYPE_VSN))
  -#define DAV_GET_HOOKS_LIVEPROP(r)       DAV_AS_HOOKS_LIVEPROP(dav_get_provider_hooks(r,
DAV_DYN_TYPE_LIVEPROP))
  +/* ### temporary; this semantic won't apply in the new scheme */
  +const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r);
  +#define DAV_AS_HOOKS_LIVEPROP(ph)	((const dav_hooks_liveprop *)((ph)->hooks))
  +#define DAV_GET_HOOKS_LIVEPROP(r)       DAV_AS_HOOKS_LIVEPROP(dav_get_liveprop_hooks(r))
   
   
   /* --------------------------------------------------------------------
  @@ -824,7 +825,7 @@
   } dav_datum;
   
   /* hook functions to enable pluggable databases */
  -struct dav_hooks_db
  +struct dav_hooks_propdb
   {
       dav_error * (*open)(ap_pool_t *p, const dav_resource *resource, int ro,
   			dav_db **pdb);
  
  
  
  1.7       +2 -1      apache-2.0/src/modules/dav/main/props.c
  
  Index: props.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/props.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- props.c	2000/07/07 07:55:46	1.6
  +++ props.c	2000/07/08 13:22:14	1.7
  @@ -972,7 +972,8 @@
       propdb->db_hooks = DAV_GET_HOOKS_PROPDB(r);
       propdb->vsn_hooks = DAV_GET_HOOKS_VSN(r);
   
  -    propdb->liveprop = dav_get_provider_hooks(r, DAV_DYN_TYPE_LIVEPROP);
  +    /* ### this will need to change */
  +    propdb->liveprop = dav_get_liveprop_hooks(r);
   
       propdb->lockdb = lockdb;
   
  
  
  

Mime
View raw message