Imported reiserfsprogs-3.6.13
This commit is contained in:
1 parent
cccefa4d84
commit
18057cdad6
78 files changed
+1697
-2226
No files matched your search
@@ -77,6 +77,7 @@ RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
UUID_LIBS = @UUID_LIBS@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
|
||||
+17
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -621,8 +621,8 @@ void do_one_corruption_in_one_block (reiserfs_filsys_t * fs,
|
||||
int do_one_ih_corrupt (struct item_head * ih, unsigned int nr_bytes)
|
||||
{
|
||||
if (nr_bytes > IH_SIZE) {
|
||||
printf ("Bad byte number %u expected not more then %d\n", nr_bytes,
|
||||
IH_SIZE);
|
||||
printf ("Bad byte number %u expected not more then %lu\n", nr_bytes,
|
||||
(unsigned long)IH_SIZE);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -662,10 +662,13 @@ int do_one_ih_random_corrupt (struct item_head * ih)
|
||||
}
|
||||
|
||||
/* Corrupt n bytes in block header */
|
||||
int corrupt_block_header (struct block_head * blkh, unsigned int offset, unsigned int bytes )
|
||||
int corrupt_block_header (struct block_head * blkh, unsigned int offset,
|
||||
unsigned int bytes)
|
||||
{
|
||||
if ((offset + bytes) > BLKH_SIZE) {
|
||||
printf ("Bad offset number: %u or bad bytes number: %u, the suumary value expected not more then %d\n", offset, bytes, BLKH_SIZE );
|
||||
printf ("Bad offset number: %u or bad bytes number: %u, the suumary "
|
||||
"value expected not more then %lu\n", offset, bytes,
|
||||
(unsigned long)BLKH_SIZE);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -685,7 +688,7 @@ void do_one_blkh_random_corrupt (struct buffer_head * bh)
|
||||
struct block_head * blkh;
|
||||
unsigned int from;
|
||||
unsigned int count;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
from = get_rand (0, BLKH_SIZE - 1);
|
||||
count = get_rand (1, BLKH_SIZE);
|
||||
@@ -777,7 +780,7 @@ void do_one_block_random_corrupt (struct buffer_head * bh)
|
||||
{
|
||||
unsigned int from = get_rand (0, bh->b_size - 1);
|
||||
unsigned int count = get_rand (1, bh->b_size);
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (from + count > bh->b_size)
|
||||
count = bh->b_size - from;
|
||||
@@ -798,11 +801,11 @@ void do_one_block_random_corrupt (struct buffer_head * bh)
|
||||
void do_bitmap_corruption (reiserfs_filsys_t * fs)
|
||||
{
|
||||
|
||||
unsigned long first = fs->fs_super_bh->b_blocknr + 1;
|
||||
unsigned long first = fs->fs_super_bh->b_blocknr + 1;
|
||||
unsigned long nr_bitmap_to_corrupt;
|
||||
unsigned long block;
|
||||
struct buffer_head * bh;
|
||||
int i;
|
||||
struct buffer_head * bh;
|
||||
unsigned int i;
|
||||
|
||||
nr_bitmap_to_corrupt = (unsigned long)get_rand (1, get_sb_bmap_nr (fs->fs_ondisk_sb) - 1);
|
||||
|
||||
@@ -834,7 +837,7 @@ void do_ih_random_corrupt (reiserfs_filsys_t * fs,
|
||||
unsigned long nr_leaves_cr)
|
||||
{
|
||||
unsigned int nr_ih_cr;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long nr_leaves = 0;
|
||||
@@ -941,7 +944,7 @@ void do_dir_random_corrupt (reiserfs_filsys_t * fs,
|
||||
unsigned long nr_leaves_cr)
|
||||
{
|
||||
unsigned int nr_ih_cr;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long nr_leaves = 0;
|
||||
@@ -1022,7 +1025,7 @@ void do_sd_random_corrupt (reiserfs_filsys_t * fs,
|
||||
unsigned long nr_leaves_cr)
|
||||
{
|
||||
unsigned int nr_ih_cr;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long nr_leaves = 0;
|
||||
@@ -1103,7 +1106,7 @@ void do_ind_random_corrupt (reiserfs_filsys_t * fs,
|
||||
unsigned long nr_leaves_cr)
|
||||
{
|
||||
unsigned int nr_ih_cr;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long nr_leaves = 0;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" -*- nroff -*-
|
||||
.\" Copyright 1996-2003 Hans Reiser.
|
||||
.\" Copyright 1996-2004 Hans Reiser.
|
||||
.\"
|
||||
.TH DEBUGREISERFS 8 "April 2003" "Reiserfsprogs 3.6.9"
|
||||
.TH DEBUGREISERFS 8 "February 2004" "Reiserfsprogs 3.6.13"
|
||||
.SH NAME
|
||||
debugreiserfs
|
||||
debugreiserfs \- debugging tool for the ReiserFS filesystem
|
||||
.SH SYNOPSIS
|
||||
.B debugreiserfs
|
||||
[
|
||||
@@ -11,7 +11,9 @@ debugreiserfs
|
||||
] [
|
||||
.B -j \fIdevice
|
||||
] [
|
||||
.B -B \fIblocknumber
|
||||
.B -B \fIfile
|
||||
] [
|
||||
.B -1 \fIN
|
||||
]
|
||||
|
||||
.\" ] [
|
||||
@@ -47,6 +49,9 @@ print contents of bitmap (not very useful)
|
||||
.B -o
|
||||
print objectid map (not very useful)
|
||||
.TP
|
||||
\fB-B\fR \fIfile\fR
|
||||
extract the filesystem list of bad blocks to the specified file.
|
||||
.TP
|
||||
\fB-1\fR \fIblocknumber\fR
|
||||
print specified block of the filesystem
|
||||
.TP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@ fprintf (stderr, "Usage: %s [options] device\n\n\
|
||||
Options:\n\
|
||||
-d\t\tprint blocks details of the internal tree\n\
|
||||
-D\t\tprint blocks details of all used blocks\n\
|
||||
-B file\textract list of badblocks\n\
|
||||
-m\t\tprint bitmap blocks\n\
|
||||
-o\t\tprint objectid map\n\n\
|
||||
-J\t\tprint journal header\n\
|
||||
@@ -19,12 +20,12 @@ Options:\n\
|
||||
-p\t\tsend filesystem metadata to stdout\n\
|
||||
-S\t\thandle all blocks, not only used\n\
|
||||
-1 block\tblock to print\n\
|
||||
-q\t\tno speed info (for -p, -s and -n)\n\n", argv[0]);\
|
||||
-q\t\tno speed info (for -p, -s and -n)\n\
|
||||
-V\t\tprint version and exit\n\n", argv[0]);\
|
||||
exit (16);\
|
||||
}
|
||||
|
||||
/*
|
||||
-B file\textract list of badblocks\n\
|
||||
|
||||
Undocumented options:
|
||||
-a map_file\n\tstore to the file the map of file. Is used with -n, -N, -r, -f\n
|
||||
@@ -55,7 +56,7 @@ struct reiserfs_fsstat {
|
||||
static void print_disk_tree (reiserfs_filsys_t * fs, unsigned long block_nr)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
int i, count;
|
||||
int i, j, count;
|
||||
static int level = -1;
|
||||
|
||||
if (level == -1)
|
||||
@@ -94,9 +95,18 @@ static void print_disk_tree (reiserfs_filsys_t * fs, unsigned long block_nr)
|
||||
|
||||
ih = B_N_PITEM_HEAD (bh, 0);
|
||||
count = leaf_item_number_estimate(bh);
|
||||
for (i = 0; i <= count; i++, ih++) {
|
||||
if (is_indirect_ih(ih))
|
||||
g_stat_info.nr_unformatted += I_UNFM_NUM(ih);
|
||||
for (i = 0; i < count; i++, ih++) {
|
||||
if (is_indirect_ih(ih)) {
|
||||
__u32 * ind_item = (__u32 *)B_I_PITEM (bh, ih);
|
||||
__u32 unfm_ptr;
|
||||
|
||||
for (j = 0; j < (int)I_UNFM_NUM (ih); j ++) {
|
||||
unfm_ptr = le32_to_cpu (ind_item [j]);
|
||||
if (unfm_ptr) {
|
||||
g_stat_info.nr_unformatted += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print_block (stdout, fs, bh, data (fs)->options & PRINT_TREE_DETAILS, -1, -1);
|
||||
@@ -202,6 +212,7 @@ static void print_one_block (reiserfs_filsys_t * fs, unsigned long block)
|
||||
char * where_to_save;
|
||||
char * badblocks_file;
|
||||
char * corruption_list_file;
|
||||
char *program_name;
|
||||
|
||||
static char * parse_options (struct debugreiserfs_data * data, int argc, char * argv [])
|
||||
{
|
||||
@@ -210,8 +221,15 @@ static char * parse_options (struct debugreiserfs_data * data, int argc, char *
|
||||
|
||||
data->scan_area = USED_BLOCKS;
|
||||
data->mode = DO_DUMP;
|
||||
|
||||
program_name = strrchr( argv[ 0 ], '/' );
|
||||
|
||||
if (program_name)
|
||||
program_name++;
|
||||
else
|
||||
program_name = argv[ 0 ];
|
||||
|
||||
while ((c = getopt (argc, argv, "a:b:C:F:SU1:psn:Nfr:dDomj:J:qtZl:L")) != EOF) {
|
||||
while ((c = getopt (argc, argv, "a:b:C:F:SU1:psn:Nfr:dDomj:JqtZl:LVB:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'a': /* -r will read this, -n and -N will write to it */
|
||||
asprintf (&data->map_file, "%s", optarg);
|
||||
@@ -314,7 +332,6 @@ static char * parse_options (struct debugreiserfs_data * data, int argc, char *
|
||||
|
||||
case 'J':
|
||||
data->options |= PRINT_JOURNAL_HEADER;
|
||||
data->journal_device_name = optarg;
|
||||
break;
|
||||
|
||||
case 'R': /* read block numbers from stdin and look for them in the
|
||||
@@ -346,13 +363,23 @@ static char * parse_options (struct debugreiserfs_data * data, int argc, char *
|
||||
/* random fs corruption */
|
||||
data->mode = DO_RANDOM_CORRUPTION;
|
||||
break;
|
||||
case 'V':
|
||||
data->mode = DO_NOTHING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (data->mode == DO_NOTHING) {
|
||||
print_banner(program_name);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (optind != argc - 1)
|
||||
/* only one non-option argument is permitted */
|
||||
print_usage_and_exit();
|
||||
|
||||
|
||||
print_banner(program_name);
|
||||
|
||||
data->device_name = argv[optind];
|
||||
return argv[optind];
|
||||
}
|
||||
@@ -473,74 +500,49 @@ static void do_dump_tree (reiserfs_filsys_t * fs)
|
||||
init_bitmap (fs);
|
||||
|
||||
if (data (fs)->options & PRINT_DETAILS || data (fs)->options & PRINT_TREE_DETAILS) {
|
||||
if (data (fs)->options & PRINT_DETAILS)
|
||||
if (data (fs)->options & PRINT_DETAILS) {
|
||||
print_disk_blocks (fs);
|
||||
else
|
||||
printf("The '%s' device with reiserfs has:\n", fs->fs_file_name);
|
||||
} else {
|
||||
print_disk_tree (fs, get_sb_root_block (fs->fs_ondisk_sb));
|
||||
printf("The internal reiserfs tree has:\n");
|
||||
}
|
||||
|
||||
/* print the statistic */
|
||||
printf ("File system uses %d internal + %d leaves + %d unformatted nodes = %d blocks\n",
|
||||
g_stat_info.nr_internals, g_stat_info.nr_leaves, g_stat_info.nr_unformatted,
|
||||
g_stat_info.nr_internals + g_stat_info.nr_leaves + g_stat_info.nr_unformatted);
|
||||
printf ("\t%d internal + %d leaves + %d unformatted nodes = %d blocks\n",
|
||||
g_stat_info.nr_internals, g_stat_info.nr_leaves, g_stat_info.nr_unformatted,
|
||||
g_stat_info.nr_internals + g_stat_info.nr_leaves + g_stat_info.nr_unformatted);
|
||||
}
|
||||
}
|
||||
|
||||
void extract_badblock_list ()
|
||||
static void callback_badblock_print(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
FILE * fd;
|
||||
struct key badblock_key = {-1, -1, {{0, 0}}};
|
||||
struct key * rdkey;
|
||||
struct path badblock_path;
|
||||
struct item_head * tmp_ih;
|
||||
__u32 i;
|
||||
__u32 * ind_item;
|
||||
struct item_head *tmp_ih;
|
||||
FILE *fd = (FILE *)data;
|
||||
__u32 *ind_item;
|
||||
__u32 i;
|
||||
|
||||
tmp_ih = get_ih(badblock_path);
|
||||
ind_item = (__u32 *)get_item(badblock_path);
|
||||
|
||||
fd = fopen (badblocks_file, "w");
|
||||
|
||||
if (fd == NULL) {
|
||||
for (i = 0; i < I_UNFM_NUM(tmp_ih); i++, ind_item++)
|
||||
fprintf (fd, "%u\n", le32_to_cpu (*ind_item));
|
||||
|
||||
pathrelse (badblock_path);
|
||||
}
|
||||
|
||||
void extract_badblock_list () {
|
||||
FILE *fd;
|
||||
|
||||
if (!(fd = fopen (badblocks_file, "w"))) {
|
||||
reiserfs_warning (stderr, "debugreiserfs: could not open badblock file %s\n",
|
||||
badblocks_file);
|
||||
badblocks_file);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
badblock_path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
||||
|
||||
set_type_and_offset (KEY_FORMAT_2, &badblock_key, 1, TYPE_INDIRECT);
|
||||
|
||||
while (1) {
|
||||
reiserfs_search_by_key_4 (fs, &badblock_key, &badblock_path);
|
||||
|
||||
if (get_blkh_nr_items ( B_BLK_HEAD (get_bh(&badblock_path))) <= PATH_LAST_POSITION (&badblock_path)) {
|
||||
break;
|
||||
}
|
||||
|
||||
tmp_ih = get_ih(&badblock_path);
|
||||
|
||||
if (get_key_dirid(&tmp_ih->ih_key) != (__u32)-1 ||
|
||||
get_key_objectid(&tmp_ih->ih_key) != (__u32)-1) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* even if offset or type are corrupted it could be a badblock list */
|
||||
if (!is_indirect_ih (tmp_ih)) {
|
||||
reiserfs_warning (stderr, "$s: a badblock item which was found has a wrong type.\n"
|
||||
" It probable contains not correct bad block list, check it.\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
ind_item = (__u32 *)B_I_PITEM (get_bh (&badblock_path), tmp_ih);
|
||||
for (i = 0; i < get_ih_item_len (tmp_ih) / UNFM_P_SIZE; i++, ind_item++)
|
||||
fprintf (fd, "%u\n", le32_to_cpu (*ind_item));
|
||||
|
||||
if ((rdkey = get_next_key_2 (&badblock_path)) == NULL)
|
||||
break;
|
||||
else
|
||||
badblock_key = *rdkey;
|
||||
|
||||
pathrelse (&badblock_path);
|
||||
}
|
||||
|
||||
pathrelse (&badblock_path);
|
||||
|
||||
badblock_list(fs, callback_badblock_print, fd);
|
||||
fclose (fd);
|
||||
}
|
||||
|
||||
@@ -634,8 +636,6 @@ int main (int argc, char * argv[])
|
||||
int error;
|
||||
struct debugreiserfs_data * data;
|
||||
|
||||
print_banner ("debugreiserfs");
|
||||
|
||||
data = getmem (sizeof (struct debugreiserfs_data));
|
||||
file_name = parse_options (data, argc, argv);
|
||||
|
||||
@@ -649,7 +649,6 @@ int main (int argc, char * argv[])
|
||||
|
||||
if (reiserfs_open_journal (fs, data (fs)->journal_device_name, O_RDONLY)) {
|
||||
fprintf(stderr, "\ndebugreiserfs: Failed to open the fs journal.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch (debug_mode (fs)) {
|
||||
@@ -706,8 +705,10 @@ int main (int argc, char * argv[])
|
||||
/*do_test (fs);*/
|
||||
break;
|
||||
case DO_EXTRACT_BADBLOCKS:
|
||||
reiserfs_warning (stderr, "Will try to extract list of bad blocks and save it to '%s' file\n", badblocks_file);
|
||||
extract_badblock_list ();
|
||||
reiserfs_warning (stderr, "Will try to extract list of bad blocks and "
|
||||
"save it to '%s' file\n", badblocks_file);
|
||||
|
||||
extract_badblock_list ();
|
||||
reiserfs_warning (stderr, "Done\n\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,7 @@ extern reiserfs_filsys_t * fs;
|
||||
tree nodes */
|
||||
#define DO_CORRUPT_ONE 2 /* used to make filesystem corruption and then test fsck */
|
||||
#define DO_CORRUPT_FILE 3 /* used to make filesystem corruption and then test fsck, the list of corruption is set on the file */
|
||||
#define DO_RANDOM_CORRUPTION 4
|
||||
#define DO_RANDOM_CORRUPTION 4
|
||||
#define DO_SCAN 5
|
||||
#define DO_RECOVER 6
|
||||
#define DO_TEST 7
|
||||
@@ -45,7 +45,7 @@ extern reiserfs_filsys_t * fs;
|
||||
#define DO_EXTRACT_BADBLOCKS 13
|
||||
#define DO_FILE_MAP 14
|
||||
#define DO_ZERO_BITMAP 15
|
||||
|
||||
#define DO_NOTHING 16
|
||||
|
||||
|
||||
/*first bits are in reiserfs_fs.b*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -407,7 +407,6 @@ static void pack_leaf (reiserfs_filsys_t * fs, struct buffer_head * bh)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* start magic in low 8 bits, hash code in high 8 bits */
|
||||
v16 = (LEAF_START_MAGIC | (func2code (fs->fs_hash_function) << 8));
|
||||
fwrite_le16 (&v16);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -819,9 +819,9 @@ static void scan_for_key (struct buffer_head * bh, struct key * key)
|
||||
i_num = leaf_item_number_estimate(bh);
|
||||
for (i = 0; i < i_num; i ++, ih ++) {
|
||||
if ((get_key_dirid(&ih->ih_key) == get_key_dirid(key) ||
|
||||
get_key_dirid(key) == ~0ul) &&
|
||||
get_key_dirid(key) == ~(__u32)0) &&
|
||||
(get_key_objectid(&ih->ih_key) == get_key_objectid(key) ||
|
||||
get_key_objectid(key) == ~0ul))
|
||||
get_key_objectid(key) == ~(__u32)0))
|
||||
{
|
||||
reiserfs_warning(log_to, "%d-th item of block %lu is item of file %K: %H\n",
|
||||
i, bh->b_blocknr, key, ih);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2002-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -205,8 +205,9 @@ void do_stat (reiserfs_filsys_t * fs)
|
||||
brelse (bh);
|
||||
}
|
||||
|
||||
reiserfs_warning (stderr, "\nThere were %lu leaves\n"
|
||||
"\ttotal number of items %lu there\n"
|
||||
reiserfs_warning (stderr, "\nThere were found on the '%s' device:\n"
|
||||
"\tleaves %lu\n"
|
||||
"\ttotal number of items %lu\n"
|
||||
"\tblocks containing at least one unique item %lu\n"
|
||||
"\tblocks which can be skipped %lu\n"
|
||||
"\t\tstat data %lu\n"
|
||||
@@ -220,6 +221,7 @@ void do_stat (reiserfs_filsys_t * fs)
|
||||
"other items %lu\n"
|
||||
"blocks containing only 1 dir item %lu\n",
|
||||
*/
|
||||
fs->fs_file_name,
|
||||
fs_stat.leaves,
|
||||
fs_stat.all,
|
||||
fs_stat.leaves - fs_stat.blocks_to_skip,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2003 by Hans Reiser, licensing governed by
|
||||
* Copyright 2000-2004 by Hans Reiser, licensing governed by
|
||||
* reiserfsprogs/README
|
||||
*/
|
||||
|
||||
@@ -489,7 +489,8 @@ static void unpack_unformatted_bitmap (int dev, int blocksize)
|
||||
// read packed reiserfs partition metadata from stdin
|
||||
void unpack_partition (int fd, int jfd)
|
||||
{
|
||||
__u32 magic32, position;
|
||||
__u32 magic32;
|
||||
long position;
|
||||
__u16 magic16;
|
||||
__u16 blocksize;
|
||||
int dev = fd;
|
||||
@@ -567,7 +568,7 @@ void unpack_partition (int fd, int jfd)
|
||||
|
||||
default:
|
||||
position = ftell(stdin);
|
||||
if (position == ~0ul)
|
||||
if (position == ~(long)0)
|
||||
die ("unpack_partition: bad magic found - %x", magic16 & 0xff);
|
||||
else
|
||||
die ("unpack_partition: bad magic found - %x, position %lu",
|
||||
@@ -615,7 +616,7 @@ int main (int argc, char ** argv)
|
||||
/* only one non-option argument is permitted */
|
||||
print_usage_and_exit();
|
||||
|
||||
if (is_mounted (argv[optind]))
|
||||
if (misc_device_mounted(argv[optind]) > 0)
|
||||
reiserfs_panic ("%s seems mounted, umount it first\n", argv[optind]);
|
||||
|
||||
fd = open (argv[optind], O_RDWR | O_LARGEFILE);
|
||||
|
||||
Reference in new issue
Block a user