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