summaryrefslogtreecommitdiff
path: root/lib/ext2fs/getsize.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-06libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargsTheodore Ts'o1-1/+1
Some architectures have narrow mode_t's which can cause some portability warnings with varargs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24misc: quiet minor compiler errorsAndreas Dilger1-7/+3
Several compiler errors are quieted: - zero-length gnu_printf format string - unused variable - uninitalized variable (though it isn't actually used for anything) - fixed a bug in ext2fs_stat() if stat64() does not exist Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-18Shorten compile commands run by the build systemTheodore Ts'o1-0/+1
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-15e2fsprogs: create open() and stat() helpersLukas Czerner1-5/+1
In many places we are using #ifdef HAVE_OPEN64 to determine if we can use open64() but that's ugly. This commit creates two new helpers ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need new typedef ext2fs_struct_stat for struct stat. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11misc: fix compile warnings on OSXAndreas Dilger1-1/+1
The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not really have anything to do with __GNUC__ (which is also used on OS/X and Solaris). Only print these warnings on Linux systems. statfs64() is deprecated on OSX and generates a deliberate warning. Fix some other warnings that show up on OSX builds. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-05-17libe2p, libext2fs: Update file copyright permission states to match COPYINGTheodore Ts'o1-2/+2
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>
2009-01-20ext2fs_get_device_size: Fix error handlingTheodore Ts'o1-5/+6
The previous patch would return EFBIG for any failure called from ext2fs_get_device_size2(). (I didn't merge this fix with the preceeding commit to allow merges to happen more easily.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-01-20Add 64-bit getsize interface.Jose R. Santos1-22/+16
Added interface capable of opening 64-bit block device. Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27Remove trailing whitespace for the entire source treeTheodore Ts'o1-7/+7
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-18ext2fs_get_device_size(): Fix potential fd descriptor leak in an error caseTheodore Ts'o1-4/+8
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-02Check for potential 64-bit overflow in ext2fs_get_device_size()Eric Sandeen1-0/+5
Check for potential overflow for filesystems contained in regular files where the filesystem image size is returned by stat64(). Signed-off-by: Eric Sandeen <esandeen@sandeen.net>
2006-09-12Fix signed vs unsigned printf format strings for block and inode numbersEric Sandeen1-1/+1
There were still some %d's lurking when we print blocks & inodes; also many of the counters in the e2fsck_struct were signed, and probably need to be unsigned to avoid overflows. Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-05-30Add missing #include <ctype.h>.Matthias Andree1-0/+1
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2005-07-09This patch adds a check to use fstat or fstat64 in getsize.c if theAndreas Dilger1-17/+32
target is a regular file, instead of doing binary searching. It also fixes a couple of cases where a file descriptor is leaked in the ext2fs_getsize() routine on error. Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2005-03-18getsize.c (ext2fs_get_device_size): Check to see if the numberTheodore Ts'o1-1/+5
of blocks is greater than 2**32 when we are doing a binary search to determine the device size. Thanks to Stephen Tweedie for the patch.
2004-10-08getsize.c (ext2fs_get_device_size): Add support for WindowsTheodore Ts'o1-0/+17
9x/NT under Cygwin. Thanks to Sam Robb (samrobb@users.sourceforge.net) for pointing this and the suggested code patch.
2004-09-17Clean up the header file #include's for lib/blkid/getsize.cTheodore Ts'o1-7/+7
and lib/ext2fs/getsize.c In lib/blkid/getsize.c, include <sys/disk.h> if present since this is where the DIOCGMEDIASIZE ioctl is defined on FreeBSD. (Addresses Debian Bug #264630)
2004-03-30GNU/KFreeBSD portability fixes. (Addresses Debian Bug #239934)Matthias Andree1-12/+12
2004-03-08Only use the BLKGETSIZE64 ioctl on Linux 2.6 since it is Theodore Ts'o1-2/+16
unreliable in Linux 2.4. (Addresses Debian Bug #236528). Fix typo in the ioctl used for Mac OS X.
2004-03-02Update getsize functions to use the Apple Darwin and Linux 64-bitTheodore Ts'o1-3/+29
ioctl's.
2003-12-28Re-add FreeBSD support. Matthias Andree1-0/+17
Tested on FreeBSD 5.2-CURRENT as of 2003-12-28. Tested on FreeBSD 4.9-STABLE as of 2003-12-27.
2003-04-29getsize.c (ext2fs_get_device_size): Allow windows code to getTheodore Ts'o1-0/+4
the resize for filesystems that are in regular files.
2003-04-17Add Cygwin/Windows version of ext2fs_get_device_size()Theodore Ts'o1-0/+47
2003-03-14Add Apple/Darwin patches.Theodore Ts'o1-0/+7
2001-08-30getsize.c (ext2fs_get_device_size): Back out BLKGETSIZE64Theodore Ts'o1-17/+0
changes, since the ioctl number has been reused by another unofficial patch.
2001-07-27getsize.c (ext2fs_get_device_size): Add support for theTheodore Ts'o1-0/+17
BLKGETSIZE64 ioctl. (Ioctl defined by unofficial patches from Ben LaHaise, but it's likely this interface won't change.)
2001-05-14Many files:Theodore Ts'o1-5/+0
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-04-26ChangeLog, getsize.c:Theodore Ts'o1-1/+1
getsize.c (ext2fs_get_device_size): Use an unsigned long to query the device sizes using the BLKGETSIZE ioctl.
2000-06-10ChangeLog, getsize.c:Theodore Ts'o1-0/+22
getsize.c (main): Add debugging code under #ifdef DEBUG
2000-05-25ChangeLog, getsize.c:Theodore Ts'o1-0/+4
getsize.c: Under linux, manually define the ioctl for BLKGETSIZE if it isn't already defined and it's safe to do so. .cvsignore: Ignore build files when builddir==srcdir
2000-05-25ChangeLog, getsize.c, llseek.c, unix_io.c:Theodore Ts'o1-0/+7
getsize.c (ext2fs_get_device_size): Use open64() instead of open() if it exists. unix_io.c (unix_open): Use open64() instead of open() if it exists. llseek.c: Simplify header includes of unistd.h. If lseek64 is available (and prototypes are defined) use it in preference to llseek.
2000-02-02ChangeLog, debugfs.c:Theodore Ts'o1-3/+0
debugfs.c (dump_inode): Remove #ifdef for i_version vs. i_generation since we know it will always be i_generation now. ChangeLog, e2fsck.h, flushb.c, scantest.c: e2fsck.h, flushb.c, scantest.c: Remove uneeded include of linux/fs.h bmap.c: Fix silly spelling typo. ChangeLog, getsize.c, ismounted.c, swapfs.c: getsize.c, ismounted.c: Remove unneeded include of linux/fs.h swapfs.c: Remove #ifdef HAVE_EXT2_INODE_VERSION since it's not needed any more; we know it will always be i_generation. Add support for swapping the high bits of the uid and gid.
1998-02-20ChangeLog, getsize.c, ismounted.c, unix_io.c:Theodore Ts'o1-0/+3
getsize.c, ismounted.c, unix_io.c: #include errno.h since it's needed.
1998-01-19Many files:Theodore Ts'o1-0/+5
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)
1997-12-01Many files:Theodore Ts'o1-3/+0
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-10-25Many files:Theodore Ts'o1-3/+0
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-08-11Many files:Theodore Ts'o1-0/+2
dosio.c: New file to do DOS/BIOS disk accesses. namei.c (open_namei): Make pathlen be of type size_t. llseek.c: Always #include stdlib.h since it's need to define size_t. io.h: Use errcode_t for magic numbers. icount.c (get_icount_el), dupfs.c (ext2fs_dup_handle), dblist.c (dir_block_cmp): Use size_t where appropriate. read_bb.c (ext2fs_read_bb_inode), cmp_bitmaps.c (ext2fs_compare_inode_bitmap): Use blk_t, ino_t and size_t where appropriate. closefs.c (ext2fs_flush): Use dgrp_t instead of int where appropriate. openfs.c (ext2fs_open), check_desc.c (ext2fs_check_desc): Use blk_t instead of int where appropriate. rw_bitmaps.c (read_bitmaps), irel_ma.c, inode.c (ext2fs_write_inode), initialize.c (ext2fs_initialize): brel_ma.c: Fix to make be 16-bit safe. link.c (ext2fs_link), unlink.c (ext2fs_unlink), lookup.c (lookup_proc), ismounted.c (ext2fs_check_if_mounted), block.c (xlate_func): Add #pragma argsused for Turbo C.
1997-04-29Many files:Theodore Ts'o1-13/+18
Checked in e2fsprogs-1.07
1997-04-26Many files:Theodore Ts'o1-1/+1
Checkin of e2fsprogs 1.03.
1997-04-26Many files:Theodore Ts'o1-0/+123
Checked in e2fsprogs 0.5c