squashfsTools: make Darwin patch apply to 4.4
I took the patch, and applied it on top of the previous squashfs-tools commit that we packaged. It applied cleanly. Then I rebased that on top of master, and resolved the conflicts. I'm not sure I resolved them correctly though, I don't have access to Darwin. Somebody needs to review this.
This commit is contained in:
parent
a60ee9a74c
commit
14d2c3669f
|
@ -28,10 +28,10 @@ index 4b06ccb..26365e7 100644
|
|||
|
||||
/*
|
||||
diff --git a/squashfs-tools/info.c b/squashfs-tools/info.c
|
||||
index 7968c77..c8e4c52 100644
|
||||
index fe23d78..8efefe6 100644
|
||||
--- a/squashfs-tools/info.c
|
||||
+++ b/squashfs-tools/info.c
|
||||
@@ -134,31 +134,22 @@ void dump_state()
|
||||
@@ -144,31 +144,22 @@ void dump_state()
|
||||
void *info_thrd(void *arg)
|
||||
{
|
||||
sigset_t sigmask;
|
||||
|
@ -68,7 +68,7 @@ index 7968c77..c8e4c52 100644
|
|||
"because %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
@@ -169,8 +160,12 @@ void *info_thrd(void *arg)
|
||||
@@ -179,8 +170,12 @@ void *info_thrd(void *arg)
|
||||
/* set one second interval period, if ^\ received
|
||||
within then, dump queue and cache status */
|
||||
waiting = 1;
|
||||
|
@ -83,12 +83,12 @@ index 7968c77..c8e4c52 100644
|
|||
}
|
||||
|
||||
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
|
||||
index d696a51..c86d1b3 100644
|
||||
index a45b77f..6d186ea 100644
|
||||
--- a/squashfs-tools/mksquashfs.c
|
||||
+++ b/squashfs-tools/mksquashfs.c
|
||||
@@ -50,6 +50,10 @@
|
||||
#include <limits.h>
|
||||
@@ -52,6 +52,10 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
+#ifndef FNM_EXTMATCH /* glibc extension */
|
||||
+ #define FNM_EXTMATCH 0
|
||||
|
@ -97,101 +97,15 @@ index d696a51..c86d1b3 100644
|
|||
#ifndef linux
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#define __BIG_ENDIAN BIG_ENDIAN
|
||||
@@ -831,13 +835,13 @@ char *subpathname(struct dir_ent *dir_ent)
|
||||
}
|
||||
|
||||
|
||||
-inline unsigned int get_inode_no(struct inode_info *inode)
|
||||
+static inline unsigned int get_inode_no(struct inode_info *inode)
|
||||
{
|
||||
return inode->inode_number;
|
||||
}
|
||||
|
||||
|
||||
-inline unsigned int get_parent_no(struct dir_info *dir)
|
||||
+static inline unsigned int get_parent_no(struct dir_info *dir)
|
||||
{
|
||||
return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no;
|
||||
}
|
||||
@@ -2030,7 +2034,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
|
||||
}
|
||||
|
||||
|
||||
-inline int is_fragment(struct inode_info *inode)
|
||||
+static inline int is_fragment(struct inode_info *inode)
|
||||
{
|
||||
off_t file_size = inode->buf.st_size;
|
||||
|
||||
@@ -2999,13 +3003,13 @@ struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id)
|
||||
}
|
||||
|
||||
|
||||
-inline struct inode_info *lookup_inode(struct stat *buf)
|
||||
+static inline struct inode_info *lookup_inode(struct stat *buf)
|
||||
{
|
||||
return lookup_inode2(buf, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
-inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
|
||||
+static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
|
||||
{
|
||||
if (inode->inode_number == 0) {
|
||||
inode->inode_number = use_this ? : inode_no ++;
|
||||
@@ -3016,7 +3020,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
|
||||
}
|
||||
|
||||
|
||||
-inline struct dir_ent *create_dir_entry(char *name, char *source_name,
|
||||
+static inline struct dir_ent *create_dir_entry(char *name, char *source_name,
|
||||
char *nonstandard_pathname, struct dir_info *dir)
|
||||
{
|
||||
struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent));
|
||||
@@ -3034,7 +3038,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name,
|
||||
}
|
||||
|
||||
|
||||
-inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
|
||||
+static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
|
||||
struct inode_info *inode_info)
|
||||
{
|
||||
struct dir_info *dir = dir_ent->our_dir;
|
||||
@@ -3050,7 +3054,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
|
||||
}
|
||||
|
||||
|
||||
-inline void add_dir_entry2(char *name, char *source_name,
|
||||
+static inline void add_dir_entry2(char *name, char *source_name,
|
||||
char *nonstandard_pathname, struct dir_info *sub_dir,
|
||||
struct inode_info *inode_info, struct dir_info *dir)
|
||||
{
|
||||
@@ -3062,7 +3066,7 @@ inline void add_dir_entry2(char *name, char *source_name,
|
||||
}
|
||||
|
||||
|
||||
-inline void free_dir_entry(struct dir_ent *dir_ent)
|
||||
+static inline void free_dir_entry(struct dir_ent *dir_ent)
|
||||
{
|
||||
if(dir_ent->name)
|
||||
free(dir_ent->name);
|
||||
@@ -3083,7 +3087,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent)
|
||||
}
|
||||
|
||||
|
||||
-inline void add_excluded(struct dir_info *dir)
|
||||
+static inline void add_excluded(struct dir_info *dir)
|
||||
{
|
||||
dir->excluded ++;
|
||||
}
|
||||
@@ -4200,6 +4204,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
|
||||
@@ -4348,6 +4352,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
|
||||
sigemptyset(&sigmask);
|
||||
sigaddset(&sigmask, SIGQUIT);
|
||||
sigaddset(&sigmask, SIGHUP);
|
||||
+ sigaddset(&sigmask, SIGALRM);
|
||||
if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == -1)
|
||||
if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0)
|
||||
BAD_ERROR("Failed to set signal mask in intialise_threads\n");
|
||||
|
||||
@@ -4987,6 +4992,36 @@ int parse_num(char *arg, int *res)
|
||||
@@ -5184,6 +5189,36 @@ int parse_mode(char *arg, mode_t *res)
|
||||
|
||||
int get_physical_memory()
|
||||
{
|
||||
|
@ -228,21 +142,24 @@ index d696a51..c86d1b3 100644
|
|||
/*
|
||||
* Long longs are used here because with PAE, a 32-bit
|
||||
* machine can have more than 4GB of physical memory
|
||||
@@ -4996,10 +5031,11 @@ int get_physical_memory()
|
||||
@@ -5193,7 +5228,6 @@ int get_physical_memory()
|
||||
*/
|
||||
long long num_pages = sysconf(_SC_PHYS_PAGES);
|
||||
long long page_size = sysconf(_SC_PAGESIZE);
|
||||
- int phys_mem = num_pages * page_size >> 20;
|
||||
+ phys_mem = num_pages * page_size >> 20;
|
||||
- int phys_mem;
|
||||
|
||||
if(num_pages == -1 || page_size == -1)
|
||||
return 0;
|
||||
if(num_pages == -1 || page_size == -1) {
|
||||
struct sysinfo sys;
|
||||
@@ -5207,6 +5241,7 @@ int get_physical_memory()
|
||||
}
|
||||
|
||||
phys_mem = num_pages * page_size >> 20;
|
||||
+#endif
|
||||
|
||||
if(phys_mem < SQUASHFS_LOWMEM)
|
||||
BAD_ERROR("Mksquashfs requires more physical memory than is "
|
||||
diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h
|
||||
index 55708a3..d44d1fd 100644
|
||||
index 1beefef..88d0b5c 100644
|
||||
--- a/squashfs-tools/mksquashfs.h
|
||||
+++ b/squashfs-tools/mksquashfs.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
@ -254,7 +171,7 @@ index 55708a3..d44d1fd 100644
|
|||
struct dir_info {
|
||||
char *pathname;
|
||||
diff --git a/squashfs-tools/pseudo.c b/squashfs-tools/pseudo.c
|
||||
index cb74cf6..fe2b4bc 100644
|
||||
index 48e6b27..f8fd529 100644
|
||||
--- a/squashfs-tools/pseudo.c
|
||||
+++ b/squashfs-tools/pseudo.c
|
||||
@@ -30,6 +30,7 @@
|
||||
|
@ -266,7 +183,7 @@ index cb74cf6..fe2b4bc 100644
|
|||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
diff --git a/squashfs-tools/read_xattrs.c b/squashfs-tools/read_xattrs.c
|
||||
index 42106f5..837d3fb 100644
|
||||
index 4debedf..3257c30 100644
|
||||
--- a/squashfs-tools/read_xattrs.c
|
||||
+++ b/squashfs-tools/read_xattrs.c
|
||||
@@ -39,13 +39,13 @@
|
||||
|
@ -286,10 +203,10 @@ index 42106f5..837d3fb 100644
|
|||
extern int read_block(int, long long, long long *, int, void *);
|
||||
|
||||
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
|
||||
index f190e96..927e441 100644
|
||||
index 727f1d5..00615ce 100644
|
||||
--- a/squashfs-tools/unsquashfs.c
|
||||
+++ b/squashfs-tools/unsquashfs.c
|
||||
@@ -32,7 +32,12 @@
|
||||
@@ -32,8 +32,13 @@
|
||||
#include "stdarg.h"
|
||||
#include "fnmatch_compat.h"
|
||||
|
||||
|
@ -297,21 +214,22 @@ index f190e96..927e441 100644
|
|||
+#include <sys/sysctl.h>
|
||||
+#else
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/sysmacros.h>
|
||||
+#endif
|
||||
+
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
@@ -2185,6 +2190,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size)
|
||||
@@ -2235,6 +2240,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size)
|
||||
sigemptyset(&sigmask);
|
||||
sigaddset(&sigmask, SIGQUIT);
|
||||
sigaddset(&sigmask, SIGHUP);
|
||||
+ sigaddset(&sigmask, SIGALRM);
|
||||
if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) == -1)
|
||||
if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0)
|
||||
EXIT_UNSQUASH("Failed to set signal mask in initialise_threads"
|
||||
"\n");
|
||||
diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h
|
||||
index 0edbd25..cea9caa 100644
|
||||
index 934618b..329eb9e 100644
|
||||
--- a/squashfs-tools/unsquashfs.h
|
||||
+++ b/squashfs-tools/unsquashfs.h
|
||||
@@ -46,6 +46,10 @@
|
||||
|
@ -381,7 +299,7 @@ index c8e2b9b..7d4f7af 100644
|
|||
}
|
||||
|
||||
diff --git a/squashfs-tools/unsquashfs_xattr.c b/squashfs-tools/unsquashfs_xattr.c
|
||||
index 59f4aae..13f0e35 100644
|
||||
index 7742dfe..26ccd39 100644
|
||||
--- a/squashfs-tools/unsquashfs_xattr.c
|
||||
+++ b/squashfs-tools/unsquashfs_xattr.c
|
||||
@@ -27,6 +27,11 @@
|
||||
|
@ -397,7 +315,7 @@ index 59f4aae..13f0e35 100644
|
|||
|
||||
extern int root_process;
|
||||
diff --git a/squashfs-tools/xattr.c b/squashfs-tools/xattr.c
|
||||
index b46550c..5b32eca 100644
|
||||
index 64dfd82..9c4532d 100644
|
||||
--- a/squashfs-tools/xattr.c
|
||||
+++ b/squashfs-tools/xattr.c
|
||||
@@ -22,6 +22,14 @@
|
||||
|
@ -429,3 +347,6 @@ index b46550c..5b32eca 100644
|
|||
#include "squashfs_fs.h"
|
||||
#include "squashfs_swap.h"
|
||||
#include "mksquashfs.h"
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
|
Loading…
Reference in a new issue