Accepting request 720711 from filesystems

OBS-URL: https://build.opensuse.org/request/show/720711
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/squashfs?expand=0&rev=38
This commit is contained in:
Dominique Leuenberger 2019-08-15 10:22:30 +00:00 committed by Git OBS Bridge
commit 6f53a4ed15
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,86 @@
From 5a498ad24dcfeac9f3d747e894f22901f3ac10ef Mon Sep 17 00:00:00 2001
From: probonopd <probonopd@users.noreply.github.com>
Date: Thu, 15 Sep 2016 21:09:52 +0200
Subject: [PATCH] Add -offset function to skip n bytes at the beginning of the
squashfs file
---
squashfs-tools/mksquashfs.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index d221c358..92b6a319 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -98,6 +98,7 @@ int old_exclude = TRUE;
int use_regex = FALSE;
int nopad = FALSE;
int exit_on_error = FALSE;
+static off_t squashfs_start_offset = 0;
long long global_uid = -1, global_gid = -1;
@@ -516,9 +517,9 @@ int read_fs_bytes(int fd, long long byte, int bytes, void *buff)
pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
pthread_mutex_lock(&pos_mutex);
- if(lseek(fd, off, SEEK_SET) == -1) {
+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
ERROR("read_fs_bytes: Lseek on destination failed because %s, "
- "offset=0x%llx\n", strerror(errno), off);
+ "offset=0x%llx\n", strerror(errno), off+squashfs_start_offset);
res = 0;
} else if(read_bytes(fd, buff, bytes) < bytes) {
ERROR("Read on destination failed\n");
@@ -557,10 +558,10 @@ void write_destination(int fd, long long byte, int bytes, void *buff)
pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
pthread_mutex_lock(&pos_mutex);
- if(lseek(fd, off, SEEK_SET) == -1) {
+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
ERROR("write_destination: Lseek on destination "
"failed because %s, offset=0x%llx\n", strerror(errno),
- off);
+ off+squashfs_start_offset);
BAD_ERROR("Probably out of space on output %s\n",
block_device ? "block device" : "filesystem");
}
@@ -2315,9 +2316,9 @@ void *writer(void *arg)
pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
pthread_mutex_lock(&pos_mutex);
- if(lseek(fd, off, SEEK_SET) == -1) {
+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
ERROR("writer: Lseek on destination failed because "
- "%s, offset=0x%llx\n", strerror(errno), off);
+ "%s, offset=0x%llx\n", strerror(errno), off+squashfs_start_offset);
BAD_ERROR("Probably out of space on output "
"%s\n", block_device ? "block device" :
"filesystem");
@@ -5341,6 +5342,15 @@ int main(int argc, char *argv[])
force_progress = TRUE;
else if(strcmp(argv[i], "-no-exports") == 0)
exportable = FALSE;
+ else if(strcmp(argv[i], "-offset") == 0 ||
+ strcmp(argv[i], "-o") ==0) {
+ if(++i == argc) {
+ ERROR("%s: %s offset missing argument\n", argv[0],
+ argv[i - 1]);
+ exit(1);
+ }
+ squashfs_start_offset = (off_t)atol(argv[i]);
+ }
else if(strcmp(argv[i], "-processors") == 0) {
if((++i == argc) || !parse_num(argv[i], &processors)) {
ERROR("%s: -processors missing or invalid "
@@ -5641,6 +5651,9 @@ int main(int argc, char *argv[])
ERROR("\nMiscellaneous options:\n");
ERROR("-root-owned\t\talternative name for -all-root"
"\n");
+ ERROR("-o <offset>\t\tSkip <offset> bytes at the "
+ "beginning of the file.\n\t\t\t"
+ "Default 0 bytes\n");
ERROR("-noInodeCompression\talternative name for -noI"
"\n");
ERROR("-noDataCompression\talternative name for -noD"

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jun 5 20:21:30 UTC 2019 - Philipp <p.seiler@linuxmail.org>
- Add -offset function to skip n bytes at the beginning of the squashfs…
https://github.com/plougher/squashfs-tools/commit/5a498ad24dcfeac9f3d747e894f22901f3ac10
(0003-Add-offset-function-to-skip-n-bytes.patch)
-------------------------------------------------------------------
Wed Apr 24 17:41:17 UTC 2019 - Martin Liška <mliska@suse.cz>

View File

@ -32,6 +32,8 @@ Patch2: 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
Patch3: squashfs-thread-limit
# PATCH-FIX-UPSTREAM Include <sys/sysmacros.h> for major/minor/makedev
Patch4: sysmacros.patch
# PATCH-FIX_UPSTREAM add -offset function to skip n bytes
Patch5: 0003-Add-offset-function-to-skip-n-bytes.patch
%if %{?suse_version} > 1315
BuildRequires: liblz4-devel
%endif
@ -52,6 +54,7 @@ squashfs images.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%define _lto_cflags %{nil}