3 # Patch managed by http://www.holgerschurig.de/patcher.html
6 --- mtd/util/mkfs.jffs2.c~add-exclusion-to-mkfs-jffs2.patch
7 +++ mtd/util/mkfs.jffs2.c
9 struct filesystem_entry *files; /* Only relevant to directories */
12 +struct ignorepath_entry {
13 + struct ignorepath_entry* next; /* Points to the next ignorepath element */
14 + char name[PATH_MAX]; /* Name of the entry */
17 +static struct ignorepath_entry* ignorepath = 0;
18 static int out_fd = -1;
19 static int in_fd = -1;
20 static char default_rootdir[] = ".";
23 struct dirent *dp, **namelist;
24 struct filesystem_entry *entry;
25 + struct ignorepath_entry* element = ignorepath;
28 if (lstat(hostpath, &sb)) {
30 entry = add_host_filesystem_entry(targetpath, hostpath,
31 sb.st_uid, sb.st_gid, sb.st_mode, 0, parent);
34 + if ( strcmp( element->name, targetpath ) == 0 ) {
35 + printf( "Note: ignoring directories below '%s'\n", targetpath );
39 + element = element->next;
42 n = scandir(hostpath, &namelist, 0, alphasort);
44 perror_msg_and_die("opening directory %s", hostpath);
46 {"root", 1, NULL, 'r'},
47 {"pagesize", 1, NULL, 's'},
48 {"eraseblock", 1, NULL, 'e'},
49 + {"ignore", 1, NULL, 'I'},
50 {"output", 1, NULL, 'o'},
51 {"help", 0, NULL, 'h'},
52 {"verbose", 0, NULL, 'v'},
54 " -L, --list-compressors Show the list of the avaiable compressors\n"
55 " -t, --test-compression Call decompress and compare with the original (for test)\n"
56 " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n"
57 + " -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n"
58 " -o, --output=FILE Output to FILE (default: stdout)\n"
59 " -l, --little-endian Create a little-endian filesystem\n"
60 " -b, --big-endian Create a big-endian filesystem\n"
61 @@ -1349,11 +1366,12 @@
62 struct filesystem_entry *root;
63 char *compr_name = NULL;
65 + struct ignorepath_entry* element = ignorepath;
67 jffs2_compressors_init();
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)
75 @@ -1376,6 +1394,28 @@
76 page_size = strtol(optarg, NULL, 0);
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 );
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 );
92 + printf( "--------- Dumping ignore path list ----------------\n" );
93 + element = ignorepath;
95 + printf( " * '%s'\n", &element->name[0] );
96 + element = element->next;
98 + printf( "---------------------------------------------------\n" );
103 error_msg_and_die("output filename specified more than once");