05615bb878a84c40532b4cfb1466a69dd9e787c4
[hdw-linux/hdw-linux.git] / packages / base / util-linux / cramfs.patch
1 diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-utils/fsck.cramfs.c
2 --- util-linux-2.12p/disk-utils/fsck.cramfs.c   2004-12-11 14:53:16.000000000 +0000
3 +++ util-linux-2.12p-new/disk-utils/fsck.cramfs.c       2004-12-26 00:53:10.665199086 +0000
4 @@ -76,16 +76,7 @@
5  
6  #define PAD_SIZE 512
7  
8 -#include <asm/page.h>
9 -#ifdef PAGE_SIZE
10 -#define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
11 -#elif defined __ia64__
12 -#define PAGE_CACHE_SIZE (16384)
13 -#elif defined __alpha__
14 -#define PAGE_CACHE_SIZE (8192)
15 -#else
16 -#define PAGE_CACHE_SIZE (4096)
17 -#endif
18 +#define PAGE_CACHE_SIZE  page_size
19  
20  /* Guarantee access to at least 8kB at a time */
21  #define ROMBUFFER_BITS 13
22 @@ -95,11 +86,13 @@
23  static unsigned long read_buffer_block = ~0UL;
24  
25  /* Uncompressing data structures... */
26 -static char outbuffer[PAGE_CACHE_SIZE*2];
27 +static char *outbuffer;
28  z_stream stream;
29  
30  #endif /* INCLUDE_FS_TESTS */
31  
32 +static size_t page_size;
33 +
34  /* Input status of 0 to print help and exit without an error. */
35  static void usage(int status)
36  {
37 @@ -464,9 +457,17 @@
38         int c;                  /* for getopt */
39         int start = 0;
40  
41 +       page_size = sysconf(_SC_PAGESIZE);
42 +       
43         if (argc)
44                 progname = argv[0];
45  
46 +       outbuffer = malloc(page_size * 2);
47 +       if (!outbuffer) {
48 +               fprintf(stderr, _("failed to allocate outbuffer\n"));
49 +               exit(8);
50 +       }
51 +
52         /* command line options */
53         while ((c = getopt(argc, argv, "hx:v")) != EOF) {
54                 switch (c) {
55 diff -Naur util-linux-2.12p/disk-utils/mkfs.cramfs.c util-linux-2.12p-new/disk-utils/mkfs.cramfs.c
56 --- util-linux-2.12p/disk-utils/mkfs.cramfs.c   2004-12-11 14:56:01.000000000 +0000
57 +++ util-linux-2.12p-new/disk-utils/mkfs.cramfs.c       2004-12-26 00:53:10.666198928 +0000
58 @@ -46,16 +46,8 @@
59  static const char *progname = "mkcramfs";
60  static int verbose = 0;
61  
62 -#ifdef __ia64__
63 -#define PAGE_CACHE_SIZE (16384)
64 -#elif defined __alpha__
65 -#define PAGE_CACHE_SIZE (8192)
66 -#else
67 -#define PAGE_CACHE_SIZE (4096)
68 -#endif
69 -
70  /* The kernel assumes PAGE_CACHE_SIZE as block size. */
71 -static unsigned int blksize = PAGE_CACHE_SIZE; /* settable via -b option */
72 +static unsigned int blksize;                   /* settable via -b option */
73  static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */
74  static int image_length = 0;
75  
76 @@ -730,6 +722,7 @@
77         u32 crc = crc32(0L, Z_NULL, 0);
78         int c;
79  
80 +       blksize = sysconf(_SC_PAGESIZE);
81         total_blocks = 0;
82  
83         if (argc) {