Move zlib compression library to common directory
Subsystems (2)
This patch moves the zlib compression and decompression code to a common directory. The zutil.h header, which is not meant to be public, is moved from include/linux/ to lib/zlib/.
In addition, the PRESET_DICT definition from zutil.h, used by fs/jffs2/compr_zlib.c is moved to the 'true' public zlib header include/linux/zlib.h. This move is documented in comments.
Conditional compile of only inflate or deflate code is preserved by this patch.
fs/jffs2/compr_zlib.c +0 -1
@@ -16,7 +16,6 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/zlib.h> -#include <linux/zutil.h> #include "nodelist.h" #include "compr.h"
include/linux/zlib.h +0 -0
@@ -177,6 +177,9 @@ typedef z_stream *z_streamp;#define Z_DEFLATED 8/* The deflate compression method (the only one supported in this
version) */
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ +/* Required by fs/jffs2/compr_zlib.c */
+
/* basic functions */
extern int zlib_deflate_workspacesize (void);
lib/Makefile +2 -2
@@ -46,8 +46,8 @@ obj-$(CONFIG_CRC32) += crc32.o obj-$(CONFIG_LIBCRC32C) += libcrc32c.o obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o -obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ -obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ +obj-$(CONFIG_ZLIB_INFLATE) += zlib/ +obj-$(CONFIG_ZLIB_DEFLATE) += zlib/ obj-$(CONFIG_REED_SOLOMON) += reed_solomon/ obj-$(CONFIG_TEXTSEARCH) += textsearch.o
lib/zlib/Makefile renamed from lib/zlib_inflate/Makefile +6 -2
@@ -2,8 +2,8 @@ # This is a modified version of zlib, which does all memory # allocation ahead of time. # -# This is only the decompression, see zlib_deflate for the -# the compression +# The compression (deflate) and decompression (inflate) code +# is present in this folder. # # Decompression needs to be serialized for each memory # allocation.
@@ -17,3 +17,7 @@ obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate.o zlib_inflate-objs := inffast.o inflate.o \ inftrees.o inflate_syms.o + +obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate.o + +zlib_deflate-objs := deflate.o deftree.o deflate_syms.o
lib/zlib/deflate.c renamed from lib/zlib_deflate/deflate.c +1 -2
@@ -49,10 +49,9 @@*/ #include <linux/module.h> -#include <linux/zutil.h> +#include "zutil.h" #include "defutil.h" -/*
===========================================================================
* Function prototypes.
*/
lib/zlib/deflate_syms.c renamed from lib/zlib_deflate/deflate_syms.c +0 -0
lib/zlib/deftree.c renamed from lib/zlib_deflate/deftree.c +1 -1
@@ -34,7 +34,7 @@/* #include "deflate.h" */ -#include <linux/zutil.h> +#include "zutil.h" #include "defutil.h" #ifdef DEBUG_ZLIB
lib/zlib/defutil.h renamed from lib/zlib_deflate/defutil.h +0 -0
lib/zlib/inffast.c renamed from lib/zlib_inflate/inffast.c +1 -1
@@ -3,7 +3,7 @@* For conditions of distribution and use, see copyright notice in zlib.h */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h"
lib/zlib/inffast.h renamed from lib/zlib_inflate/inffast.h +0 -0
lib/zlib/inffixed.h renamed from lib/zlib_inflate/inffixed.h +0 -0
lib/zlib/inflate.c renamed from lib/zlib_inflate/inflate.c +1 -1
@@ -9,7 +9,7 @@* */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h"
lib/zlib/inflate.h renamed from lib/zlib_inflate/inflate.h +0 -0
lib/zlib/inflate_syms.c renamed from lib/zlib_inflate/inflate_syms.c +0 -0
lib/zlib/inftrees.c renamed from lib/zlib_inflate/inftrees.c +1 -1
@@ -3,7 +3,7 @@* For conditions of distribution and use, see copyright notice in zlib.h */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #define MAXBITS 15
lib/zlib/inftrees.h renamed from lib/zlib_inflate/inftrees.h +0 -0
lib/zlib/infutil.h renamed from lib/zlib_inflate/infutil.h +0 -0
lib/zlib/patch-zlib new file binary +0 -0
lib/zlib/zutil.h renamed from include/linux/zutil.h +1 -1
@@ -32,7 +32,7 @@ typedef unsigned long ulg;#define MAX_MATCH 258/* The minimum and maximum match lengths */ -#define PRESET_DICT 0x20/* preset dictionary flag in zlib header */ +/* PRESET_DICT #define moved to <linux/zlib.h> for JFFS2 */ /* target dependencies */
lib/zlib_deflate/Makefile deleted +0 -11
@@ -1,11 +0,0 @@ -# -# This is a modified version of zlib, which does all memory -# allocation ahead of time. -# -# This is the compression code, see zlib_inflate for the -# decompression code. -# - -obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate.o - -zlib_deflate-objs := deflate.o deftree.o deflate_syms.o
[-mm] Move zlib compression library to common directory [TAKE TWO]
This patch moves the zlib compression and decompression code to a common directory. The zutil.h header, which is not meant to be public, is moved from include/linux/ to lib/zlib/.
In addition, the PRESET_DICT definition from zutil.h, used by fs/jffs2/compr_zlib.c is moved to the 'true' public zlib header include/linux/zlib.h.
Conditional compile of only inflate or deflate code is preserved by this patch. With a bit of luck, this version won't be whitespace-damaged. Grumble.
fs/jffs2/compr_zlib.c +0 -1
@@ -16,7 +16,6 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/zlib.h> -#include <linux/zutil.h> #include "nodelist.h" #include "compr.h"
include/linux/zlib.h +3 -0
@@ -177,6 +177,9 @@ typedef z_stream *z_streamp;#define Z_DEFLATED 8/* The deflate compression method (the only one supported in this version) */ +#define PRESET_DICT 0x20/* preset dictionary flag in zlib header */ +/* Required by fs/jffs2/compr_zlib.c */ +/* basic functions */ extern int zlib_deflate_workspacesize (void );
lib/Makefile +2 -2
@@ -46,8 +46,8 @@ obj-$(CONFIG_CRC32) += crc32.o obj-$(CONFIG_LIBCRC32C) += libcrc32c.o obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o -obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ -obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ +obj-$(CONFIG_ZLIB_INFLATE) += zlib/ +obj-$(CONFIG_ZLIB_DEFLATE) += zlib/ obj-$(CONFIG_REED_SOLOMON) += reed_solomon/ obj-$(CONFIG_TEXTSEARCH) += textsearch.o
lib/zlib/Makefile renamed from lib/zlib_inflate/Makefile +6 -2
@@ -2,8 +2,8 @@ # This is a modified version of zlib, which does all memory # allocation ahead of time. # -# This is only the decompression, see zlib_deflate for the -# the compression +# The compression (deflate) and decompression (inflate) code +# is present in this folder. # # Decompression needs to be serialized for each memory # allocation.
@@ -17,3 +17,7 @@ obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate.o zlib_inflate-objs := inffast.o inflate.o \ inftrees.o inflate_syms.o + +obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate.o + +zlib_deflate-objs := deflate.o deftree.o deflate_syms.o
lib/zlib/deflate.c renamed from lib/zlib_deflate/deflate.c +1 -2
@@ -49,10 +49,9 @@*/ #include <linux/module.h> -#include <linux/zutil.h> +#include "zutil.h" #include "defutil.h" -/* =========================================================================== * Function prototypes. */
lib/zlib/deflate_syms.c renamed from lib/zlib_deflate/deflate_syms.c +0 -0
lib/zlib/deftree.c renamed from lib/zlib_deflate/deftree.c +1 -1
@@ -34,7 +34,7 @@/* #include "deflate.h" */ -#include <linux/zutil.h> +#include "zutil.h" #include "defutil.h" #ifdef DEBUG_ZLIB
lib/zlib/defutil.h renamed from lib/zlib_deflate/defutil.h +0 -0
lib/zlib/inffast.c renamed from lib/zlib_inflate/inffast.c +1 -1
@@ -3,7 +3,7 @@* For conditions of distribution and use, see copyright notice in zlib.h */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h"
lib/zlib/inffast.h renamed from lib/zlib_inflate/inffast.h +0 -0
lib/zlib/inffixed.h renamed from lib/zlib_inflate/inffixed.h +0 -0
lib/zlib/inflate.c renamed from lib/zlib_inflate/inflate.c +1 -1
@@ -9,7 +9,7 @@* */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h"
lib/zlib/inflate.h renamed from lib/zlib_inflate/inflate.h +0 -0
lib/zlib/inflate_syms.c renamed from lib/zlib_inflate/inflate_syms.c +0 -0
lib/zlib/inftrees.c renamed from lib/zlib_inflate/inftrees.c +1 -1
@@ -3,7 +3,7 @@* For conditions of distribution and use, see copyright notice in zlib.h */ -#include <linux/zutil.h> +#include "zutil.h" #include "inftrees.h" #define MAXBITS 15
lib/zlib/inftrees.h renamed from lib/zlib_inflate/inftrees.h +0 -0
lib/zlib/infutil.h renamed from lib/zlib_inflate/infutil.h +0 -0
lib/zlib/zutil.h renamed from include/linux/zutil.h +1 -1
@@ -32,7 +32,7 @@ typedef unsigned long ulg;#define MAX_MATCH 258/* The minimum and maximum match lengths */ -#define PRESET_DICT 0x20/* preset dictionary flag in zlib header */ +/* PRESET_DICT #define moved to <linux/zlib.h> for JFFS2 */ /* target dependencies */
lib/zlib_deflate/Makefile deleted +0 -11
@@ -1,11 +0,0 @@ -# -# This is a modified version of zlib, which does all memory -# allocation ahead of time. -# -# This is the compression code, see zlib_inflate for the -# decompression code. -# - -obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate.o - -zlib_deflate-objs := deflate.o deftree.o deflate_syms.o
Andrew Morton
maintainerRe: [-mm] Move zlib compression library to common directory [TAKE TWO]
Quoted 11 lines · On Tue, 29 May 2007 17:31:05 +0100 Michael-Luke Jones…
This patch moves the zlib compression and decompression code to a common directory. The
zutil.hheader, which is not meant to be public, is moved frominclude/linux/tolib/zlib/.In addition, the
PRESET_DICTdefinition fromzutil.h, used byfs/jffs2/compr_zlib.cis moved to the 'true' public zlib headerinclude/linux/zlib.h.Conditional compile of only inflate or deflate code is preserved by this patch. With a bit of luck, this version won't be whitespace-damaged. Grumble.
umm, OK, if you say so. I'm not sure I understand the point behind all this, but I'm sure there is one ;)
lib/zlib/zutil.h
Quoted 35 lines
lib/zlib/deflate.c renamed from lib/zlib_deflate/deflate.c +0
-0lib/zlib/deflate_syms.c renamed from lib/zlib_deflate/deflate_syms.c +0
-0lib/zlib/deftree.c renamed from lib/zlib_deflate/deftree.c +0
-0lib/zlib/defutil.h renamed from lib/zlib_deflate/defutil.h +0
-0lib/zlib/inffast.c renamed from lib/zlib_inflate/inffast.c +0
-0lib/zlib/inftrees.h renamed from lib/zlib_inflate/inftrees.h +0
-0lib/zlib/infutil.h renamed from lib/zlib_inflate/infutil.h +0
-0lib/zlib/zutil.h renamed from include/linux/zutil.h +0
-0
Lots of git goodies there - I didn't actually receive the patch: the parts which move files around were communicated via git metadata, not diffs. Presumably there's a way to tell git to not do that.
But probably it's best that this change be merged via git anyway. David, are you interested in handling it?
Re: [-mm] Move zlib compression library to common directory [TAKE TWO]
In reply to Michael-Luke JonesHi Michael,
Quoted 5 lines · Michael-Luke Jones
This patch moves the zlib compression and decompression code to a common directory. The
zutil.hheader, which is not meant to be public, is moved frominclude/linux/tolib/zlib/.
You could remove the (now pointless) /* WARNING: ... */ comment from (the now truly private) zutil.h too ...
Quoted 3 lines
In addition, the
PRESET_DICTdefinition fromzutil.h, used byfs/jffs2/compr_zlib.cis moved to the 'true' public zlib headerinclude/linux/zlib.h.
Ugh, I wish you had held on from this patch till the original thread discussing this reached some conclusion ... from Mark's response there it does seem PRESET_DICT is clearly an implementation (and not interface) detail -- which means to me that it must continue to live in zutil.h (the private header) ... but then, this change is clearly not so critical either, so it doesn't matter much, I guess.
[ Added zlib authors Mark Adler and Jean-Loup Gailly on this thread too. ]
Satyam
Re: [-mm] Move zlib compression library to common directory [TAKE TWO]
Quoted 6 lines · Satyam Sharma
Ugh, I wish you had held on from this patch till the original thread discussing this reached some conclusion ... from Mark's response there it does seem
PRESET_DICTis clearly an implementation (and not interface) detail -- which means to me that it must continue to live inzutil.h(the private header) ... but then, this change is clearly not so critical either, so it doesn't matter much, I guess.
Satyam: Sorry about this, I wrote this before the conversation on this point started, expecting the discussion to happen here. My hope was to see if this minimal change to export PRESET_DICT was acceptable (if not ideal). Given that practically all of the implementation details are currently exported, it's probably an improvement to only export one :)
Andrew: The main reason for this change is to allow a private header to be moved from include/linux/ to this private folder. It's already been used apparently inappropriately by JFFS2 compression code. Minimal code changes, lots of file moving (as I'm sure you can see)...
I managed to get the patch to apply to a fresh tree using 'git apply', which may well mean that I didn't understand your comment that "the parts which move files around were communicated via git metadata, not diffs".
Given that, since I wrote this patch, no-one has actually said anything positive about it, there's probably not much point picking it up until people have worked out exactly what to do with JFFS2's inappropriate use of the public-private zutil.h header. At least it's just JFFS2 :)
Quoted 2 lines
[ Added zlib authors Mark Adler and Jean-Loup Gailly on this thread too. ]
Thanks, I should have CCed the authors/maintainers originally.
Quoted 1 line
Satyam
Michael-Luke
(PS: The stern warning is also present in the other private zlib header files.)
Re: [-mm] Move zlib compression library to common directory [TAKE TWO]
In reply to Andrew MortonQuoted 6 lines · Andrew Morton
Lots of git goodies there - I didn't actually receive the patch: the parts which move files around were communicated via git metadata, not diffs. Presumably there's a way to tell git to not do that.
But probably it's best that this change be merged via git anyway. David, are you interested in handling it?
Update: totally ignore this patch. Even using git-apply something gets confused and git loses the meaning of the renames, turning them into file additions and deletions.
A better version will no doubt come along. In the mean time, it looks like I need to improve my git-foo skills...
M-L