You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by gs...@locus.apache.org on 2000/10/06 14:49:21 UTC
cvs commit: apache-2.0/src/modules/dav/main config.m4 mod_dav.c dav_opaquelock.h opaquelock.c
gstein 00/10/06 05:49:21
Modified: src/modules/dav/fs lock.c
src/modules/dav/main config.m4 mod_dav.c
Removed: src/modules/dav/main dav_opaquelock.h opaquelock.c
Log:
*) convert fs/lock.c to use APR UUIDs for the opaque locktokens.
*) blow away opaquelock.c and dav_opaquelock.h since direct use of APR UUIDs
is quite easy.
*) toss the uuid_state from the per-server config in mod_dav.c
Revision Changes Path
1.9 +33 -36 apache-2.0/src/modules/dav/fs/lock.c
Index: lock.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/lock.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- lock.c 2000/08/08 20:03:50 1.8
+++ lock.c 2000/10/06 12:49:20 1.9
@@ -60,9 +60,9 @@
#include "http_log.h"
#include "apr_file_io.h"
#include "apr_strings.h"
+#include "apr_uuid.h"
#include "mod_dav.h"
-#include "dav_opaquelock.h"
#include "repos.h"
@@ -88,20 +88,20 @@
** VALUE
**
** The value consists of a list of elements.
-** DIRECT LOCK: [char (DAV_LOCK_DIRECT),
-** char (dav_lock_scope),
-** char (dav_lock_type),
-** int depth,
-** time_t expires,
-** uuid_t locktoken,
-** char[] owner,
-** char[] auth_user]
-**
-** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT),
-** uuid_t locktoken,
-** time_t expires,
-** int key_size,
-** char[] key]
+** DIRECT LOCK: [char (DAV_LOCK_DIRECT),
+** char (dav_lock_scope),
+** char (dav_lock_type),
+** int depth,
+** time_t expires,
+** apr_uuid_t locktoken,
+** char[] owner,
+** char[] auth_user]
+**
+** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT),
+** apr_uuid_t locktoken,
+** time_t expires,
+** int key_size,
+** char[] key]
** The key is to the collection lock that resulted in this indirect lock
*/
@@ -128,8 +128,10 @@
** Use the opaquelock scheme for locktokens
*/
struct dav_locktoken {
- uuid_t uuid;
+ apr_uuid_t uuid;
};
+#define dav_compare_locktoken(plt1, plt2) \
+ memcmp(&(plt1)->uuid, &(plt2)->uuid, sizeof((plt1)->uuid))
/* #################################################################
@@ -181,13 +183,13 @@
** prefix + Fixed length + lock token + 2 strings + 2 nulls (one for each string)
*/
#define dav_size_direct(a) (1 + sizeof(dav_lock_discovery_fixed) \
- + sizeof(uuid_t) \
+ + sizeof(apr_uuid_t) \
+ ((a)->owner ? strlen((a)->owner) : 0) \
+ ((a)->auth_user ? strlen((a)->auth_user) : 0) \
+ 2)
/* Stored indirect lock info - lock token and dav_datum */
-#define dav_size_indirect(a) (1 + sizeof(uuid_t) \
+#define dav_size_indirect(a) (1 + sizeof(apr_uuid_t) \
+ sizeof(time_t) \
+ sizeof(int) + (a)->key.dsize)
@@ -254,8 +256,7 @@
if (locktoken == NULL) {
comb->pub.locktoken = &comb->token;
- dav_create_opaquelocktoken(dav_get_uuid_state(lockdb->info->r),
- &comb->token.uuid);
+ apr_get_uuid(&comb->token.uuid);
}
else {
comb->pub.locktoken = locktoken;
@@ -285,7 +286,7 @@
char_token += 16;
locktoken = apr_pcalloc(p, sizeof(*locktoken));
- if (dav_parse_opaquelocktoken(char_token, &locktoken->uuid)) {
+ if (apr_parse_uuid(&locktoken->uuid, char_token)) {
return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN,
"The opaquelocktoken has an incorrect format "
"and could not be parsed.");
@@ -304,8 +305,10 @@
apr_pool_t *p,
const dav_locktoken *locktoken)
{
- const char *uuid_token = dav_format_opaquelocktoken(p, &locktoken->uuid);
- return apr_pstrcat(p, "opaquelocktoken:", uuid_token, NULL);
+ char buf[APR_UUID_FORMATTED_LENGTH + 1];
+
+ apr_format_uuid(buf, &locktoken->uuid);
+ return apr_pstrcat(p, "opaquelocktoken:", buf, NULL);
}
/*
@@ -317,7 +320,7 @@
const dav_locktoken *lt1,
const dav_locktoken *lt2)
{
- return dav_compare_opaquelocktoken(lt1->uuid, lt2->uuid);
+ return dav_compare_locktoken(lt1, lt2);
}
/*
@@ -746,8 +749,7 @@
}
for (; dir != NULL; dir = dir->next) {
- if (!dav_compare_opaquelocktoken(indirect->locktoken->uuid,
- dir->locktoken->uuid)) {
+ if (!dav_compare_locktoken(indirect->locktoken, dir->locktoken)) {
*direct = dir;
return NULL;
}
@@ -1174,8 +1176,7 @@
}
for (; dp != NULL; dp = dp->next) {
- if (!dav_compare_opaquelocktoken(locktoken->uuid,
- dp->locktoken->uuid)) {
+ if (!dav_compare_locktoken(locktoken, dp->locktoken)) {
*lock = dav_fs_alloc_lock(lockdb, key, locktoken);
(*lock)->is_locknull = !resource->exists;
(*lock)->scope = dp->f.scope;
@@ -1189,8 +1190,7 @@
}
for (; ip != NULL; ip = ip->next) {
- if (!dav_compare_opaquelocktoken(locktoken->uuid,
- ip->locktoken->uuid)) {
+ if (!dav_compare_locktoken(locktoken, ip->locktoken)) {
*lock = dav_fs_alloc_lock(lockdb, ip->key, locktoken);
(*lock)->is_locknull = !resource->exists;
@@ -1356,8 +1356,7 @@
}
for (dp = dh; dp != NULL; dp = dp->next) {
- if (dav_compare_opaquelocktoken(locktoken->uuid,
- dp->locktoken->uuid) == 0) {
+ if (dav_compare_locktoken(locktoken, dp->locktoken) == 0) {
if (dprev)
dprev->next = dp->next;
else
@@ -1367,8 +1366,7 @@
}
for (ip = ih; ip != NULL; ip = ip->next) {
- if (dav_compare_opaquelocktoken(locktoken->uuid,
- ip->locktoken->uuid) == 0) {
+ if (dav_compare_locktoken(locktoken, ip->locktoken) == 0) {
if (iprev)
iprev->next = ip->next;
else
@@ -1413,8 +1411,7 @@
int dirty = 0;
for (; ltl != NULL; ltl = ltl->next) {
- if (dav_compare_opaquelocktoken(dp->locktoken->uuid,
- ltl->locktoken->uuid) == 0)
+ if (dav_compare_locktoken(dp->locktoken, ltl->locktoken) == 0)
{
dp->f.timeout = new_time;
dirty = 1;
1.11 +1 -1 apache-2.0/src/modules/dav/main/config.m4
Index: config.m4
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/dav/main/config.m4,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- config.m4 2000/09/09 23:23:41 1.10
+++ config.m4 2000/10/06 12:49:20 1.11
@@ -2,7 +2,7 @@
APACHE_MODPATH_INIT(dav/main)
-dav_objects="mod_dav.lo props.lo util.lo util_lock.lo opaquelock.lo liveprop.lo providers.lo"
+dav_objects="mod_dav.lo props.lo util.lo util_lock.lo liveprop.lo providers.lo"
APACHE_MODULE(dav, WebDAV protocol handling, $dav_objects, , no)
1.21 +5 -19 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mod_dav.c 2000/09/09 23:23:41 1.20
+++ mod_dav.c 2000/10/06 12:49:21 1.21
@@ -92,9 +92,7 @@
#include "mod_dav.h"
-#include "dav_opaquelock.h"
-
/* ### what is the best way to set this? */
#define DAV_DEFAULT_PROVIDER "filesystem"
@@ -118,7 +116,7 @@
/* per-server configuration */
typedef struct {
- uuid_state st; /* UUID state for opaquelocktoken */
+ int unused;
} dav_server_conf;
@@ -143,24 +141,21 @@
newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf));
- dav_create_uuid_state(&newconf->st);
+ /* ### this isn't used at the moment... */
return newconf;
}
static void *dav_merge_server_config(apr_pool_t *p, void *base, void *overrides)
{
+#if 0
dav_server_conf *child = overrides;
+#endif
dav_server_conf *newconf;
newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf));
- /* ### hmm. we should share the uuid state rather than copy it. if we
- ### do another merge, then we'll just get the old one, rather than
- ### an updated state.
- ### of course... the UUID generation should move into APR
- */
- memcpy(&newconf->st, &child->st, sizeof(newconf->st));
+ /* ### nothing to merge right now... */
return newconf;
}
@@ -211,15 +206,6 @@
APR_OVERLAP_TABLES_SET);
return newconf;
-}
-
-uuid_state *dav_get_uuid_state(const request_rec *r)
-{
- dav_server_conf *conf;
-
- conf = ap_get_module_config(r->server->module_config, &dav_module);
-
- return &conf->st;
}
apr_table_t *dav_get_dir_params(const request_rec *r)