[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: davfs patch to work with subversion.

From: Alan Knowles <alan_at_akbkhome.com>
Date: 2003-04-17 10:22:30 CEST

Attached is a go at making this work

mount.webdav ... ... -ousername=xxx,password=xx,nolocks

seems to work ok here.

Regards
Alan

Sung Kim wrote:

>Hello,
>
>I appreciate your work. Would you like to add a compile option or davfsd
>running option to apply your patch (disable the lock function)? Then I'll
>commit your patch and put some note on the davfs homepage.
>
>--
>Sung Kim, http://www.cse.ucsc.edu
>
>-----Original Message-----
>From: Alan Knowles [mailto:alan@akbkhome.com]
>Sent: Wednesday, April 16, 2003 2:57 AM
>To: dev@subversion.tigris.org
>Cc: hunkim@users.sourceforge.net
>Subject: davfs patch to work with subversion.
>
>Below is a short patch to davfs2-0.2.1 which disables locking calls.
>I've cc'd davfs's author (hopefully the right address) - as it would be
>nice to get some kind of ,mount option for this, rather than this cheesy
> hack.
>
>as somebody mentioned on irc, the other alternative for this is using
>lufs + gnome-vfs.
>
>
>--- davfs2-0.2.1/src/webdav.c 2002-10-14 08:34:02.000000000 +0800
>+++ webdav.c 2003-04-16 17:41:17.000000000 +0800
>@@ -604,7 +604,7 @@
> int dav_lock(const char *name) {
> char *uri = resolve_path(path, name, 0);
> struct ne_lock *lock;
>-
>+ return NE_OK;
> /* Let's lock the resource */
> lock = ne_lock_create();
> lock->depth = NE_DEPTH_ZERO;
>@@ -652,9 +652,9 @@
>
> /* Lst's get the lock */
> server.path = (char *)uri; /* Change path */
>- lock = ne_lockstore_findbyuri(lock_store, &server);
>+ /* lock = ne_lockstore_findbyuri(lock_store, &server); */
> NE_FREE(uri);
>-
>+ /*
> if (!lock) {
> DBG0("Shuld be locked, before open\n");
> return dav_set_errno();
>@@ -667,7 +667,7 @@
>
> ne_lockstore_remove(lock_store, lock);
> ne_lock_destroy(lock);
>-
>+ */
> return ret;
> }
>
>
>
>
>
>

-- 
Can you help out? 
Need Consulting Services or Know of a Job?
http://www.akbkhome.com

diff -u -r davfs2-0.2.1/src/davfsd.c davfs2-0.2.1_withlockopt/src/davfsd.c
--- davfs2-0.2.1/src/davfsd.c 2002-10-14 08:34:02.000000000 +0800
+++ davfs2-0.2.1_withlockopt/src/davfsd.c 2003-04-17 16:15:02.000000000 +0800
@@ -66,6 +66,9 @@
 
 static int count = 0;
 
+/* use locks - default yes */
+static int davfs_locks = 1;
+
 /* default stat */
 struct stat generic_stat = { 0 /* dev */ , 0 /* pad */ ,
                              0 /* inode */ , S_IFREG | 0666 /* mode */ ,
@@ -541,7 +544,7 @@
         /* FIXME : Do we really need to check it? */
         if (v->has_changed) {
             DBG1("saving the file %s ", v->local_name);
- return_value = dav_put_unlock(v->real_name, v->local_name);
+ return_value = dav_put_unlock(v->real_name, v->local_name, davfs_locks);
         }
         
         if (v->is_dir==1) {
@@ -657,7 +660,7 @@
     else {
         /* If is is write or trunc (NULL lock) */
         if (flags & C_O_WRITE) {
- if (dav_lock(name)) { /* Lock fail?? */
+ if (dav_lock(name, davfs_locks)) { /* Lock fail?? */
                 DBG1("LOCK failed: %s\n", name);
                 out_buf->oh.result = dav_get_errno();
                 return NULL;
@@ -758,6 +761,7 @@
     /* Set mount point for signal out */
     davfs_dev = ne_strdup(mopt.dev); // TODO: free this somewhere
     davfs_mpoint = ne_strdup(mopt.mpoint); //TODO: free this somewhere
+ davfs_locks = mopt.locks;
     
     setvbuf(stdout, NULL, _IONBF, 0);
 
diff -u -r davfs2-0.2.1/src/util.c davfs2-0.2.1_withlockopt/src/util.c
--- davfs2-0.2.1/src/util.c 2002-10-14 08:34:02.000000000 +0800
+++ davfs2-0.2.1_withlockopt/src/util.c 2003-04-17 16:05:52.000000000 +0800
@@ -85,6 +85,12 @@
         *value++ = 0;
     
     /* Ignore option without value */
+
+ if(!strcmp(name, "nolock")) {
+ mopt->locks = 0;
+ return 1;
+ }
+
     if(value==NULL)
         return 0;
     
@@ -107,7 +113,7 @@
         mopt->uid = atoi(value);
         return 1;
     }
-
+
     if(!strcmp(name, "mode")) {
         /* Length should be three */
         if(strlen(value)==3)
diff -u -r davfs2-0.2.1/src/util.h davfs2-0.2.1_withlockopt/src/util.h
--- davfs2-0.2.1/src/util.h 2002-10-14 08:34:02.000000000 +0800
+++ davfs2-0.2.1_withlockopt/src/util.h 2003-04-17 16:01:02.000000000 +0800
@@ -72,6 +72,7 @@
     mode_t mode; /* default mode */
     char *option; /* Have all option data */
     int merr; /* mount error */
+ int locks; /* use locks - default = 1 (yes) */
 } dav_mount_opt;
 
 /* Delete the item from /etc/mtab */
diff -u -r davfs2-0.2.1/src/webdav.c davfs2-0.2.1_withlockopt/src/webdav.c
--- davfs2-0.2.1/src/webdav.c 2002-10-14 08:34:02.000000000 +0800
+++ davfs2-0.2.1_withlockopt/src/webdav.c 2003-04-17 16:17:28.000000000 +0800
@@ -601,10 +601,12 @@
 }
 
 /* Lock the resource for write and save the lock to lock_store */
-int dav_lock(const char *name) {
+int dav_lock(const char *name,int use_locks) {
     char *uri = resolve_path(path, name, 0);
     struct ne_lock *lock;
-
+ if (!use_locks) {
+ return NE_OK;
+ }
     /* Let's lock the resource */
     lock = ne_lock_create();
     lock->depth = NE_DEPTH_ZERO;
@@ -631,7 +633,7 @@
 /* Get localfile and save it to the server
  * It should be locked
  */
-int dav_put_unlock(const char *name, const char *fname) {
+int dav_put_unlock(const char *name, const char *fname, int use_locks) {
     int fd;
     int ret = NE_OK;
     char *uri = resolve_path(path, name, 0);
@@ -649,7 +651,10 @@
         ret = -1;
     }
     close(fd);
-
+ if (!use_locks) {
+ NE_FREE(uri);
+ return ret;
+ }
     /* Lst's get the lock */
     server.path = (char *)uri; /* Change path */
     lock = ne_lockstore_findbyuri(lock_store, &server);
diff -u -r davfs2-0.2.1/src/webdav.h davfs2-0.2.1_withlockopt/src/webdav.h
--- davfs2-0.2.1/src/webdav.h 2002-10-14 08:34:02.000000000 +0800
+++ davfs2-0.2.1_withlockopt/src/webdav.h 2003-04-17 16:18:04.000000000 +0800
@@ -93,10 +93,10 @@
 
 
 /* Lock the file */
-int dav_lock(const char *name);
+int dav_lock(const char *name, int use_locks);
 
 /* Get localfile and save it to the server */
-int dav_put_unlock(const char *name, const char *fname);
+int dav_put_unlock(const char *name, const char *fname, int use_locks);
 
 /* let's get stat */
 int dav_stat(const char *name, struct stat *st,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 17 10:20:46 2003

This is an archived mail posted to the Subversion Dev mailing list.