summary refs log tree commit diff
path: root/pkgs/tools/filesystems/squashfs/4k-align.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/filesystems/squashfs/4k-align.patch')
-rw-r--r--pkgs/tools/filesystems/squashfs/4k-align.patch62
1 files changed, 31 insertions, 31 deletions
diff --git a/pkgs/tools/filesystems/squashfs/4k-align.patch b/pkgs/tools/filesystems/squashfs/4k-align.patch
index e73c0678875..db0af95601c 100644
--- a/pkgs/tools/filesystems/squashfs/4k-align.patch
+++ b/pkgs/tools/filesystems/squashfs/4k-align.patch
@@ -1,6 +1,7 @@
-This patch has been edited to apply to squashfs 4.4, commit
-52eb4c279cd283ed9802dd1ceb686560b22ffb67. Below is the original
-message body of the patch.
+This patch is an old patch; see below for the original message body. The patch
+has been updated twice: Once to apply to squashfs 4.4, commit
+52eb4c279cd283ed9802dd1ceb686560b22ffb67, and later to apply to squashfs 4.5,
+commit 0496d7c3de3e09da37ba492081c86159806ebb07.
 
 From 7bda7c75748f36b0a50f93e46144d5a4de4974ad Mon Sep 17 00:00:00 2001
 From: Amin Hassani <ahassani@google.com>
@@ -20,24 +21,23 @@ increased_size = (number_of_unfragmented_files_in_image + number of fragments) *
 
 The 4k alignment can be enabled by flag '-4k-align'
 ---
- squashfs-tools/mksquashfs.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
+ squashfs-tools/mksquashfs.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
 
 diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
-index a45b77f..07b1c06 100644
+index aaa4b00..eb2fb23 100644
 --- a/squashfs-tools/mksquashfs.c
 +++ b/squashfs-tools/mksquashfs.c
-@@ -102,7 +102,9 @@ int old_exclude = TRUE;
- int use_regex = FALSE;
- int nopad = FALSE;
+@@ -99,6 +99,8 @@ int nopad = FALSE;
  int exit_on_error = FALSE;
-+int do_4k_align = FALSE;
  long long start_offset = 0;
+ int sleep_time = 0;
++int do_4k_align = FALSE;
 +#define ALIGN_UP(bytes, size) (bytes = (bytes + size - 1) & ~(size - 1))
  
  long long global_uid = -1, global_gid = -1;
  
-@@ -1546,6 +1548,9 @@ void unlock_fragments()
+@@ -1553,6 +1555,9 @@ static void unlock_fragments()
  	 * queue at this time.
  	 */
  	while(!queue_empty(locked_fragment)) {
@@ -47,7 +47,7 @@ index a45b77f..07b1c06 100644
  		write_buffer = queue_get(locked_fragment);
  		frg = write_buffer->block;	
  		size = SQUASHFS_COMPRESSED_SIZE_BLOCK(fragment_table[frg].size);
-@@ -2478,6 +2483,9 @@ void *frag_deflator(void *arg)
+@@ -2460,6 +2465,9 @@ static void *frag_deflator(void *arg)
  		write_buffer->size = compressed_size;
  		pthread_mutex_lock(&fragment_mutex);
  		if(fragments_locked == FALSE) {
@@ -57,18 +57,26 @@ index a45b77f..07b1c06 100644
  			fragment_table[file_buffer->block].size = c_byte;
  			fragment_table[file_buffer->block].start_block = bytes;
  			write_buffer->block = bytes;
-@@ -2877,6 +2885,10 @@ int write_file_blocks(squashfs_inode *inode, struct dir_ent *dir_ent,
- 	long long sparse = 0;
- 	struct file_buffer *fragment_buffer = NULL;
+@@ -2850,6 +2858,10 @@ static struct file_info *write_file_blocks(int *status, struct dir_ent *dir_ent,
+ 	struct file_info *file;
+ 	int bl_hash = 0;
  
 +	// 4k align the start of each file.
 +	if(do_4k_align)
 +		ALIGN_UP(bytes, 4096);
 +
- 	if(pre_duplicate(read_size))
- 		return write_file_blocks_dup(inode, dir_ent, read_buffer, dup);
+ 	if(pre_duplicate(read_size, dir_ent->inode, read_buffer, &bl_hash))
+ 		return write_file_blocks_dup(status, dir_ent, read_buffer, dup, bl_hash);
  
-@@ -4972,6 +4984,7 @@ void write_filesystem_tables(struct squashfs_super_block *sBlk, int nopad)
+@@ -5975,6 +5987,7 @@ static void print_options(FILE *stream, char *name, int total_mem)
+ 	fprintf(stream, "actions from <f>\n");
+ 	fprintf(stream, "-false-action-file <f>\tas -false-action, but read ");
+ 	fprintf(stream, "actions from <f>\n");
++	fprintf(stream, "-4k-align\t\tenables 4k alignment of all files\n");
+ 	fprintf(stream, "\nFilesystem filter options:\n");
+ 	fprintf(stream, "-p <pseudo-definition>\tAdd pseudo file definition\n");
+ 	fprintf(stream, "-pf <pseudo-file>\tAdd list of pseudo file definitions\n");
+@@ -6198,6 +6211,7 @@ static void print_summary()
  		"compressed", no_fragments ? "no" : noF ? "uncompressed" :
  		"compressed", no_xattrs ? "no" : noX ? "uncompressed" :
  		"compressed", noI || noId ? "uncompressed" : "compressed");
@@ -76,23 +84,15 @@ index a45b77f..07b1c06 100644
  	printf("\tduplicates are %sremoved\n", duplicate_checking ? "" :
  		"not ");
  	printf("Filesystem size %.2f Kbytes (%.2f Mbytes)\n", bytes / 1024.0,
-@@ -5853,6 +5866,8 @@ print_compressor_options:
+@@ -7499,6 +7513,9 @@ print_compressor_options:
  			root_name = argv[i];
  		} else if(strcmp(argv[i], "-version") == 0) {
- 			VERSION();
+ 			print_version("mksquashfs");
++
 +		} else if(strcmp(argv[i], "-4k-align") == 0) {
 +			do_4k_align = TRUE;
  		} else {
  			ERROR("%s: invalid option\n\n", argv[0]);
- printOptions:
-@@ -5904,6 +5919,7 @@ printOptions:
- 			ERROR("\t\t\tdirectory containing that directory, "
- 				"rather than the\n");
- 			ERROR("\t\t\tcontents of the directory\n");
-+			ERROR("-4k-align\t\tenables 4k alignment of all files\n");
- 			ERROR("\nFilesystem filter options:\n");
- 			ERROR("-p <pseudo-definition>\tAdd pseudo file "
- 				"definition\n");
+ 			print_options(stderr, argv[0], total_mem);
 -- 
-2.23.0
-
+2.32.0