lzo_wrapper.c (e5451c8f8330e03ad3cfa16048b4daf961af434f) lzo_wrapper.c (09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a)
1/*
2 * Squashfs - a compressed read only filesystem for Linux
3 *
4 * Copyright (c) 2010 LG Electronics
5 * Chan Jeong <chan.jeong@lge.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 88 unchanged lines hidden (view full) ---

97 stream->output, &out_len);
98 if (res != LZO_E_OK)
99 goto failed;
100
101 res = bytes = (int)out_len;
102 data = squashfs_first_page(output);
103 buff = stream->output;
104 while (data) {
1/*
2 * Squashfs - a compressed read only filesystem for Linux
3 *
4 * Copyright (c) 2010 LG Electronics
5 * Chan Jeong <chan.jeong@lge.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 88 unchanged lines hidden (view full) ---

97 stream->output, &out_len);
98 if (res != LZO_E_OK)
99 goto failed;
100
101 res = bytes = (int)out_len;
102 data = squashfs_first_page(output);
103 buff = stream->output;
104 while (data) {
105 if (bytes <= PAGE_CACHE_SIZE) {
105 if (bytes <= PAGE_SIZE) {
106 memcpy(data, buff, bytes);
107 break;
108 } else {
106 memcpy(data, buff, bytes);
107 break;
108 } else {
109 memcpy(data, buff, PAGE_CACHE_SIZE);
110 buff += PAGE_CACHE_SIZE;
111 bytes -= PAGE_CACHE_SIZE;
109 memcpy(data, buff, PAGE_SIZE);
110 buff += PAGE_SIZE;
111 bytes -= PAGE_SIZE;
112 data = squashfs_next_page(output);
113 }
114 }
115 squashfs_finish_page(output);
116
117 return res;
118
119failed:
120 return -EIO;
121}
122
123const struct squashfs_decompressor squashfs_lzo_comp_ops = {
124 .init = lzo_init,
125 .free = lzo_free,
126 .decompress = lzo_uncompress,
127 .id = LZO_COMPRESSION,
128 .name = "lzo",
129 .supported = 1
130};
112 data = squashfs_next_page(output);
113 }
114 }
115 squashfs_finish_page(output);
116
117 return res;
118
119failed:
120 return -EIO;
121}
122
123const struct squashfs_decompressor squashfs_lzo_comp_ops = {
124 .init = lzo_init,
125 .free = lzo_free,
126 .decompress = lzo_uncompress,
127 .id = LZO_COMPRESSION,
128 .name = "lzo",
129 .supported = 1
130};