1Upstream-Status: Pending 2 3Index: git/jffsX-utils/mkfs.jffs2.c 4=================================================================== 5--- git.orig/jffsX-utils/mkfs.jffs2.c 6+++ git/jffsX-utils/mkfs.jffs2.c 7@@ -100,6 +100,11 @@ struct filesystem_entry { 8 struct rb_node hardlink_rb; 9 }; 10 11+struct ignorepath_entry { 12+ struct ignorepath_entry* next; /* Points to the next ignorepath element */ 13+ char name[PATH_MAX]; /* Name of the entry */ 14+}; 15+static struct ignorepath_entry* ignorepath = 0; 16 struct rb_root hardlinks; 17 static int out_fd = -1; 18 static int in_fd = -1; 19@@ -309,7 +314,7 @@ static struct filesystem_entry *recursiv 20 char *hpath, *tpath; 21 struct dirent *dp, **namelist; 22 struct filesystem_entry *entry; 23- 24+ struct ignorepath_entry* element = ignorepath; 25 26 if (lstat(hostpath, &sb)) { 27 sys_errmsg_die("%s", hostpath); 28@@ -318,6 +323,15 @@ static struct filesystem_entry *recursiv 29 entry = add_host_filesystem_entry(targetpath, hostpath, 30 sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); 31 32+ while ( element ) { 33+ if ( strcmp( element->name, targetpath ) == 0 ) { 34+ printf( "Note: ignoring directories below '%s'\n", targetpath ); 35+ return entry; 36+ break; 37+ } 38+ element = element->next; 39+ } 40+ 41 n = scandir(hostpath, &namelist, 0, alphasort); 42 if (n < 0) { 43 sys_errmsg_die("opening directory %s", hostpath); 44@@ -1359,6 +1373,7 @@ static struct option long_options[] = { 45 {"root", 1, NULL, 'r'}, 46 {"pagesize", 1, NULL, 's'}, 47 {"eraseblock", 1, NULL, 'e'}, 48+ {"ignore", 1, NULL, 'I'}, 49 {"output", 1, NULL, 'o'}, 50 {"help", 0, NULL, 'h'}, 51 {"verbose", 0, NULL, 'v'}, 52@@ -1409,6 +1424,7 @@ static const char helptext[] = 53 " -L, --list-compressors Show the list of the available compressors\n" 54 " -t, --test-compression Call decompress and compare with the original (for test)\n" 55 " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n" 56+" -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" 57 " -o, --output=FILE Output to FILE (default: stdout)\n" 58 " -l, --little-endian Create a little-endian filesystem\n" 59 " -b, --big-endian Create a big-endian filesystem\n" 60@@ -1566,6 +1582,7 @@ int main(int argc, char **argv) 61 char *compr_name = NULL; 62 int compr_prior = -1; 63 int warn_page_size = 0; 64+ struct ignorepath_entry* element = ignorepath; 65 66 page_size = sysconf(_SC_PAGESIZE); 67 if (page_size < 0) /* System doesn't know so ... */ 68@@ -1576,7 +1593,7 @@ int main(int argc, char **argv) 69 jffs2_compressors_init(); 70 71 while ((opt = getopt_long(argc, argv, 72- "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) 73+ "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) 74 { 75 switch (opt) { 76 case 'D': 77@@ -1600,6 +1617,28 @@ int main(int argc, char **argv) 78 warn_page_size = 0; /* set by user, so don't need to warn */ 79 break; 80 81+ case 'I': 82+ printf( "Note: Adding '%s' to ignore Path\n", optarg ); 83+ element = ignorepath; 84+ if ( !ignorepath ) { 85+ ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); 86+ ignorepath->next = 0; 87+ strcpy( &ignorepath->name[0], optarg ); 88+ } else { 89+ while ( element->next ) element = element->next; 90+ element->next = xmalloc( sizeof( struct ignorepath_entry ) ); 91+ element->next->next = 0; 92+ strcpy( &element->next->name[0], optarg ); 93+ } 94+ printf( "--------- Dumping ignore path list ----------------\n" ); 95+ element = ignorepath; 96+ while ( element ) { 97+ printf( " * '%s'\n", &element->name[0] ); 98+ element = element->next; 99+ } 100+ printf( "---------------------------------------------------\n" ); 101+ break; 102+ 103 case 'o': 104 if (out_fd != -1) { 105 errmsg_die("output filename specified more than once"); 106