|
1 |
| -From c021ee459c8788951522ca7e651473bf6ec2b043 Mon Sep 17 00:00:00 2001 |
| 1 | +From 4c05d0e6ef10556f7abf1ad5b8a8e7ef2747b4b7 Mon Sep 17 00:00:00 2001 |
2 | 2 | From: Frank Hunleth < [email protected]>
|
3 | 3 | Date: Tue, 5 Jun 2018 09:10:14 -0400
|
4 | 4 | Subject: [PATCH] fs: add support for SquashFS
|
@@ -29,19 +29,19 @@ comes from BareBox. It has the current limitations:
|
29 | 29 | fs/squashfs/namei.c | 346 ++++++++++++++++++++++
|
30 | 30 | fs/squashfs/page_actor.c | 99 +++++++
|
31 | 31 | fs/squashfs/page_actor.h | 52 ++++
|
32 |
| - fs/squashfs/squashfs.c | 399 ++++++++++++++++++++++++++ |
| 32 | + fs/squashfs/squashfs.c | 392 +++++++++++++++++++++++++ |
33 | 33 | fs/squashfs/squashfs.h | 123 ++++++++
|
34 | 34 | fs/squashfs/squashfs_compat.h | 590 ++++++++++++++++++++++++++++++++++++++
|
35 | 35 | fs/squashfs/squashfs_fs.h | 456 +++++++++++++++++++++++++++++
|
36 | 36 | fs/squashfs/squashfs_fs_i.h | 52 ++++
|
37 | 37 | fs/squashfs/squashfs_fs_sb.h | 76 +++++
|
38 | 38 | fs/squashfs/super.c | 343 ++++++++++++++++++++++
|
39 | 39 | fs/squashfs/xz_wrapper.c | 190 ++++++++++++
|
40 |
| - fs/squashfs/zlib_wrapper.c | 127 ++++++++ |
| 40 | + fs/squashfs/zlib_wrapper.c | 128 +++++++++ |
41 | 41 | fs/squashfs/zstd_wrapper.c | 147 ++++++++++
|
42 | 42 | include/fs.h | 1 +
|
43 | 43 | include/squashfs.h | 22 ++
|
44 |
| - 32 files changed, 5365 insertions(+) |
| 44 | + 32 files changed, 5359 insertions(+) |
45 | 45 | create mode 100644 fs/squashfs/Kconfig
|
46 | 46 | create mode 100644 fs/squashfs/Makefile
|
47 | 47 | create mode 100644 fs/squashfs/block.c
|
@@ -3052,12 +3052,10 @@ index 0000000..08f4356
|
3052 | 3052 | +#endif
|
3053 | 3053 | diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
|
3054 | 3054 | new file mode 100644
|
3055 |
| -index 0000000..8a4cdea |
| 3055 | +index 0000000..20eeb31 |
3056 | 3056 | --- /dev/null
|
3057 | 3057 | +++ b/fs/squashfs/squashfs.c
|
3058 |
| -@@ -0,0 +1,399 @@ |
3059 |
| -+//#define DEBUG |
3060 |
| -+ |
| 3058 | +@@ -0,0 +1,392 @@ |
3061 | 3059 | +#include <linux/compat.h>
|
3062 | 3060 | +
|
3063 | 3061 | +#include <common.h>
|
@@ -3085,25 +3083,20 @@ index 0000000..8a4cdea
|
3085 | 3083 | +char *squashfs_devread(struct squashfs_sb_info *fs, int address,
|
3086 | 3084 | + int byte_len)
|
3087 | 3085 | +{
|
3088 |
| -+ lbaint_t sector; |
3089 |
| -+ int byte_offset; |
3090 |
| -+ ssize_t size; |
| 3086 | ++ lbaint_t sector; |
| 3087 | ++ int byte_offset; |
3091 | 3088 | + char *buf;
|
3092 | 3089 | +
|
3093 | 3090 | + buf = malloc(byte_len);
|
3094 | 3091 | + if (buf == NULL)
|
3095 | 3092 | + return NULL;
|
3096 | 3093 | +
|
3097 |
| -+ sector = address >> cur_dev->log2blksz; |
3098 |
| -+ byte_offset = address % cur_dev->blksz; |
3099 |
| -+ |
3100 |
| -+ size = fs_devread(cur_dev, &cur_part_info, sector, byte_offset, |
3101 |
| -+ byte_len, buf); |
| 3094 | ++ sector = address >> cur_dev->log2blksz; |
| 3095 | ++ byte_offset = address % cur_dev->blksz; |
3102 | 3096 | +
|
3103 |
| -+ if (size < 0) { |
3104 |
| -+ debug("read error: %d\n", size); |
| 3097 | ++ if (!fs_devread(cur_dev, &cur_part_info, sector, byte_offset, |
| 3098 | ++ byte_len, buf)) |
3105 | 3099 | + return NULL;
|
3106 |
| -+ } |
3107 | 3100 | +
|
3108 | 3101 | + return buf;
|
3109 | 3102 | +}
|
@@ -5329,10 +5322,10 @@ index 0000000..6600f1e
|
5329 | 5322 | +};
|
5330 | 5323 | diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
|
5331 | 5324 | new file mode 100644
|
5332 |
| -index 0000000..a992a05 |
| 5325 | +index 0000000..7d6ca5f |
5333 | 5326 | --- /dev/null
|
5334 | 5327 | +++ b/fs/squashfs/zlib_wrapper.c
|
5335 |
| -@@ -0,0 +1,127 @@ |
| 5328 | +@@ -0,0 +1,128 @@ |
5336 | 5329 | +/*
|
5337 | 5330 | + * Squashfs - a compressed read only filesystem for Linux
|
5338 | 5331 | + *
|
@@ -5368,11 +5361,12 @@ index 0000000..a992a05
|
5368 | 5361 | +
|
5369 | 5362 | +static void *zlib_init(struct squashfs_sb_info *dummy, void *buff)
|
5370 | 5363 | +{
|
5371 |
| -+ z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); |
| 5364 | ++ z_stream *stream = calloc(sizeof(z_stream), 1); |
5372 | 5365 | + if (stream == NULL)
|
5373 | 5366 | + goto failed;
|
5374 |
| -+ memset(stream, 0, sizeof(z_stream)); |
5375 | 5367 | +
|
| 5368 | ++ stream->zalloc = gzalloc; |
| 5369 | ++ stream->zfree = gzfree; |
5376 | 5370 | + return stream;
|
5377 | 5371 | +
|
5378 | 5372 | +failed:
|
|
0 commit comments