You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/07/08 17:54:59 UTC

[4/7] incubator-mynewt-core git commit: Legacy NFFS version support to standalone mode of ffs2native

Legacy NFFS version support to standalone mode of ffs2native

Standalone mode (-s) takes an NFFS flash image file and prints the contents
without regards to a specific flash area layout. The layout is determined from
parsing the input file and this allows NFFS format image files from
any device to be printed, regardless of the HW flash layout.

This change adds support for V0 layouts - the version is automatically
detected from parsing the data structures in the image.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/27a8888f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/27a8888f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/27a8888f

Branch: refs/heads/develop
Commit: 27a8888f460493e3a1f7483e803414c91207c834
Parents: f9ef568
Author: Peter Snyder <gi...@peterfs.com>
Authored: Wed Jun 29 14:04:01 2016 -0700
Committer: Peter Snyder <gi...@peterfs.com>
Committed: Wed Jun 29 14:04:01 2016 -0700

----------------------------------------------------------------------
 apps/ffs2native/src/main.c | 370 ++++++++++++++++++++--------------------
 1 file changed, 183 insertions(+), 187 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27a8888f/apps/ffs2native/src/main.c
----------------------------------------------------------------------
diff --git a/apps/ffs2native/src/main.c b/apps/ffs2native/src/main.c
index 2b42159..cfa4688 100644
--- a/apps/ffs2native/src/main.c
+++ b/apps/ffs2native/src/main.c
@@ -50,12 +50,12 @@ char *file_flash_area;
 size_t file_flash_size;
 int file_scratch_idx;
 
-#define MAX_AREAS	16
+#define MAX_AREAS    16
 static struct nffs_area_desc area_descs[MAX_AREAS];
 int nffs_version;
 
 /** On-disk representation of a version 0 inode (file or directory). */
-struct nffs_disk_inodeV0 {
+struct nffs_disk_V0inode {
     uint32_t ndi_magic;         /* NFFS_INODE_MAGIC */
     uint32_t ndi_id;            /* Unique object ID. */
     uint32_t ndi_seq;           /* Sequence number; greater supersedes
@@ -66,10 +66,10 @@ struct nffs_disk_inodeV0 {
     uint16_t ndi_crc16;         /* Covers rest of header and filename. */
     /* Followed by filename. */
 };
-#define NFFS_DISK_INODEV0_OFFSET_CRC  18
+#define NFFS_DISK_V0INODE_OFFSET_CRC  18
 
 /** On-disk representation of a version 0 data block. */
-struct nffs_disk_blockV0 {
+struct nffs_disk_V0block {
     uint32_t ndb_magic;     /* NFFS_BLOCK_MAGIC */
     uint32_t ndb_id;        /* Unique object ID. */
     uint32_t ndb_seq;       /* Sequence number; greater supersedes lesser. */
@@ -80,7 +80,20 @@ struct nffs_disk_blockV0 {
     uint16_t ndb_crc16;     /* Covers rest of header and data. */
     /* Followed by 'ndb_data_len' bytes of data. */
 };
-#define NFFS_DISK_BLOCKV0_OFFSET_CRC  22
+#define NFFS_DISK_V0BLOCK_OFFSET_CRC  22
+
+struct nffs_disk_V0object {
+    int ndo_type;
+    uint8_t ndo_area_idx;
+    uint32_t ndo_offset;
+    union {
+        struct nffs_disk_V0inode ndo_disk_V0inode;
+        struct nffs_disk_V0block ndo_disk_V0block;
+    } ndo_un_obj;
+};
+
+#define ndo_disk_V0inode    ndo_un_obj.ndo_disk_V0inode
+#define ndo_disk_V0block    ndo_un_obj.ndo_disk_V0block
 
 static void usage(int rc);
 
@@ -115,13 +128,13 @@ print_inode_entry(struct nffs_inode_entry *inode_entry, int indent)
     int rc;
 
     rc = nffs_inode_from_entry(&inode, inode_entry);
-	/*
-	 * Dummy inode
-	 */
-	if (rc == FS_ENOENT) {
-		printf("    DUMMY %d\n", rc);
-		return;
-	}
+    /*
+     * Dummy inode
+     */
+    if (rc == FS_ENOENT) {
+        printf("    DUMMY %d\n", rc);
+        return;
+    }
     assert(rc == 0);
 
     nffs_flash_loc_expand(inode_entry->nie_hash_entry.nhe_flash_loc,
@@ -151,24 +164,23 @@ process_inode_entry(struct nffs_inode_entry *inode_entry, int indent)
     }
 }
 
-#ifdef OBSOLETE /* XXX To be removed */
 static int
 print_nffs_inode(struct nffs_disk_inode *ndi, int idx, uint32_t off)
 {
     char filename[128];
     int len;
-	int rc;
+    int rc;
 
     memset(filename, 0, sizeof(filename));
     len = min(sizeof(filename) - 1, ndi->ndi_filename_len);
     rc = nffs_flash_read(idx, off + sizeof(struct nffs_disk_inode),
-						 filename, len);
+                         filename, len);
     printf("      %x-%d inode %d/%d",
       off, ndi->ndi_filename_len, ndi->ndi_id, ndi->ndi_seq);
-	if (rc == 0)
-		printf(" %s\n", filename);
-	else
-		printf("\n");
+    if (rc == 0)
+        printf(" %s\n", filename);
+    else
+        printf("\n");
     return (sizeof(struct nffs_disk_inode) + ndi->ndi_filename_len);
 }
 
@@ -183,34 +195,34 @@ print_nffs_block(struct nffs_disk_block *ndb, int idx, uint32_t off)
 static int
 print_nffs_object(int idx, uint32_t off)
 {
-	struct nffs_disk_object dobj;
+    struct nffs_disk_object dobj;
     int rc;
 
     rc = nffs_flash_read(idx, off, &dobj.ndo_un_obj, sizeof(dobj.ndo_un_obj));
     assert(rc == 0);
 
-	if (nffs_hash_id_is_inode(dobj.ndo_disk_inode.ndi_id)) {
+    if (nffs_hash_id_is_inode(dobj.ndo_disk_inode.ndi_id)) {
         return print_nffs_inode(&dobj.ndo_disk_inode, idx, off);
 
-	} else if (nffs_hash_id_is_block(dobj.ndo_disk_inode.ndi_id)) {
+    } else if (nffs_hash_id_is_block(dobj.ndo_disk_inode.ndi_id)) {
         return print_nffs_block(&dobj.ndo_disk_block, idx, off);
 
-	} else if (dobj.ndo_disk_inode.ndi_id == NFFS_ID_NONE) {
-		assert(0);
+    } else if (dobj.ndo_disk_inode.ndi_id == NFFS_ID_NONE) {
+        assert(0);
         return 0;
 
-	} else {
+    } else {
         printf("      %x Corruption\n", off);
-		return 1;
-	}
+        return 1;
+    }
 }
 
 static void
 print_nffs_darea(struct nffs_disk_area *darea)
 {
-	printf("\tdarea: len %d ver %d gc_seq %d id %x\n",
-		   darea->nda_length, darea->nda_ver,
-		   darea->nda_gc_seq, darea->nda_id);
+    printf("\tdarea: len %d ver %d gc_seq %d id %x\n",
+           darea->nda_length, darea->nda_ver,
+           darea->nda_gc_seq, darea->nda_id);
 }
 
 static void
@@ -224,14 +236,14 @@ print_nffs_area(int idx)
     area = &nffs_areas[idx];
     rc = nffs_flash_read(idx, 0, &darea, sizeof(darea));
     assert(rc == 0);
-	print_nffs_darea(&darea);
+    print_nffs_darea(&darea);
     if (!nffs_area_magic_is_set(&darea)) {
         printf("Area header corrupt!\n");
         return;
     }
-	/*
-	 * XXX Enhance to print but not restore unsupported formats
-	 */
+    /*
+     * XXX Enhance to print but not restore unsupported formats
+     */
     if (!nffs_area_is_current_version(&darea)) {
         printf("Area format is not supported!\n");
         return;
@@ -262,7 +274,6 @@ print_nffs_areas(void)
         print_nffs_area(i);
     }
 } 
-#endif /* OBSOLETE */
 
 static int
 copy_in_file(char *src, char *dst)
@@ -320,7 +331,9 @@ copy_in_directory(const char *src, const char *dst)
             printf("Copying %s\n", dst_name);
             rc = copy_in_file(src_name, dst_name);
             if (rc) {
-                printf("  error code %d ", rc);
+                if (print_verbose) {
+                    printf("  error code %d ", rc);
+                }
                 switch (rc) {
                 case FS_ENOMEM:
                     printf("out of memory\n");
@@ -334,7 +347,9 @@ copy_in_directory(const char *src, const char *dst)
                 break;
             }
         } else {
-            printf("Skipping %s\n", src_name);
+            if (print_verbose) {
+                printf("Skipping %s\n", src_name);
+            }
         }
     }
     closedir(dr);
@@ -343,15 +358,17 @@ copy_in_directory(const char *src, const char *dst)
 static int
 file_flash_read(uint32_t addr, void *dst, int byte_cnt)
 {
-	memcpy(dst, (void*)file_flash_area + addr, byte_cnt);
-	return 0;
+    memcpy(dst, (void*)file_flash_area + addr, byte_cnt);
+    return 0;
 }
 
-#ifdef NOTYET
+/*
+ * Print NFFS V0 structures
+ */
 static int
-print_nffsV0_flash_inode(struct nffs_disk_object *ndo, uint32_t off)
+print_nffs_flash_V0inode(struct nffs_area_desc *area, uint32_t off)
 {
-    struct nffs_disk_inode *ndi = &ndo->ndo_disk_inode;
+    struct nffs_disk_V0inode ndi;
     char filename[128];
     int len;
     int rc;
@@ -362,45 +379,54 @@ print_nffsV0_flash_inode(struct nffs_disk_object *ndo, uint32_t off)
     memset(filename, 0, sizeof(filename));
     len = min(sizeof(filename) - 1, ndi.ndi_filename_len);
     rc = file_flash_read(area->nad_offset + off + sizeof(ndi), filename, len);
+    filename[len] = '\0';
+    assert(rc == 0);
 
-	printf("  off %x flen %d %s id %x seq %d prnt %x lstb %x %s\n",
-		   off, ndi.ndi_filename_len,
-		   (nffs_hash_id_is_file(ndi.ndi_id) ? "File" :
-			(nffs_hash_id_is_dir(ndi.ndi_id) ? "Dir" : "???")),
-		   ndi.ndi_id, ndi.ndi_seq, ndi.ndi_parent_id,
-		   ndi.ndi_lastblock_id, filename);
-    return sizeof(struct nffs_disk_inode) + ndi->ndi_filename_len;
+    printf("   %s off %x id %x magic %x flen %d seq %d prnt %x %s\n",
+           (nffs_hash_id_is_file(ndi.ndi_id) ? "File" :
+            (nffs_hash_id_is_dir(ndi.ndi_id) ? "Dir" : "???")),
+           off, ndi.ndi_id, ndi.ndi_magic, ndi.ndi_filename_len,
+           ndi.ndi_seq, ndi.ndi_parent_id, filename);
+    return sizeof(struct nffs_disk_V0inode) + ndi.ndi_filename_len;
 }
 
 static int
-print_nffsV0_flash_block(struct nffs_disk_object *ndo, uint32_t off)
+print_nffs_flash_V0block(struct nffs_area_desc *area, uint32_t off)
 {
-    struct nffs_disk_block *ndb = &ndo->ndo_disk_block;
+    struct nffs_disk_V0block ndb;
     int rc;
 
-    printf("  off %x len %d Block id %x seq %d prev %x own ino %x\n",
-		   off, ndb->ndb_data_len, ndb->ndb_id, ndb->ndb_seq,
-		   ndb->ndb_prev_id, ndb->ndb_inode_id);
-    return sizeof(struct nffs_disk_block) + ndb->ndb_data_len;
+    rc = file_flash_read(area->nad_offset + off, &ndb, sizeof(ndb));
+    assert(rc == 0);
+
+    printf("   Block off %x id %x len %d seq %d prev %x ino %x\n",
+           off, ndb.ndb_id, ndb.ndb_data_len, ndb.ndb_seq,
+           ndb.ndb_prev_id, ndb.ndb_inode_id);
+    return sizeof(struct nffs_disk_V0block) + ndb.ndb_data_len;
 }
 
 static int
-print_nffsV0_flash_object(struct nffs_area_desc *area, uint32_t off)
+print_nffs_flash_V0object(struct nffs_area_desc *area, uint32_t off)
 {
-	struct nffs_disk_object ndo;
-    uint32_t magic;
+    struct nffs_disk_V0object ndo;
+    int rc;
+
+    rc = file_flash_read(area->nad_offset + off, &ndo, sizeof(ndo));
+    assert(rc == 0);
+
+    if (nffs_hash_id_is_inode(ndo.ndo_disk_V0inode.ndi_id)) {
+        return print_nffs_flash_V0inode(area, off);
 
-	file_flash_read(area->nad_offset + off, &ndo, sizeof(ndo));
-	if (nffs_hash_id_is_inode(ndo.ndo_disk_inode.ndi_id)) {
-        return print_nffsV0_flash_inode(&ndo, off);
+    } else if (nffs_hash_id_is_block(ndo.ndo_disk_V0block.ndb_id)) {
+        return print_nffs_flash_V0block(area, off);
 
-	} else if (nffs_hash_id_is_block(ndo.ndo_disk_block.ndb_id)) {
-        return print_nffsV0_flash_block(&ndo, off);
+    } else if (ndo.ndo_disk_V0block.ndb_id == 0xffffffff) {
+        return area->nad_length;
 
-	}
-	return sizeof(ndo);
+    } else {
+        return 1;
+    }
 }
-#endif /* NOTYET */
 
 static int
 print_nffs_flash_inode(struct nffs_area_desc *area, uint32_t off)
@@ -455,7 +481,7 @@ print_nffs_flash_object(struct nffs_area_desc *area, uint32_t off)
 {
     struct nffs_disk_object ndo;
 
-	file_flash_read(area->nad_offset + off, &ndo, sizeof(ndo));
+    file_flash_read(area->nad_offset + off, &ndo, sizeof(ndo));
 
     if (nffs_hash_id_is_inode(ndo.ndo_disk_inode.ndi_id)) {
         return print_nffs_flash_inode(area, off);
@@ -471,6 +497,7 @@ print_nffs_flash_object(struct nffs_area_desc *area, uint32_t off)
     }
 }
 
+#if 0
 void
 print_file_areas()
 {
@@ -479,116 +506,87 @@ print_file_areas()
     int i;
 
     for (i = 0; i < nffs_num_areas; i++) {
-		area = &area_descs[i];
+        area = &area_descs[i];
         printf("%d: id:%d 0x%x - 0x%x %s\n",
-			   i, area->nad_flash_id, area->nad_offset,
-			   area->nad_offset + area->nad_length,
-			   (i == file_scratch_idx ? "(scratch)" : ""));
-		off = sizeof (struct nffs_disk_area);
-		while (off < area->nad_length) {
-#ifdef NOTYET
-			if (nffs_version == 0) {
-				off += print_nffsV0_flash_object(area, off);
-			} else if (nffs_version == NFFS_AREA_VER) {
-				off += print_nffs_flash_object(area, off);
-			}
-#else
-			off += print_nffs_flash_object(area, off);
-#endif /* NOTYET */
-		}
+               i, area->nad_flash_id, area->nad_offset,
+               area->nad_offset + area->nad_length,
+               (i == file_scratch_idx ? "(scratch)" : ""));
+        off = sizeof (struct nffs_disk_area);
+        while (off < area->nad_length) {
+            if (nffs_version == 0) {
+                off += print_nffsV0_flash_object(area, off);
+            } else if (nffs_version == NFFS_AREA_VER) {
+                off += print_nffs_flash_object(area, off);
+            }
+        }
     }
 }
+#endif
 
 static void
-print_nffs_flash_areas(char *flash_area, size_t size)
+print_nffs_file_flash(char *flash_area, size_t size)
 {
-	char *daptr;		/* Disk Area Pointer */
-	char *eoda;			/* End Of Disk Area */
-	struct nffs_disk_area *nda;
-	int nad_cnt = 0;	/* Nffs Area Descriptor count */
-	int off;
-
-	daptr = flash_area;
-	eoda = flash_area + size;
-	while (daptr < eoda) {
-		if (nffs_area_magic_is_set((struct nffs_disk_area*)daptr)) {
-			nda = (struct nffs_disk_area*)daptr;
-			area_descs[nad_cnt].nad_offset = (daptr - flash_area);
-			area_descs[nad_cnt].nad_length = nda->nda_length;
-			area_descs[nad_cnt].nad_flash_id = nda->nda_id;
-			nffs_version = nda->nda_ver;
-
-			if (nda->nda_id == 0xff)
-				file_scratch_idx = nad_cnt;
-
-			printf("area %d: id %d %x-%x len %d flshid %x gcseq %d %s\n",
-				   nad_cnt, nda->nda_id,
-				   area_descs[nad_cnt].nad_offset,
-				   area_descs[nad_cnt].nad_offset +
-				       area_descs[nad_cnt].nad_length,
-				   area_descs[nad_cnt].nad_length,
-				   area_descs[nad_cnt].nad_flash_id,
-				   nda->nda_gc_seq,
-				   nffs_scratch_area_idx == nad_cnt ? "(scratch)" : "");
+    char *daptr;        /* Disk Area Pointer */
+    char *eoda;            /* End Of Disk Area */
+    struct nffs_disk_area *nda;
+    int nad_cnt = 0;    /* Nffs Area Descriptor count */
+    int off;
+
+    daptr = flash_area;
+    eoda = flash_area + size;
+    printf("\nNFFS Flash Areas:\n");
+    while (daptr < eoda) {
+        if (nffs_area_magic_is_set((struct nffs_disk_area*)daptr)) {
+            nda = (struct nffs_disk_area*)daptr;
+            area_descs[nad_cnt].nad_offset = (daptr - flash_area);
+            area_descs[nad_cnt].nad_length = nda->nda_length;
+            area_descs[nad_cnt].nad_flash_id = nda->nda_id;
+            nffs_version = nda->nda_ver;
+
+            if (nda->nda_id == 0xff)
+                file_scratch_idx = nad_cnt;
+
+            printf("Area %d: off %x-%x len %d flshid %x gcseq %d ver %d id %x%s%s\n",
+                   nad_cnt,
+                   area_descs[nad_cnt].nad_offset,
+                   area_descs[nad_cnt].nad_offset +
+                                 area_descs[nad_cnt].nad_length,
+                   area_descs[nad_cnt].nad_length,
+                   area_descs[nad_cnt].nad_flash_id,
+                   nda->nda_gc_seq,
+                   nda->nda_ver,
+                   nda->nda_id,
+                   nda->nda_ver != NFFS_AREA_VER ? " (V0)" : "",
+                   nad_cnt == file_scratch_idx ? " (Scratch)" : "");
 
             off = sizeof (struct nffs_disk_area);
             while (off < area_descs[nad_cnt].nad_length) {
-                off += print_nffs_flash_object(&area_descs[nad_cnt], off);
+                if (nffs_version == 0) {
+                    off += print_nffs_flash_V0object(&area_descs[nad_cnt], off);
+                } else if (nffs_version == NFFS_AREA_VER) {
+                    off += print_nffs_flash_object(&area_descs[nad_cnt], off);
+                }
             }
+            printf("\n");
 
-			nad_cnt++;
-			daptr = daptr + nda->nda_length;
-		} else {
-			daptr++;
-		}
-	}
-	nffs_num_areas = nad_cnt;
+            nad_cnt++;
+            daptr = daptr + nda->nda_length;
+        } else {
+            daptr++;
+        }
+    }
+    nffs_num_areas = nad_cnt;
 }
 
 static void
 printfs(void)
 {
-	printf("NFFS directory:\n");
-	process_inode_entry(nffs_root_dir, print_verbose);
+    printf("\nNFFS directory:\n");
+    process_inode_entry(nffs_root_dir, print_verbose);
 
-    printf("\nNFFS flash areas:\n");
-    print_nffs_flash_areas(file_flash_area, file_flash_size);
-}
+    printf("\nNFFS areas:\n");
+    print_nffs_areas();
 
-int
-file_area_init(char *flash_area, size_t size)
-{
-	char *daptr;		/* Disk Area Pointer */
-	char *eoda;			/* End Of Disk Area */
-	struct nffs_disk_area *nda;
-	int nad_cnt = 0;	/* Nffs Area Descriptor count */
-
-	daptr = flash_area;
-	eoda = flash_area + size;
-	while (daptr < eoda) {
-		if (nffs_area_magic_is_set((struct nffs_disk_area*)daptr)) {
-			nda = (struct nffs_disk_area*)daptr;
-			area_descs[nad_cnt].nad_offset = (daptr - flash_area);
-			area_descs[nad_cnt].nad_length = nda->nda_length;
-			area_descs[nad_cnt].nad_flash_id = nda->nda_id;
-			nffs_version = nda->nda_ver;
-			if (nda->nda_id == 0xff)
-				file_scratch_idx = nad_cnt;
-			printf("area %d: off %d len %d flshid %x gc-seq %d id %x ver %d %s\n",
-				   nad_cnt,
-				   area_descs[nad_cnt].nad_offset,
-				   area_descs[nad_cnt].nad_length,
-				   area_descs[nad_cnt].nad_flash_id,
-				   nda->nda_gc_seq, nda->nda_id, nda->nda_ver,
-				   nda->nda_id == 0xff ? "(scratch)" : "");
-			nad_cnt++;
-			daptr = daptr + nda->nda_length;
-		} else {
-			daptr++;
-		}
-	}
-	nffs_num_areas = nad_cnt;
-	return 0;
 }
 
 static void
@@ -608,12 +606,12 @@ int
 main(int argc, char **argv)
 {
     FILE *fp;
-	int fd;
+    int fd;
     int rc;
     int ch;
     int cnt;
-	struct stat st;
-	int standalone = 0;
+    struct stat st;
+    int standalone = 0;
 
     progname = argv[0];
 
@@ -628,9 +626,9 @@ main(int argc, char **argv)
         case 'd':
             copy_in_dir = optarg;
             break;
-		case 's':
-			standalone++;
-			break;
+        case 's':
+            standalone++;
+            break;
         case 'f':
             native_flash_file = optarg;
             break;
@@ -644,10 +642,10 @@ main(int argc, char **argv)
     }
 
     os_init();
-	if (standalone == 0) {
-		rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, area_descs);
-		assert(rc == 0);
-	}
+    if (standalone == 0) {
+        rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, area_descs);
+        assert(rc == 0);
+    }
 
     rc = hal_flash_init();
     assert(rc == 0);
@@ -655,26 +653,24 @@ main(int argc, char **argv)
     rc = nffs_init();
     assert(rc == 0);
 
-	log_init();
-	log_console_handler_init(&nffs_log_console_handler);
-	log_register("nffs-log", &nffs_log, &nffs_log_console_handler);
-
-	if (standalone) {
-		fd = open(native_flash_file, O_RDWR);
-		if ((rc = fstat(fd, &st)))
-			perror("fstat failed");
-		file_flash_size = st.st_size;
-		if ((file_flash_area = mmap(0, (size_t)8192, PROT_READ,
-							   MAP_FILE|MAP_SHARED, fd, 0)) == MAP_FAILED) {
-			perror("%s mmap failed");
-		}
-
-		rc = file_area_init(file_flash_area, file_flash_size);
+    log_init();
+    log_console_handler_init(&nffs_log_console_handler);
+    log_register("nffs-log", &nffs_log, &nffs_log_console_handler);
+
+    if (standalone) {
+        fd = open(native_flash_file, O_RDWR);
+        if ((rc = fstat(fd, &st)))
+            perror("fstat failed");
+        file_flash_size = st.st_size;
+        if ((file_flash_area = mmap(0, (size_t)8192, PROT_READ,
+                               MAP_FILE|MAP_SHARED, fd, 0)) == MAP_FAILED) {
+            perror("%s mmap failed");
+        }
 
-		print_nffs_flash_areas(file_flash_area, file_flash_size);
+        print_nffs_file_flash(file_flash_area, file_flash_size);
 
-		return 0;
-	}
+        return 0;
+    }
 
     if (copy_in_dir) {
         /*