@@ -54,9 +54,13 @@ static int get_xattrs = 0;
static int dry_run = 0;
#define LZO_LEN 4
-#define PAGE_CACHE_SIZE 4096
#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
+static inline long pagesize(void)
+{
+ return sysconf(_SC_PAGESIZE);
+}
+
static int decompress_zlib(char *inbuf, char *outbuf, u64 compress_len,
u64 decompress_len)
{
@@ -125,7 +129,7 @@ static int decompress_lzo(unsigned char *inbuf, char *outbuf, u64 compress_len,
inbuf += LZO_LEN;
tot_in += LZO_LEN;
- new_len = lzo1x_worst_compress(PAGE_CACHE_SIZE);
+ new_len = lzo1x_worst_compress(pagesize());
ret = lzo1x_decompress_safe((const unsigned char *)inbuf, in_len,
(unsigned char *)outbuf,
(void *)&new_len, NULL);
@@ -142,8 +146,8 @@ static int decompress_lzo(unsigned char *inbuf, char *outbuf, u64 compress_len,
* If the 4 byte header does not fit to the rest of the page we
* have to move to the next one, unless we read some garbage
*/
- mod_page = tot_in % PAGE_CACHE_SIZE;
- rem_page = PAGE_CACHE_SIZE - mod_page;
+ mod_page = tot_in % pagesize();
+ rem_page = pagesize() - mod_page;
if (rem_page < LZO_LEN) {
inbuf += rem_page;
tot_in += rem_page;