1 Submitted by: Jeremy Utley <jeremy@linuxfromscratch.org>
3 Initial Package Version: 2.12p (should apply to versions back to at least k)
4 Upstream Status: Not Submitted - Test Version
5 Origin: Alexander Patrakov, adapted from debian build of cramfs utilities
6 Description: Util-Linux fails in cramfs compilation due to changes in the
7 linux-libc-headers package 2.6.9 and after. This patch is a proper fix to the
8 problem, but may in fact not be accepted upstream.
11 diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-utils/fsck.cramfs.c
12 --- util-linux-2.12p/disk-utils/fsck.cramfs.c 2004-12-11 14:53:16.000000000 +0000
13 +++ util-linux-2.12p-new/disk-utils/fsck.cramfs.c 2004-12-26 00:53:10.665199086 +0000
18 -#include <asm/page.h>
20 -#define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
21 -#elif defined __ia64__
22 -#define PAGE_CACHE_SIZE (16384)
23 -#elif defined __alpha__
24 -#define PAGE_CACHE_SIZE (8192)
26 -#define PAGE_CACHE_SIZE (4096)
28 +#define PAGE_CACHE_SIZE page_size
30 /* Guarantee access to at least 8kB at a time */
31 #define ROMBUFFER_BITS 13
33 static unsigned long read_buffer_block = ~0UL;
35 /* Uncompressing data structures... */
36 -static char outbuffer[PAGE_CACHE_SIZE*2];
37 +static char *outbuffer;
40 #endif /* INCLUDE_FS_TESTS */
42 +static size_t page_size;
44 /* Input status of 0 to print help and exit without an error. */
45 static void usage(int status)
48 int c; /* for getopt */
51 + page_size = sysconf(_SC_PAGESIZE);
56 + outbuffer = malloc(page_size * 2);
58 + fprintf(stderr, _("failed to allocate outbuffer\n"));
62 /* command line options */
63 while ((c = getopt(argc, argv, "hx:v")) != EOF) {
65 diff -Naur util-linux-2.12p/disk-utils/mkfs.cramfs.c util-linux-2.12p-new/disk-utils/mkfs.cramfs.c
66 --- util-linux-2.12p/disk-utils/mkfs.cramfs.c 2004-12-11 14:56:01.000000000 +0000
67 +++ util-linux-2.12p-new/disk-utils/mkfs.cramfs.c 2004-12-26 00:53:10.666198928 +0000
69 static const char *progname = "mkcramfs";
70 static int verbose = 0;
73 -#define PAGE_CACHE_SIZE (16384)
74 -#elif defined __alpha__
75 -#define PAGE_CACHE_SIZE (8192)
77 -#define PAGE_CACHE_SIZE (4096)
80 /* The kernel assumes PAGE_CACHE_SIZE as block size. */
81 -static unsigned int blksize = PAGE_CACHE_SIZE; /* settable via -b option */
82 +static unsigned int blksize; /* settable via -b option */
83 static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */
84 static int image_length = 0;
87 u32 crc = crc32(0L, Z_NULL, 0);
90 + blksize = sysconf(_SC_PAGESIZE);