Commit Graph

32 Commits (460c0af190ea11c903dd0e0730cfc7c3d279bcc8)

Author SHA1 Message Date
Theodore Ts'o 67861e5bf3 libext2fs: add default_bitmap_type to the ext2_filsys structure
This allows a program to control the bitmap backend implementation
that will get used without needing to change the current library API.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 00:28:43 -05:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Theodore Ts'o 94968e749b libext2fs: teach bitmap functions about bigalloc/cluster
This patch makes the following changes:

* ext2fs_allocate_block_bitmap() now allocates a bitmap with cluster
  granularity for bigalloc file systems.  For mke2fs and e2fsck, a
  newly added function, ext2fs_allocate_subcluster_bitmap() allocates
  a bitmap with block granularity (even for bigalloc file systems).
  The newly added function ext2fs_get_bitmap_granularity() will return
  the number of bits (log2) of the granularity used by the bitmap.

* The ext2fs_{mark,unmark,test}_block_bitmap2() functions will shift
  their passed-in argument by log2(cluster_ganularity) bits right.
  This means that the arguments for the single-argument bitmap
  functions will be interpreted with block granluarity, since this
  minimizes code changes in the rest of the code base.

* The ext2fs_{get,set}_block_bitmap_range() functions will interpret
  their arguments in cluster granularity.  This is a bit inconsistent,
  but the caller of those functions will need to be taught about the
  subtleties of clusters for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-10 17:55:09 -04:00
Theodore Ts'o 6a6337c3df Merge branch 'maint' into next
Conflicts:
	lib/ext2fs/bitmaps.c
	lib/ext2fs/rw_bitmaps.c
	misc/dumpe2fs.c
2011-06-04 20:24:36 -04:00
Theodore Ts'o b92fbed778 libext2fs: Teach block bitmap read, write, and allocation funcs about clusters
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-04 20:05:22 -04:00
Theodore Ts'o 97d26ce9e3 Merge branch 'maint' into next
Conflicts:
	e2fsck/journal.c
	e2fsck/pass1.c
	e2fsck/pass2.c
	misc/mke2fs.c
2010-06-07 12:42:40 -04:00
Theodore Ts'o 543547a52a libe2p, libext2fs: Update file copyright permission states to match COPYING
The top-level COPYING file states that the e2p and ext2fs libraries
are available under the LGPLv2.  The files were incorrectly labelled.
Alex Thomas/Luster has been consulted wrt to the ext3_extents.h file;
the rest of the files were primarily authored by Theodore Ts'o.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-17 23:04:39 -04:00
Valerie Aurora Henson c5b7b6babe Fix overflow in calculation of total file system blocks
Blocks per group and group desc count are both 32-bit; multiplied they
produce a 32-bit quantity which overflowed.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 21:23:03 -04:00
Valerie Aurora Henson 8f82ef9860 Convert libext2fs to 64-bit bitmap interface
(Includes fixes from Nick Dokos)

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-05 00:27:10 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o f1f115a78f libext2fs: 32-bit bitmap refactorization, part 3
Create new functions ext2fs_{set,get}_{inode,block}_bitmap_range()
which allow programs like e2fsck, dumpe2fs, etc. to get and set chunks
of the bitmap at a time.

Move the representation details of the 32-bit old-style bitmaps into
gen_bitmap.c.

Change calls in dumpe2fs, mke2s, et. al to use the new abstractions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-23 04:32:48 -04:00
Theodore Ts'o 50448d3dff libext2fs: 32-bit bitmap refactorization, part 2
Move the contents of rs_bitmap.c and cmp_bitmaps.c into gen_bitmap.c
and bitmaps.c.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-22 23:42:14 -04:00
Theodore Ts'o a0553c9d6e libext2fs: 32-bit bitmap refactorization, part 1
Move the 32-bit specific bitmap code into gen_bitmap.c, and the
high-level interfaces into bitmaps.c.  Eventually we'll move the
new-style bitmap code into gen_bitmap64.c, but first we need to
isolate the code with knowledge of the bitmap internals in one place
first.

In this patch we move allocation, free, copy, clear, set_padding, and
fudge_end function into gen_bitmap.c, and make sure that the bitmaps.c
and bitops.c no longer have any knowledge of the bitmap internals.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-22 22:59:50 -04:00
Eric Sandeen 5830d6be9c Detect overflows in loop counters
For loops such as:

for (i=1; i <= fs->super->s_blocks_count; i++) {
        <do_stuff>
}

if i is an int and s_blocks_count is (2^32-1), the condition is never false.
Change these loops to:

for (i=1; i <= fs->super->s_blocks_count && i > 0; i++) {
        <do_stuff>
}

to stop the loop when we overflow i

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-08-30 02:16:55 -04:00
Theodore Ts'o c4e3d3f374 ext2fs_getmem(), ext2fs_free_mem(), and ext2fs_resize_mem()
all now take a 'void *' instead of a 'void **' in order to 
avoid pointer aliasing problems with GCC 3.x.
2003-08-01 09:41:07 -04:00
Theodore Ts'o 9f8046fc6d Many files:
alloc.c, alloc_tables.c, badblocks.c, bb_compat.c, bb_inode.c,
  	bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
  	check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c, dblist_dir.c,
  	dir_iterate.c, dirblock.c, dupfs.c, expanddir.c, ext2_fs.h, fileio.c,
  	finddev.c, flushb.c, freefs.c, get_pathname.c, getsize.c, icount.c,
  	imager.c, initialize.c, inline.c, inode.c, irel_ma.c, ismounted.c,
  	link.c, lookup.c, mkdir.c, mkjournal.c, namei.c, native.c, newdir.c,
  	nt_io.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
  	rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c, tst_byteswap.c,
  	tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
  	version.c, write_bb_file.c, ext2_fs.h: Moved file from include/linux.
  	Adjust all files in this directroy to include this file.
2001-05-14 11:35:52 +00:00
Theodore Ts'o 31dbecd482 Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
  	brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
  	expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
  	icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
  	mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
  	tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
  	to protect applications that attempt to compile
  	-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?).  So
  	we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 04:54:39 +00:00
Theodore Ts'o b5abe6fac9 Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
  	so that we don't need to call get_next_blockgroup() the first
  	time around.  Saves a bit of time, and prevents us from
  	needing to assign -1 to current_group (which is an unsigned
  	value).
  icount.c (insert_icount_el): Cast the estimated number of inodes
  	from a float to an ino_t.
  alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
  	bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
  	check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
  	dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
  	ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
  	icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
  	ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
  	newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
  	rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
  	tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
  	version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
  	of the ext2-specific header files are in a flat directory.
  block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
  	all assignments from void * to be compatible with C++.
  closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
  	make sure the contents of the disk are flushed to disk.
  dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
  	avoid C++ namespace clash.
  bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
  	avoid C++ namespace clash.
  ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
  	irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
  	ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
  	unlink.c: Change private to be priv_data (to avoid C++
  	namespace clash)
1998-01-19 14:47:53 +00:00
Theodore Ts'o 5be8dc2143 Many files:
dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more paranoid
  	about validating the directory counts from the block group
  	information.
  all files: Don't include stdlib.h anymore; include it in ext2_fs.h,
  	since that file requires stdlib.h
ChangeLog, Makefile.in, dirinfo.c:
  dirinfo.c (e2fsck_add_dir_info): Use ext2fs_get_num_dirs instead of
  	e2fsck_get_num_dirs, which has been removed.
  Makefile.in (PROGS): Remove @EXTRA_PROGS@, since we don't want to
  	compile and install flushb.
ChangeLog, configure.in:
  Remove @EXTRA_PROGS@, since we aren't using it in 2fsck/Makefile.in anymore
ChangeLog, Makefile.in:
  Install debugfs in /sbin, instead of /usr/sbin.
libext2fs.texinfo:
  Update version string to be 1.12
Makefile.in:
  Fix bug in find script which made the exclusion list, where a '-' was
  missing from an -name option.
1997-12-01 18:24:10 +00:00
Theodore Ts'o 7b4e4534f9 Many files:
Added definition of ext2fs_get_mem, ext2fs_free_mem, and
  ext2fs_resize_mem in ext2fs.h, and changed all library routines to use
  these wrapper functions.
1997-10-26 03:41:24 +00:00
Theodore Ts'o c555aebde4 Many files:
alloc.c (ext2fs_alloc_block): New function which allocates a
  	block and updates the filesystem accounting records
  	appropriately.
  ext2_err.et.in: Added new error codes: EXT2_NO_MEMORY,
  	EXT2_INVALID_ARGUMENT, EXT2_BLOCK_ALLOC_FAIL, EXT2_INODE_ALLOC_FAIL,
  	EXT2_NOT_DIRECTORY
  Change various library files to use these functions instead of EINVAL,
  ENOENT, etc.
ChangeLog, pass1.c, pass3.c:
  pass3.c (get_lost_and_found): Check error return of
  	EXT2_FILE_NOT_FOUND instead of ENOTDIR
  pass1.c (pass1_check_directory): Return EXT2_NO_DIRECTORY instead of
  	ENOTDIR
expect.icount:
  Change expected error string to be "Invalid argument passed to ext2 library"
  instead of just "Invalid argument"
1997-10-25 04:16:53 +00:00
Theodore Ts'o 1d2ff46ae7 Many files:
Add #ifdef's for HAVE_SYS_STAT_H and HAVE_SYS_TYPES_H
1997-10-19 23:00:21 +00:00
Theodore Ts'o fff876b7c7 ChangeLog, bitmaps.c, bitops.h:
ext2fs_set_bitmap_padding: New function which sets the padding of the
  	bitmap to be all one's.
1997-09-13 00:32:29 +00:00
Theodore Ts'o 4cbe8af4b0 Many files:
block.c (ext2fs_block_iterate2): Use retval which is a errcode_t type.
  bitmaps.c (make_bitmap): Use size_t instead of int where appropriate.
  bb_inode.c (set_bad_block_proc): Add #pragma argsused for Turbo C.
  alloc.c (ext2fs_new_inode): Use ino_t instead of int for the group number.
  get_pathname.c: Use ino_t instead of int where appropriate.
  ext2fs.h: Make the magic structure element be errcode_t instead of int.
  alloc.c alloc_tables.c badblocks.c bb_compat.c bb_inode.c
  	bitmaps.c block.c bmove.c brel_ma.c check_desc.c closefs.c
  	cmp_bitmaps.c dblist.c dblist_dir.c dir_iterate.c dirblock.c
  	dupfs.c expanddir.c freefs.c get_pathname.c icount.c
  	initialize.c inline.c inode.c irel_ma.c link.c llseek.c
  	lookup.c mkdir.c namei.c newdir.c read_bb.c read_bb_file.c
  	rs_bitmap.c rw_bitmaps.c swapfs.c test_io.c tst_badblocks.c
  	tst_iscan.c unix_io.c unlink.c valid_blk.c version.c: Add an
  	#ifdef for HAVE_UNISTD_H
1997-08-10 23:07:40 +00:00
Theodore Ts'o 1e1da29fbd Many files:
bmove.c (ext2fs_move_blocks): New function which takes a bitmap of
  	blocks which need to be moved, and moves those blocks to another
  	location in the filesystem.
  rs_bitmap.c (ext2fs_resize_generic_bitmap): When expanding a bitmap,
  	make sure all of the new parts of the bitmap are zero.
  bitmaps.c (ext2fs_copy_bitmap): Fix bug; the destination bitmap wasn't
  	being returned to the caller.
  alloc_tables.c (ext2fs_allocate_group_table): Add new function
  	ext2fs_allocate_group_table() which sets the group tables for a
  	particular block group.  The relevant code was factored out of
  	ext2fs_allocate_tables().
  dblist.c (make_dblist): Adjust the initial size of the directory block
  	list to be a bit more realize (ten plus twice the number of
  	directories in the filesystem).
  Check in interim work.
1997-06-09 14:51:29 +00:00
Theodore Ts'o a29f4d30f2 Many files:
Checkin of e2fsprogs 1.10
1997-04-29 21:26:48 +00:00
Theodore Ts'o 21c84b71e2 Many files:
Checked in e2fsprogs-1.07
1997-04-29 16:15:03 +00:00
Theodore Ts'o 5c576477cc Many files:
Checked in e2fsprogs 1.06
1997-04-29 15:29:49 +00:00
Theodore Ts'o 1e3472c5f3 Many files:
Checked in e2fsprogs 1.05
1997-04-29 14:53:37 +00:00
Theodore Ts'o 50e1e10fa0 Many files:
Checked in e2fsprogs 0.5c
1997-04-26 13:58:21 +00:00
Theodore Ts'o f3db3566b5 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:34:30 +00:00
Theodore Ts'o 3839e65723 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:21:57 +00:00