Add support for mirroring symlinks and hardlinks.
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 5 Jul 2005 06:20:07 +0000 (06:20 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 5 Jul 2005 06:20:07 +0000 (06:20 +0000)
sbin/jscan/dump_mirror.c
sbin/jscan/jattr.h
sbin/jscan/subs.c

index 469d67f..59f1a18 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/jscan/dump_mirror.c,v 1.3 2005/07/05 04:08:07 dillon Exp $
+ * $DragonFly: src/sbin/jscan/dump_mirror.c,v 1.4 2005/07/05 06:20:07 dillon Exp $
  */
 
 #include "jscan.h"
@@ -304,6 +304,9 @@ dump_mirror_payload(int16_t rectype, struct jstream *js, off_t off,
     case JLEAF_ABORT:
        break;
     case JLEAF_SYMLINKDATA:
+       jattr->symlinkdata = dupdatastr(buf, recsize);
+       jattr->symlinklen = recsize;
+       break;
     case JLEAF_FILEDATA:
        if ((data = jattr->last_data) == NULL) {
                jattr->data.off = off;
@@ -459,8 +462,14 @@ again:
     case JTYPE_MKNOD:
        break;
     case JTYPE_LINK:
+       if (jattr->pathref && jattr->path1) {
+           link(jattr->pathref, jattr->path1);
+       }
        break;
     case JTYPE_SYMLINK:
+       if (jattr->symlinkdata && jattr->path1) {
+           symlink(jattr->symlinkdata, jattr->path1);
+       }
        break;
     case JTYPE_WHITEOUT:
        break;
index f824915..6434f53 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/jscan/jattr.h,v 1.2 2005/07/05 02:38:34 dillon Exp $
+ * $DragonFly: src/sbin/jscan/jattr.h,v 1.3 2005/07/05 06:20:07 dillon Exp $
  */
 
 struct jattr {
@@ -49,6 +49,8 @@ struct jattr {
     char *comm;
     char *attrname;
     char *pathref;
+    char *symlinkdata;
+    int symlinklen;
     struct jattr_data {
        struct jattr_data *next;
        off_t off;
index 00fb3f6..48acbf6 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/jscan/subs.c,v 1.4 2005/07/05 02:38:34 dillon Exp $
+ * $DragonFly: src/sbin/jscan/subs.c,v 1.5 2005/07/05 06:20:07 dillon Exp $
  */
 
 #include "jscan.h"
@@ -250,6 +250,8 @@ jattr_reset(struct jattr *jattr)
        free(jattr->attrname);
     if (jattr->pathref)
        free(jattr->pathref);
+    if (jattr->symlinkdata)
+       free(jattr->symlinkdata);
     while ((data = jattr->data.next) != NULL) {
        jattr->data.next = data->next;
        free(data);