- diff -r -u ./platform-ecu01/build-target/mtd-utils-1.5.0/mkfs.ubifs/mkfs.ubifs.c ./platform-ecu01/build-host/mtd-utils-1.5.0/mkfs.ubifs/mkfs.ubifs.c
- --- mtd-utils-1.5.0/mkfs.ubifs/mkfs.ubifs.c 2012-05-07 09:19:39.000000000 +0200
- +++ mtd-utils-1.5.0/mkfs.ubifs/mkfs.ubifs.c 2019-07-29 16:17:34.482830999 +0200
- @@ -25,6 +25,7 @@
- #include "mkfs.ubifs.h"
- #include <crc32.h>
- #include "common.h"
- +#include <stdbool.h>
- /* Size (prime number) of hash table for link counting */
- #define HASH_TABLE_SIZE 10099
- @@ -1042,8 +1043,10 @@
- union ubifs_key key;
- int len, use_flags = 0;
- +#if 0
- if (c->default_compr != UBIFS_COMPR_NONE)
- use_flags |= UBIFS_COMPR_FL;
- +#endif
- if (flags & FS_COMPR_FL)
- use_flags |= UBIFS_COMPR_FL;
- if (flags & FS_SYNC_FL)
- @@ -1276,6 +1279,24 @@
- unsigned int block_no = 0;
- size_t out_len;
- +#if 1
- + bool no_compression = false;
- + if (strstr(path_name, ".gz") ||
- + strstr(path_name, "/lib/lib") ||
- + strstr(path_name, "/bin/")
- + )
- + {
- + no_compression = true;
- + }
- +
- + if (no_compression)
- + {
- + (void)fprintf(stderr, "## Skipping compression for file '%s'\n", path_name);
- + use_compr = UBIFS_COMPR_NONE;
- + flags &= ~FS_COMPR_FL;
- + }
- +#endif
- +
- fd = open(path_name, O_RDONLY | O_LARGEFILE);
- if (fd == -1)
- return sys_err_msg("failed to open file '%s'", path_name);
- @@ -1301,6 +1322,7 @@
- block_no += 1;
- continue;
- }
- +
- /* Make data node */
- memset(dn, 0, UBIFS_DATA_NODE_SZ);
- data_key_init(&key, inum, block_no++);
- @@ -1308,13 +1330,27 @@
- key_write(&key, &dn->key);
- dn->size = cpu_to_le32(bytes_read);
- out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
- - if (c->default_compr == UBIFS_COMPR_NONE &&
- - (flags & FS_COMPR_FL))
- - use_compr = UBIFS_COMPR_LZO;
- +#if 1
- + if (no_compression) {
- + use_compr = UBIFS_COMPR_NONE;
- + }
- else
- - use_compr = c->default_compr;
- + {
- +#endif
- + if (c->default_compr == UBIFS_COMPR_NONE &&
- + (flags & FS_COMPR_FL))
- + use_compr = UBIFS_COMPR_LZO;
- + else
- + use_compr = c->default_compr;
- +#if 1
- + }
- +#endif
- compr_type = compress_data(buf, bytes_read, &dn->data,
- &out_len, use_compr);
- +#if 1
- + if (compr_type != MKFS_UBIFS_COMPR_NONE)
- + flags |= FS_COMPR_FL;
- +#endif
- dn->compr_type = cpu_to_le16(compr_type);
- dn_len = UBIFS_DATA_NODE_SZ + out_len;
- /* Add data node to file system */
Prototype patch mkfs.ubifs so it does not compress specific file types with high entropy
Posted by Anonymous on Mon 29th Jul 2019 16:33
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.