[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTik4BmOSZ9xqsMcMVN_fkB79ySGQVVK56i1xUmFt@mail.gmail.com>
Date: Mon, 7 Jun 2010 20:14:06 -0600
From: Jeffrey Merkey <jeffmerkey@...il.com>
To: linux-kernel@...r.kernel.org
Subject: Fwd: EXT3 File System Corruption 2.6.34
---------- Forwarded message ----------
From: Jeffrey Merkey <jeffmerkey@...il.com>
Date: Mon, Jun 7, 2010 at 8:13 PM
Subject: Re: EXT3 File System Corruption 2.6.34
To: Eric Sandeen <sandeen@...deen.net>
Well, I will set this as default from now on. Tell Evil Emperor Linus
to put the fucking thing back the way it was so default kernel builds
are not fucked up.
Jeff
here is the source to the xdump.c file. may be useful in the future
to someone who needs a tool to dump files to post to the list. Anyway
-- easier to use than that fucking hexedit program.
:-)
// Released under GPLv2 or whatever fucking version you like
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
unsigned char *dumpAsBytes(unsigned char *p, unsigned long size,
unsigned long base)
{
register unsigned long i, r, total, count;
register unsigned char *op = p;
count = size / 16;
printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");
for (r=0; r < count; r++)
{
printf("%08X ", (p - op) + base);
for (total = 0, i=0; i < 16; i++, total++)
{
printf(" %02X", (unsigned char) p[i]);
}
printf(" ");
for (i=0; i < total; i++)
{
if (p[i] < 32 || p[i] > 126)
printf(".");
else printf("%c", p[i]);
}
printf("\n");
p = (void *)((unsigned long) p + (unsigned long) total);
}
return p;
}
unsigned char *dumpAsLong(unsigned char *p, unsigned long size,
unsigned long base)
{
register int i, r, count;
register unsigned char *op = p;
unsigned long *lp;
count = size / 16;
lp = (unsigned long *) p;
for (r=0; r < count; r++)
{
printf("%08X ", (p - op) + base);
for (i=0; i < (16 / 4); i++)
{
printf(" %08X", (unsigned long) lp[i]);
}
printf(" ");
for (i=0; i < 16; i++)
{
if (p[i] < 32 || p[i] > 126) printf(".");
else printf("%c", p[i]);
}
printf("\n");
p = (void *)((unsigned long) p + (unsigned long) 16);
lp = (unsigned long *) p;
}
return p;
}
int getch(void)
{
return getc(stdin);
}
unsigned long pause(void)
{
extern int getch(void);
register unsigned long key;
printf(" --- More --- ");
key = getch();
printf("%c %c", '\r', '\r');
if (key == 0x1B) // ESCAPE
return 1;
else
return 0;
}
unsigned char buffer[512];
int main(int argc, char *argv[])
{
unsigned long rc, total = 0, offset = 0;
register int fp;
if (argc < 2)
{
printf("USAGE: dump <filename.ext> <offset>\n");
return 1;
}
if (argc == 3)
offset = atol(argv[2]);
fp = open(argv[1], O_RDWR);
if (fp < 0)
{
printf("error opening file [%s]\n", argv[1]);
return 1;
}
rc = lseek(fp, offset, SEEK_SET);
if (rc == -1)
{
printf("error seeking file offset %d\n", offset);
return 1;
}
total = offset;
while (rc = read(fp, buffer, 256))
{
dumpAsBytes(buffer, rc, total);
total += rc;
if (pause())
break;
}
close(fp);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists