From 4a6ae6106f4c4fa4130ab6e4521f4cc1ec23972a Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Mon, 10 Jul 2000 04:16:51 +0000 Subject: [PATCH] torch just about all of the old dav_dyn stuff. temporarily hard-wire the liveprop provider setup. this will go away momentarily (another pass). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85801 13f79535-47bb-0310-9956-ffa450edef68 --- modules/dav/fs/repos.c | 26 ++++++----------- modules/dav/main/config.m4 | 2 +- modules/dav/main/mod_dav.c | 40 +++++++------------------- modules/dav/main/mod_dav.h | 59 ++++---------------------------------- modules/dav/main/props.c | 4 +-- 5 files changed, 26 insertions(+), 105 deletions(-) diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 33d8eacc75..466c7e60ba 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -1684,7 +1684,6 @@ static int dav_fs_find_prop(const char *ns_uri, const char *name) static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, int propid, int insvalue, - const int *ns_map, ap_text_header *phdr) { const char *value; @@ -1784,8 +1783,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, /* assert: scan->name != NULL */ - /* map our NS index into a global NS index */ - /* ns = ns_map[scan->ns]; */ + /* map our namespace into a global NS index */ ns = dav_get_liveprop_ns_index(dav_fs_namespace_uris[scan->ns]); /* DBG3("FS: inserting lp%d:%s (local %d)", ns, scan->name, scan->ns); */ @@ -1808,7 +1806,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, } static void dav_fs_insert_all(const dav_resource *resource, int insvalue, - const int *ns_map, ap_text_header *phdr) + ap_text_header *phdr) { if (!resource->exists) { /* a lock-null resource */ @@ -1821,13 +1819,13 @@ static void dav_fs_insert_all(const dav_resource *resource, int insvalue, } (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_creationdate, - insvalue, ns_map, phdr); + insvalue, phdr); (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getcontentlength, - insvalue, ns_map, phdr); + insvalue, phdr); (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getlastmodified, - insvalue, ns_map, phdr); + insvalue, phdr); (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getetag, - insvalue, ns_map, phdr); + insvalue, phdr); #ifndef WIN32 /* @@ -1836,7 +1834,7 @@ static void dav_fs_insert_all(const dav_resource *resource, int insvalue, ** well not even call it. */ (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable, - insvalue, ns_map, phdr); + insvalue, phdr); #endif /* ### we know the others aren't defined as liveprops */ @@ -2025,8 +2023,7 @@ static const dav_dyn_provider dav_dyn_providers_fs[] = { DAV_FS_PROVIDER_ID, DAV_DYN_TYPE_LIVEPROP, - &dav_hooks_liveprop_fs, - NULL + &dav_hooks_liveprop_fs }, /* must always be last */ @@ -2039,13 +2036,6 @@ const dav_dyn_module dav_dyn_module_default = DAV_DYN_VERSION, "filesystem", - NULL, /* module_open */ - NULL, /* module_close */ - NULL, /* dir_open */ - NULL, /* dir_param */ - NULL, /* dir_merge */ - NULL, /* dir_close */ - dav_dyn_providers_fs }; diff --git a/modules/dav/main/config.m4 b/modules/dav/main/config.m4 index 2ad6967447..7ea2654339 100644 --- a/modules/dav/main/config.m4 +++ b/modules/dav/main/config.m4 @@ -3,7 +3,7 @@ dnl modules enabled in this directory by default APACHE_MODPATH_INIT(dav/main) APACHE_MODULE(dav, WebDAV protocol handling, - mod_dav.lo props.lo util.lo util_lock.lo opaquelock.lo dav_dyn.lo + mod_dav.lo props.lo util.lo util_lock.lo opaquelock.lo liveprop.lo , , no) diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 33dd8f951c..b2b35d4ae7 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -135,40 +135,22 @@ extern module MODULE_VAR_EXPORT dav_module; /* copy a module's providers into our per-directory configuration state */ static void dav_copy_providers(ap_pool_t *p, const char *name, dav_dir_conf *conf) { + extern const dav_dyn_module dav_dyn_module_default; + const dav_dyn_module *mod; const dav_dyn_provider *provider; - dav_dyn_hooks hooks; - void *ctx; - - mod = dav_find_module(name); - /* ### if NULL? need to error out somehow... */ - - /* Set hooks for any providers in the module */ - ctx = dav_prepare_scan(p, mod); - if (ctx == NULL) { - /* ### how to signal an error? */ - return; - } + dav_dyn_hooks *ddh; - while (!dav_scan_providers(ctx, &provider, &hooks)) { + /* ### just hard-code this stuff for now */ - switch (provider->type) { + /* mod = dav_find_module(name); */ + mod = &dav_dyn_module_default; - case DAV_DYN_TYPE_LIVEPROP: - { - dav_dyn_hooks *ddh = ap_palloc(p, sizeof(*ddh)); + provider = mod->providers; - *ddh = hooks; - ddh->next = conf->liveprop; - conf->liveprop = ddh; - break; - } - - default: - /* ### need to error out somehow... */ - break; - } - } + ddh = ap_pcalloc(p, sizeof(*ddh)); + ddh->hooks = provider->hooks; + conf->liveprop = ddh; } static void dav_init_handler(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp, @@ -177,8 +159,6 @@ static void dav_init_handler(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp, /* DBG0("dav_init_handler"); */ ap_add_version_component(p, "DAV/" DAV_VERSION); - - dav_process_builtin_modules(p); } static void *dav_create_server_config(ap_pool_t *p, server_rec *s) diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index b1437d5c8e..0fa0a9d96b 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -385,11 +385,14 @@ ap_xml_elem *dav_find_child(const ap_xml_elem *elem, const char *tagname); /* ### docco ... */ +/* ### add a repository friendly-name to the get_resource */ AP_DECLARE_HOOK(int, get_resource, (request_rec *r, const char *root_dir, const char *workspace)) + 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)) @@ -423,23 +426,6 @@ void dav_add_all_liveprop_xmlns(ap_pool_t *p, ap_text_header *phdr); /* ### docco goes here... */ -/* -** This structure is used to define the runtime, per-directory/location -** operating context for a single provider. -*/ -typedef struct -{ - int id; /* provider ID */ - - void *m_context; /* module-level context (i.e. managed globals) */ - - void *d_context; /* per-directory context */ - ap_table_t *d_params; /* per-directory DAV config parameters */ - - int *ns_map; /* for LIVEPROP, map provider URI to global URI */ - -} dav_dyn_context; - /* ** This structure is used to specify a set of hooks and its associated ** context, on a per-directory/location basis. @@ -450,7 +436,6 @@ typedef struct */ typedef struct dav_dyn_hooks { - dav_dyn_context ctx; /* context for this set of hooks */ const void *hooks; /* the type-specific hooks */ struct dav_dyn_hooks *next; /* next set of hooks, if applicable */ @@ -499,11 +484,9 @@ typedef struct dav_dyn_provider int type; /* provider's functionality type */ const void *hooks; /* pointer to type-specific hooks */ - int (*is_active)(dav_dyn_context *ctx, int id); - } dav_dyn_provider; -#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL, NULL } +#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL } /* ** This structure defines a module (a set of providers). @@ -534,39 +517,10 @@ typedef struct const char *name; /* friendly name */ - int (*module_open)(dav_dyn_context *ctx); - int (*module_close)(dav_dyn_context *ctx); - - int (*dir_open)(dav_dyn_context *ctx); - int (*dir_param)(dav_dyn_context *ctx, const char *param_name, - const char *param_value); - int (*dir_merge)(dav_dyn_context *base, dav_dyn_context *overrides, - dav_dyn_context *result); - int (*dir_close)(dav_dyn_context *ctx); - const dav_dyn_provider *providers; /* providers in this module */ } dav_dyn_module; -int dav_load_module(const char *name, const char *module_sym, - const char *filename); -const dav_dyn_module *dav_find_module(const char *name); - -/* -** Various management functions. -** -** NOTE: the pool should be the "configuration pool" -*/ -void dav_process_builtin_modules(ap_pool_t *p); -void dav_process_module(ap_pool_t *p, const dav_dyn_module *mod); - -int * dav_collect_liveprop_uris(ap_pool_t *p, const dav_hooks_liveprop *hooks); - -void *dav_prepare_scan(ap_pool_t *p, const dav_dyn_module *mod); -int dav_scan_providers(void *ctx, - const dav_dyn_provider **provider, - dav_dyn_hooks *output); - /* ### deprecated */ #define DAV_GET_HOOKS_PROPDB(r) dav_get_propdb_hooks(r) #define DAV_GET_HOOKS_LOCKS(r) dav_get_lock_hooks(r) @@ -711,7 +665,7 @@ struct dav_hooks_liveprop */ dav_prop_insert (*insert_prop)(const dav_resource *resource, int propid, int insvalue, - const int *ns_map, ap_text_header *phdr); + ap_text_header *phdr); /* ** Insert all known/defined property names (and values). This is @@ -719,7 +673,7 @@ struct dav_hooks_liveprop ** rather than specific, individual properties. */ void (*insert_all)(const dav_resource *resource, int insvalue, - const int *ns_map, ap_text_header *phdr); + ap_text_header *phdr); /* ** Determine whether a given property is writeable. @@ -1714,7 +1668,6 @@ ap_size_t dav_get_limit_xml_body(const request_rec *r); typedef struct { int propid; /* live property ID */ const dav_hooks_liveprop *provider; /* the provider defining this prop */ - const int *ns_map; /* ns map for this provider */ } dav_elem_private; #ifdef __cplusplus diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c index 2d42f6b093..6db4719c8a 100644 --- a/modules/dav/main/props.c +++ b/modules/dav/main/props.c @@ -353,7 +353,6 @@ static void dav_find_liveprop(dav_propdb *propdb, ap_xml_elem *elem) if (propid != 0) { priv->propid = propid; priv->provider = DAV_AS_HOOKS_LIVEPROP(ddh); - priv->ns_map = ddh->ctx.ns_map; return; } } @@ -568,7 +567,7 @@ static dav_error * dav_insert_liveprop(dav_propdb *propdb, /* ask the provider (that defined this prop) to insert the prop */ pi = (*priv->provider->insert_prop)(propdb->resource, priv->propid, - getvals, priv->ns_map, phdr); + getvals, phdr); #if DAV_DEBUG if (pi == DAV_PROP_INSERT_NOTME) { /* ### the provider should have returned NOTDEF, at least */ @@ -1127,7 +1126,6 @@ dav_get_props_result dav_get_allprops(dav_propdb *propdb, int getvals) /* ask the liveprop providers to insert their properties */ for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) { (*DAV_AS_HOOKS_LIVEPROP(ddh)->insert_all)(propdb->resource, getvals, - ddh->ctx.ns_map, &hdr); } -- 2.50.1