poldek: poldek/vfile/libvfile.sym, poldek/vfile/vfile.c, poldek/vf...

mis mis at pld-linux.org
Sun Aug 20 16:00:00 CEST 2006


Author: mis                          Date: Sun Aug 20 14:00:00 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- +vf_cachepath() and few cleanups

---- Files affected:
poldek/poldek/vfile:
   libvfile.sym (1.2 -> 1.3) , vfile.c (1.67 -> 1.68) , vfile.h (1.46 -> 1.47) , vflock.c (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: poldek/poldek/vfile/libvfile.sym
diff -u poldek/poldek/vfile/libvfile.sym:1.2 poldek/poldek/vfile/libvfile.sym:1.3
--- poldek/poldek/vfile/libvfile.sym:1.2	Tue Sep 28 18:43:01 2004
+++ poldek/poldek/vfile/libvfile.sym	Sun Aug 20 15:59:55 2006
@@ -3,6 +3,7 @@
 p_st_destroy
 p_st_init
 p_wait
+vf_cachepath
 vf_cleanpath
 vf_decompressable
 vf_extcompress

================================================================
Index: poldek/poldek/vfile/vfile.c
diff -u poldek/poldek/vfile/vfile.c:1.67 poldek/poldek/vfile/vfile.c:1.68
--- poldek/poldek/vfile/vfile.c:1.67	Sun Jul  9 16:46:45 2006
+++ poldek/poldek/vfile/vfile.c	Sun Aug 20 15:59:55 2006
@@ -596,7 +596,7 @@
     int n;
     
     n = n_snprintf(path, size, "%s/", vfile_conf.cachedir);
-    return vf_url_as_path(&path[n], size - n, url);
+    return n + vf_url_as_path(&path[n], size - n, url);
 }
 
 int vf_localdirpath(char *path, size_t size, const char *url) 
@@ -604,9 +604,28 @@
     int n;
     
     n = n_snprintf(path, size, "%s/", vfile_conf.cachedir);
-    return vf_url_as_dirpath(&path[n], size - n, url);
+    return n + vf_url_as_dirpath(&path[n], size - n, url);
 }
 
+
+int vf_cachepath(char *path, size_t size, const char *ofpath)
+{
+    int n, len;
+    
+    len = strlen(vfile_conf.cachedir);
+
+    n_assert(strlen(ofpath) > 0);
+    n_assert(ofpath[strlen(ofpath) - 1] != '/'); /* not a dir */
+                           
+    if (strncmp(ofpath, vfile_conf.cachedir, len) == 0) { 
+        n = n_snprintf(path, size, "%s", ofpath);
+        
+    } else {
+        n = vf_localpath(path, size, ofpath);
+    }
+
+    return n;
+}
 
 int vf_localunlink(const char *path) 
 {

================================================================
Index: poldek/poldek/vfile/vfile.h
diff -u poldek/poldek/vfile/vfile.h:1.46 poldek/poldek/vfile/vfile.h:1.47
--- poldek/poldek/vfile/vfile.h:1.46	Fri Oct  7 13:24:55 2005
+++ poldek/poldek/vfile/vfile.h	Sun Aug 20 15:59:55 2006
@@ -188,13 +188,16 @@
 int vf_mkdir(const char *path);
 int vf_unlink(const char *path);
 
-/* mkdir under cachedir */
+/* mkdir under cache dirctory */
 int vf_mksubdir(char *path, int size, const char *dirpath);
 
 /* url to local path */
 int vf_localpath(char *path, size_t size, const char *url);
 int vf_localdirpath(char *path, size_t size, const char *url);
 
+/* ofpath to path under cache dirctory  */
+int vf_cachepath(char *path, size_t size, const char *ofpath);
+
 /* unlink local copy */
 int vf_localunlink(const char *path);
 
@@ -212,6 +215,8 @@
 
 struct vflock *vf_lockdir(const char *path);
 void vf_lock_release(struct vflock *vflock);
+
+/* create directory and lock it */
 struct vflock *vf_lock_mkdir(const char *path);
 
 #endif /* POLDEK_VFILE_H */

================================================================
Index: poldek/poldek/vfile/vflock.c
diff -u poldek/poldek/vfile/vflock.c:1.10 poldek/poldek/vfile/vflock.c:1.11
--- poldek/poldek/vfile/vflock.c:1.10	Fri Oct 21 20:57:10 2005
+++ poldek/poldek/vfile/vflock.c	Sun Aug 20 15:59:55 2006
@@ -168,8 +168,6 @@
         return vf_lockdir(path);
 
     DBGF("** vf_lock_mkdir %s\n", path);
-    if (strcmp(path, "/home/mis") == 0)
-        n_assert(0);
     
     n_snprintf(tmp, sizeof(tmp), "%s", path);
     n_basedirnam(tmp, &dn, &bn);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/vfile/libvfile.sym?r1=1.2&r2=1.3&f=u
    http://cvs.pld-linux.org/poldek/poldek/vfile/vfile.c?r1=1.67&r2=1.68&f=u
    http://cvs.pld-linux.org/poldek/poldek/vfile/vfile.h?r1=1.46&r2=1.47&f=u
    http://cvs.pld-linux.org/poldek/poldek/vfile/vflock.c?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list