switch to a 60 bit hash
[httpd-crcsyncproxy.git] / modules / dav / fs / mod_dav_fs.c
blobdfd190b38e394ae849c3de569f1ddf07d2800954
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "httpd.h"
18 #include "http_config.h"
19 #include "apr_strings.h"
21 #include "mod_dav.h"
22 #include "repos.h"
24 /* per-server configuration */
25 typedef struct {
26 const char *lockdb_path;
28 } dav_fs_server_conf;
30 extern module AP_MODULE_DECLARE_DATA dav_fs_module;
32 const char *dav_get_lockdb_path(const request_rec *r)
34 dav_fs_server_conf *conf;
36 conf = ap_get_module_config(r->server->module_config, &dav_fs_module);
37 return conf->lockdb_path;
40 static void *dav_fs_create_server_config(apr_pool_t *p, server_rec *s)
42 return apr_pcalloc(p, sizeof(dav_fs_server_conf));
45 static void *dav_fs_merge_server_config(apr_pool_t *p,
46 void *base, void *overrides)
48 dav_fs_server_conf *parent = base;
49 dav_fs_server_conf *child = overrides;
50 dav_fs_server_conf *newconf;
52 newconf = apr_pcalloc(p, sizeof(*newconf));
54 newconf->lockdb_path =
55 child->lockdb_path ? child->lockdb_path : parent->lockdb_path;
57 return newconf;
61 * Command handler for the DAVLockDB directive, which is TAKE1
63 static const char *dav_fs_cmd_davlockdb(cmd_parms *cmd, void *config,
64 const char *arg1)
66 dav_fs_server_conf *conf;
67 conf = ap_get_module_config(cmd->server->module_config,
68 &dav_fs_module);
69 conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
71 if (!conf->lockdb_path) {
72 return apr_pstrcat(cmd->pool, "Invalid DAVLockDB path ",
73 arg1, NULL);
76 return NULL;
79 static const command_rec dav_fs_cmds[] =
81 /* per server */
82 AP_INIT_TAKE1("DAVLockDB", dav_fs_cmd_davlockdb, NULL, RSRC_CONF,
83 "specify a lock database"),
85 { NULL }
88 static void register_hooks(apr_pool_t *p)
90 dav_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
91 APR_HOOK_MIDDLE);
92 dav_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, APR_HOOK_MIDDLE);
93 dav_hook_insert_all_liveprops(dav_fs_insert_all_liveprops, NULL, NULL,
94 APR_HOOK_MIDDLE);
96 dav_fs_register(p);
99 module AP_MODULE_DECLARE_DATA dav_fs_module =
101 STANDARD20_MODULE_STUFF,
102 NULL, /* dir config creater */
103 NULL, /* dir merger --- default is to override */
104 dav_fs_create_server_config, /* server config */
105 dav_fs_merge_server_config, /* merge server config */
106 dav_fs_cmds, /* command table */
107 register_hooks, /* register hooks */