Imported reiserfsprogs-3.6.18

This commit is contained in:
Jeff Mahoney committed 2012-10-11 11:30:57 -04:00
1 parent 18057cdad6
commit 3078c83c48
64 files changed
+6508 -1071

No files matched your search

+21 -7
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# Makefile.in generated by automake 1.7.6 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -35,6 +35,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
@@ -63,7 +64,11 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -85,12 +90,21 @@ ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
@@ -111,6 +125,7 @@ libcore_a_SOURCES = do_balan.c fix_node.c hashes.c ibalance.c lbalance.c prints.
stree.c node_formats.c reiserfslib.c bitmap.c journal.c includes.h
subdir = reiserfscore
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
@@ -145,10 +160,10 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu reiserfscore/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
AR = ar
@@ -184,7 +199,7 @@ distclean-depend:
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -195,7 +210,7 @@ distclean-depend:
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@@ -294,7 +309,6 @@ check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
-10
View File
@@ -6,16 +6,6 @@
#include "includes.h"
/* this is one and only function that is used outside (do_balance.c) */
int balance_internal (
/*struct reiserfs_transaction_handle *th,*/
struct tree_balance * ,
int,
int,
struct item_head * ,
struct buffer_head **
);
/* modes of internal_shift_left, internal_shift_right and internal_insert_childs */
#define INTERNAL_SHIFT_FROM_S_TO_L 0
#define INTERNAL_SHIFT_FROM_R_TO_S 1
+8 -11
View File
@@ -3,22 +3,19 @@
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include <stdio.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "io.h"
#include "misc.h"
#include "reiserfs_lib.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <asm/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <malloc.h>
#include <sys/vfs.h>
#include <unistd.h>
#include <time.h>
#include "io.h"
#include "misc.h"
#include "reiserfs_lib.h"
#include "swab.h"
#include "../include/config.h"
+48 -44
View File
@@ -3,15 +3,9 @@
* reiserfsprogs/README
*/
#include "includes.h"
#define _GNU_SOURCE
/* this is provided for anybody who wants to deal with journal */
int replay_one_transaction (reiserfs_filsys_t *, reiserfs_trans_t *);
void for_each_transaction (reiserfs_filsys_t *, action_on_trans_t);
void for_each_block (reiserfs_filsys_t *, reiserfs_trans_t *, action_on_block_t);
int get_boundary_transactions (reiserfs_filsys_t *, reiserfs_trans_t *,
reiserfs_trans_t *);
int next_transaction (reiserfs_filsys_t *, reiserfs_trans_t *, reiserfs_trans_t);
#include "includes.h"
/* compares description block with commit block. returns 0 if they differ, 1
if they match */
@@ -185,7 +179,6 @@ int get_boundary_transactions (reiserfs_filsys_t * fs,
}
#define TRANS_FOUND 1
#define TRANS_LAST 2
#define TRANS_NOT_FOUND 0
/* trans is a valid transaction. Look for valid transaction with smallest
@@ -235,8 +228,6 @@ int next_transaction (reiserfs_filsys_t * fs, reiserfs_trans_t * trans, reiserfs
trans->commit_blocknr = commit_expected (fs, next_d_bh);
trans->next_trans_offset = next_desc_expected (fs, next_d_bh) - j_start;
found = TRANS_FOUND;
if (break_trans.trans_id == get_desc_trans_id (next_d_bh))
found = TRANS_LAST;
}
brelse (d_bh);
@@ -327,6 +318,7 @@ int replay_one_transaction (reiserfs_filsys_t * fs,
reiserfs_trans_t * trans)
{
for_each_block (fs, trans, read_journal_write_in_place);
fsync(fs->fs_dev);
return 0;
}
@@ -341,10 +333,7 @@ void for_each_transaction (reiserfs_filsys_t * fs, action_on_trans_t action)
while (1) {
action (fs, &oldest);
if (ret == TRANS_LAST)
break;
ret = next_transaction (fs, &oldest, newest);
if (ret == TRANS_NOT_FOUND)
if ((ret = next_transaction (fs, &oldest, newest)) == TRANS_NOT_FOUND)
break;
}
}
@@ -497,7 +486,11 @@ int reiserfs_open_journal (reiserfs_filsys_t * fs, char * j_filename, int flags)
}
}
fs->fs_journal_dev = open (j_filename, flags | O_LARGEFILE);
fs->fs_journal_dev = open (j_filename, flags
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fs->fs_journal_dev == -1)
return -1;
@@ -624,7 +617,11 @@ int reiserfs_create_journal(
*/
}
fs->fs_journal_dev = open (j_device, O_RDWR | O_LARGEFILE);
fs->fs_journal_dev = open (j_device, O_RDWR
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fs->fs_journal_dev == -1) {
reiserfs_warning (stderr, "reiserfs_create_journal: could not open "
"%s: %s\n", j_device, strerror(errno));
@@ -691,7 +688,11 @@ void reiserfs_reopen_journal (reiserfs_filsys_t * fs, int flag)
if (close (fs->fs_journal_dev))
die ("reiserfs_reopen_journal: closed failed: %s", strerror(errno));
fs->fs_journal_dev = open (fs->fs_j_file_name, flag | O_LARGEFILE);
fs->fs_journal_dev = open (fs->fs_j_file_name, flag
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fs->fs_journal_dev == -1)
die ("reiserfs_reopen_journal: could not reopen journal device");
@@ -734,17 +735,21 @@ void reiserfs_close_journal (reiserfs_filsys_t * fs)
}
/* update journal header */
static void update_journal_header (struct buffer_head * bh_jh, reiserfs_trans_t trans) {
static void update_journal_header (reiserfs_filsys_t * fs,
struct buffer_head * bh_jh,
reiserfs_trans_t *trans)
{
struct reiserfs_journal_header * j_head;
j_head = (struct reiserfs_journal_header *)(bh_jh->b_data);
/* update journal header */
set_jh_last_flushed (j_head, trans.trans_id);
set_jh_mount_id (j_head, trans.mount_id);
set_jh_replay_start_offset (j_head, trans.next_trans_offset);
set_jh_last_flushed (j_head, trans->trans_id);
set_jh_mount_id (j_head, trans->mount_id);
set_jh_replay_start_offset (j_head, trans->next_trans_offset);
mark_buffer_dirty (bh_jh);
bwrite (bh_jh);
fsync(fs->fs_journal_dev);
}
/* fixme: what should be done when not all transactions can be replayed in proper order? */
@@ -780,29 +785,21 @@ int replay_journal (reiserfs_filsys_t * fs)
replayed = 0;
ret = TRANS_FOUND;
while (cur.mount_id != control.mount_id || cur.trans_id != control.trans_id) {
if (control.mount_id == cur.mount_id && control.trans_id == 0 &&
control.desc_blocknr == 0)
/* Looking to the first valid not replayed transaction. */
while (1) {
if (cur.mount_id == control.mount_id &&
cur.trans_id > control.trans_id)
break;
ret = next_transaction (fs, &cur, newest);
if (ret != TRANS_FOUND)
if ((ret = next_transaction (fs, &cur, newest)) != TRANS_FOUND)
break;
}
while (ret == TRANS_FOUND) {
if (control.mount_id != cur.mount_id || control.trans_id != 0 ||
control.desc_blocknr != 0)
{
ret = next_transaction (fs, &cur, newest);
if (ret == TRANS_NOT_FOUND)
break;
if (cur.mount_id != control.mount_id || cur.trans_id != control.trans_id + 1)
break;
}
/* If not the next transaction to be replayed, break out here. */
if ((cur.mount_id != control.mount_id) ||
(cur.trans_id != control.trans_id + 1 && control.trans_id))
break;
if (!transaction_check_content(fs, &cur)) {
reiserfs_warning (stderr, "Trans broken: mountid %lu, transid %lu, desc %lu, "
@@ -816,17 +813,24 @@ int replay_journal (reiserfs_filsys_t * fs)
cur.mount_id, cur.trans_id, cur.desc_blocknr, cur.trans_len,
cur.commit_blocknr, cur.next_trans_offset);
replay_one_transaction (fs, &cur);
update_journal_header (bh, cur);
update_journal_header (fs, bh, &cur);
control = cur;
replayed ++;
ret = next_transaction (fs, &cur, newest);
}
reiserfs_warning (stderr, "%d transactions replayed\n", replayed);
reiserfs_warning (stderr, "Reiserfs journal '%s' in blocks [%u..%u]: %d "
"transactions replayed\n", fs->fs_j_file_name,
get_jp_journal_1st_block(sb_jp(fs->fs_ondisk_sb)),
get_jp_journal_1st_block(sb_jp(fs->fs_ondisk_sb)) +
get_jp_journal_size(sb_jp(fs->fs_ondisk_sb)) + 1,
replayed);
mark_buffer_dirty (fs->fs_super_bh);
bwrite (fs->fs_super_bh);
update_journal_header (bh, newest);
update_journal_header (fs, bh, &newest);
return 0;
}
+4 -2
View File
@@ -949,7 +949,8 @@ void leaf_cut_from_buffer (reiserfs_filsys_t * fs,
set_dc_child_size (dc, get_dc_child_size (dc) - cut_size);
mark_buffer_dirty(bi->bi_parent);
}
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF &&
is_a_leaf(bh->b_data, bh->b_size) != HAS_IH_ARRAY)
reiserfs_panic ("leaf_cut_from_buffer: bad leaf %lu: %b",
bh->b_blocknr, bh);
}
@@ -1015,7 +1016,8 @@ static void leaf_delete_items_entirely (reiserfs_filsys_t * fs,
(j - last_removed_loc + IH_SIZE * del_num));
mark_buffer_dirty(bi->bi_parent);
}
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF)
if (is_a_leaf(bh->b_data, bh->b_size) != THE_LEAF &&
is_a_leaf(bh->b_data, bh->b_size) != HAS_IH_ARRAY)
reiserfs_panic ("leaf_delete_items_entirely: bad leaf %lu: %b", bh->b_blocknr, bh);
}
+3 -3
View File
@@ -202,9 +202,9 @@ int is_tree_node (struct buffer_head * bh, int level)
static int is_desc_block (char * buf, unsigned long buf_size)
{
struct reiserfs_journal_desc *desc = (struct reiserfs_journal_desc *)buf;
if (!memcmp(buf + buf_size - 12, JOURNAL_DESC_MAGIC, 8) &&
//get_jdesc_len (desc) > 0)
le32_to_cpu(*((__u32*)(buf + 4))) > 0)
le32_to_cpu (desc->j2_len) > 0)
return 1;
return 0;
}
@@ -495,7 +495,7 @@ static int is_bad_indirect (reiserfs_filsys_t * fs, struct item_head * ih, char
for (i = 0; i < I_UNFM_NUM (ih); i ++) {
if (!ind [i])
continue;
if (check_unfm_func && check_unfm_func (fs, le32_to_cpu(ind [i])))
if (check_unfm_func && check_unfm_func (fs, d32_get (ind, i)))
return 1;
}
+4 -2
View File
@@ -3,6 +3,8 @@
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include "includes.h"
#include <stdarg.h>
#include <limits.h>
@@ -392,9 +394,9 @@ void print_indirect_item (FILE * fp, struct buffer_head * bh, int item_num)
reiserfs_warning (fp, "%d pointer%s\n[", I_UNFM_NUM (ih),
I_UNFM_NUM (ih) != 1 ? "s" : "" );
for (j = 0; j < I_UNFM_NUM (ih); j ++) {
if (sequence_finished (prev, &num, unp[j])) {
if (sequence_finished (prev, &num, d32_get(unp, j))) {
print_sequence (fp, prev, num);
start_new_sequence (&prev, &num, unp[j]);
start_new_sequence (&prev, &num, d32_get(unp, j));
}
}
print_sequence (fp, prev, num);
+27 -27
View File
@@ -3,6 +3,8 @@
* reiserfsprogs/README
*/
#define _GNU_SOURCE
#include "includes.h"
#include <linux/kdev_t.h>
@@ -63,7 +65,11 @@ reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int *error, void
if (error)
*error = 0;
fd = open (filename, flags | O_LARGEFILE);
fd = open (filename, flags
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fd == -1) {
if (error)
*error = errno;
@@ -199,7 +205,11 @@ reiserfs_filsys_t * reiserfs_create (char * filename,
return 0;
}
fs->fs_dev = open (filename, O_RDWR | O_LARGEFILE);
fs->fs_dev = open (filename, O_RDWR
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fs->fs_dev == -1) {
reiserfs_warning (stderr, "reiserfs_create: could not open %s: %s\n",
filename, strerror(errno));
@@ -322,7 +332,11 @@ static void reiserfs_only_reopen (reiserfs_filsys_t * fs, int flag)
if (close (fs->fs_dev))
die ("reiserfs_reopen: closed failed: %s", strerror(errno));
fs->fs_dev = open (fs->fs_file_name, flag | O_LARGEFILE);
fs->fs_dev = open (fs->fs_file_name, flag
#if defined(O_LARGEFILE)
| O_LARGEFILE
#endif
);
if (fs->fs_dev == -1)
die ("reiserfs_reopen: could not reopen device: %s", strerror(errno));
@@ -413,18 +427,6 @@ int reiserfs_free_block (reiserfs_filsys_t * fs, unsigned long block)
return 0;
}
/*
inline int reiserfs_bin_search (void * key, void * base, int num, int width,
int *ppos, comparison_fn_t comp_func) {
__u32 position = *ppos;
int retval;
retval = reiserfs_bin_search (key, base, num, width, &position, comp_func);
*ppos = position;
return retval;
}
*/
static int reiserfs_search_by_key_x (reiserfs_filsys_t * fs, struct key * key,
struct path * path, int key_length)
{
@@ -572,16 +574,14 @@ int usearch_by_position (reiserfs_filsys_t * s, struct key * key,
static int comp_dir_entries (const void * p1, const void * p2)
{
__u32 deh_offset;
const __u32 * off1, * off2;
__u32 off1, off2;
off1 = p1;
off2 = p2;
deh_offset = le32_to_cpu (*off1);
if (deh_offset < *off2)
off1 = d32_get((__u32 *)p1, 0);
off2 = *(__u32 *)p2;
if (off1 < off2)
return -1;
if (deh_offset > *off2)
if (off1 > off2)
return 1;
return 0;
}
@@ -1211,8 +1211,8 @@ int can_we_format_it (char * device_name, int force)
reiserfs_warning (stderr, "%s is not a block special device\n", device_name);
check_forcing_ask_confirmation (force);
} else {
if ((IDE_DISK_MAJOR (MAJOR(rdev)) && MINOR(rdev) % 64 == 0) ||
(SCSI_BLK_MAJOR (MAJOR(rdev)) && MINOR(rdev) % 16 == 0)) {
if ((IDE_DISK_MAJOR (major(rdev)) && minor(rdev) % 64 == 0) ||
(SCSI_BLK_MAJOR (major(rdev)) && minor(rdev) % 16 == 0)) {
/* /dev/hda or similar */
reiserfs_warning (stderr, "%s is entire device, not just one partition!\n",
device_name);
@@ -1351,9 +1351,9 @@ void mark_badblock(reiserfs_filsys_t *fs,
tmp_ih = get_ih(badblock_path);
ind_item = (__u32 *)get_item(badblock_path);
for (i = 0; i < I_UNFM_NUM(tmp_ih); i++, ind_item++) {
for (i = 0; i < I_UNFM_NUM(tmp_ih); i++) {
reiserfs_bitmap_set_bit(fs->fs_badblocks_bm,
le32_to_cpu(*ind_item));
d32_get(ind_item, i));
}
pathrelse (badblock_path);
+2 -2
View File
@@ -60,8 +60,8 @@ int comp_short_keys (const void * k1, const void * k2)
__u32 u1, u2;
for( ; n_key_length--; ++p_s_key1, ++p_s_key2 ) {
u1 = le32_to_cpu(*p_s_key1) ;
u2 = le32_to_cpu(*p_s_key2) ;
u1 = d32_get(p_s_key1, 0) ;
u2 = d32_get(p_s_key2, 0) ;
if ( u1 < u2 )
return -1;
if ( u1 > u2 )