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