# HG changeset patch # User Pascal Bellard # Date 1509989600 -3600 # Node ID 43bb045c66b641cc29ad3bec1f64fee5b5402ed7 # Parent dda20bbe0a8efc782a5237f58a9b0feee3fdea14 linux-cloop: tiny patch (again) diff -r dda20bbe0a8e -r 43bb045c66b6 linux-cloop/stuff/cloop.u --- a/linux-cloop/stuff/cloop.u Mon Nov 06 18:03:36 2017 +0100 +++ b/linux-cloop/stuff/cloop.u Mon Nov 06 18:33:20 2017 +0100 @@ -1,6 +1,6 @@ --- cloop.h +++ cloop.h -@@ -20,6 +20,80 @@ +@@ -20,6 +20,81 @@ /* data_index (num_blocks 64bit pointers, network order)... */ /* compressed data (gzip block compressed format)... */ @@ -18,6 +18,7 @@ + u_int32_t optidx; /* 32-bit index number */ +}; + ++#define ntohl be32_to_cpu +static inline char *build_index(struct block_info *offsets, unsigned long n) +{ + u_int32_t *ofs32 = (u_int32_t *) offsets; @@ -26,26 +27,26 @@ + if (ofs32[0] == 0) { + if (ofs32[2]) { /* ACCELERATED KNOPPIX V1.0 */ + while (n--) { -+ offsets[n].offset = __be64_to_cpu(offsets[n].offset); ++ offsets[n].offset = be64_to_cpu(offsets[n].offset); + offsets[n].size = ntohl(offsets[n].size); + } + return (char *) "128BE accelerated knoppix 1.0"; + } + else { /* V2.0 */ -+ loff_t last = __be64_to_cpu(ofs64[n - 1]); ++ loff_t last = be64_to_cpu(ofs64[n - 1]); + while (n--) { + offsets[n].size = last - -+ (offsets[n].offset = __be64_to_cpu(ofs64[n])); ++ (offsets[n].offset = be64_to_cpu(ofs64[n])); + last = offsets[n].offset; + } + return (char *) "64BE v2.0"; + } + } + else if (ofs32[1] == 0) { /* V1.0 */ -+ loff_t last = __le64_to_cpu(ofs64[n - 1]); ++ loff_t last = le64_to_cpu(ofs64[n - 1]); + while (n--) { + offsets[n].size = last - -+ (offsets[n].offset = __le64_to_cpu(ofs64[n])); ++ (offsets[n].offset = le64_to_cpu(ofs64[n])); + last = offsets[n].offset; + } + return (char *) "64LE v1.0";