- 06 Feb, 2017 1 commit
-
-
Mark Stevens authored
-
- 21 Nov, 2014 1 commit
-
-
JP Abgrall authored
This allows getting all of tune2fs as a static library. The entry point is int tune2fs_main(int argc, char **argv). It requires passing argv[0]="tune2fs" to get tune2fs behavior. Bug: 18430740 Change-Id: I7bf8d96c53066a4da37778c0d67383b0b820e2ff
-
- 20 Mar, 2014 3 commits
-
-
JP Abgrall authored
After http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/lib/ext2fs/llseek.c?id=274d46e1d35af423d0292d63c4d0ad7a03be82ba with __linux__ defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) SIZEOF_OFF_T >= SIZEOF_LONG_LONG it leads to ext2fs_llseek() doing a "return lseek(fd, offset, origin);" Which fails for offsets > 32bit. Also, with __linux__ !(defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)) defined(HAVE_LLSEEK) SIZEOF_OFF_T == SIZEOF_LONG_LONG my_llseek is not defined at all. And there is no need to define llseek as lseek, as llseek is never used. Luckily ext2fs_llseek() then does "return lseek(...);" It would seem that my_llseek should be used in both places. Bug: 13340735 Change-Id: Ie7330300c9c1ca103eaaef97536dcf10adbbba02 Signed-off-by:
JP Abgrall <jpa@google.com>
-
JP Abgrall authored
After http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/lib/ext2fs/llseek.c?id=274d46e1d35af423d0292d63c4d0ad7a03be82ba with __linux__ defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) SIZEOF_OFF_T >= SIZEOF_LONG_LONG it leads to ext2fs_llseek() doing a "return lseek(fd, offset, origin);" Which fails for offsets > 32bit. Also, with __linux__ !(defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)) defined(HAVE_LLSEEK) SIZEOF_OFF_T == SIZEOF_LONG_LONG my_llseek is not defined at all. And there is no need to define llseek as lseek, as llseek is never used. Luckily ext2fs_llseek() then does "return lseek(...);" It would seem that my_llseek should be used in both places. Bug: 13340735 Change-Id: Ie7330300c9c1ca103eaaef97536dcf10adbbba02 Signed-off-by:
JP Abgrall <jpa@google.com>
-
JP Abgrall authored
Revert "Revert changes that moved from 1.41.14 to 1.42.9" This reverts commit 65f0aab9.
-
- 06 Mar, 2014 2 commits
-
-
JP Abgrall authored
Revert "e2fsck: Don't use e2fsck_global_ctx unless HAVE_SIGNAL_H" commit e80e74c4. Revert "Merge remote-tracking branch 'linaro/linaro-1.42.9' into aosp_master" This reverts commit e97b2b6f, reversing changes made to 7e2fb9d0. Revert "Prepare for upstream 1.42.9" This reverts commit 7e2fb9d0 . Bug: 13340735 Change-Id: If48b153a95ef5f69f7cdccb00e23524abff3c5a8 Signed-off-by:
JP Abgrall <jpa@google.com>
-
JP Abgrall authored
Revert "e2fsck: Don't use e2fsck_global_ctx unless HAVE_SIGNAL_H" commit e80e74c4. Revert "Merge remote-tracking branch 'linaro/linaro-1.42.9' into aosp_master" This reverts commit e97b2b6f, reversing changes made to 7e2fb9d0. Revert "Prepare for upstream 1.42.9" This reverts commit 7e2fb9d0 . Bug: 13340735 Change-Id: If48b153a95ef5f69f7cdccb00e23524abff3c5a8 Signed-off-by:
JP Abgrall <jpa@google.com>
-
- 04 Mar, 2014 1 commit
-
-
JP Abgrall authored
Remove everything. Change-Id: I6ef4c9bc888a245744d7ec4d193857b357472392 Signed-off-by:
JP Abgrall <jpa@google.com>
-
- 04 Jan, 2014 1 commit
-
-
Bernhard Rosenkränzer authored
Android doesn't run ./configure and friends, so it has to rely on pre-populated versions of the autogenerated files. This is somewhat bogus (e.g. hardcoded little-endian reference in lib/ext2fs/ext2_types.h) and should at some point be fixed, but it's what Android has always done, not a regression from the 1.41.14 branch. Also, don't #include config.h which we don't generate (we pass what it usually contains as -D parameters from Android.mk) anywhere. Add a new Android.mk file for the quota library. Change-Id: I162c6327fee5bd06261d9cdcc34bda10f04a6f21 Signed-off-by:
Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
-
- 31 Dec, 2013 1 commit
-
-
Bernhard Rosenkränzer authored
Change-Id: I6c6dbe11baa395442f4cf845ad39801f1c426129 Signed-off-by:
Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
-
- 26 Dec, 2013 1 commit
-
-
Theodore Ts'o authored
The e2image progam was originally intended to create image files. However, some people have started using e2image to copy a file system from one block device to another, since it is more efficient than using dd because it only copies the blocks which are in use. If we are doing this, however, we must not skip writing blocks which are all zero in the source device, since they may not be zero in the destination device. Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu> Cc: Phillip Susi <psusi@ubuntu.com>
-
- 25 Dec, 2013 2 commits
-
-
Theodore Ts'o authored
Currently the ext4 block group descriptor is 64 bytes. In case we need to support larger block group descriptors in the future, teach ext2fs_group_desc_csum() to checksum parts of the block group descriptors that libext2fs doesn't yet understand. Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Andreas Dilger authored
The s_desc_size in the superblock specifies the group descriptor size in bytes, but in various places the EXT4_FEATURE_INCOMPAT_64BIT flag implies that the descriptor size is EXT2_MIN_DESC_SIZE_64BIT (64 bytes) instead of checking the actual size. In other places, the s_desc_size field is used without checking for INCOMPAT_64BIT. In the case of ext2fs_group_desc() the s_desc_size was being ignored, and assumed to be sizeof(struct ext4_group_desc), which would result in garbage for any but the first group descriptor. Similarly, in ext2fs_group_desc_csum() and print_csum() they assumed that the maximum group descriptor size was sizeof(struct ext4_group_desc). Fix these functions to use the actual superblock s_desc_size if INCOMPAT_64BIT. Conversely, in ext2fs_swap_group_desc2() s_desc_size was used without checking for INCOMPAT_64BIT being set. The e2fsprogs behaviour is different than that of the kernel, which always checks INCOMPAT_64BIT, and only uses s_desc_size to determine the offset of group descriptors and what range of bytes to checksum. Allow specifying the s_desc_size field at mke2fs time with the "-E desc_size=NNN" option. Allow a power-of-two s_desc_size value up to s_blocksize if INCOMPAT_64BIT is specified. This is not expected to be used by regular users at this time, so it is not currently documented in the mke2fs usage or man page. Add m_desc_size_128, f_desc_size_128, and f_desc_bad test cases to verify mke2fs and e2fsck handling of larger group descriptor sizes. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 23 Dec, 2013 1 commit
-
-
Andreas Dilger authored
Add a LOG2_CHECK mode for check_super_value() so that it is easy to verify values that are supposed to be power-of-two values (s_desc_size and s_inode_size so far). In ext2fs_check_desc() also check for a power-of-two s_desc_size. Print out s_desc_size in debugfs "stats" and dumpe2fs output, if it is non-zero. It turns out that the s_desc_size validation in check_super_block() is not currently used by e2fsck, because the group descriptors are verified earlier by ext2fs_check_desc(), and even without an explicit check of s_desc_size the group descriptors fail to align correctly on disk. It makes sense to keep the check_super_block() regardless, in case the code changes at some point in the future. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 16 Dec, 2013 7 commits
-
-
Theodore Ts'o authored
Mostly by adding static and removing excess extern qualifiers. Also convert a few remaining non-ANSI function declarations to ANSI. Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Kazuya Mio authored
When /etc/mtab is a symlink of /proc/mounts, mke2fs without -FF option can create a filesystem on the image file that is mounted. According to mke2fs man page, we should specify -FF option in this case. This patch protects filesystem from unintended mke2fs caused by human error. How to reproduce: # mke2fs -t ext4 -Fq fs.img # mount -o loop fs.img /mnt/mp1 # mke2fs -t ext4 -Fq fs.img && echo "mke2fs success" mke2fs success Signed-off-by:
Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
When we're appending a block to a directory file or the journal file, and the new block is part of a cluster that has already been allocated to the file (implied cluster allocation), don't update the bitmap or the summary counts because that was performed when the cluster was allocated. Reviewed-by:
Zheng Liu <wenqing.lz@taobao.com> Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
When bigalloc is enabled, using ext2fs_block_alloc_stats2() to free any block in a cluster has the effect of freeing the entire cluster. This is problematic if a caller instructs us to punch, say, blocks 12-15 of a 16-block cluster, because blocks 0-11 now point to a "free" cluster. The naive way to solve this problem is to see if any of the other blocks in this logical cluster map to a physical cluster. If so, then we know that the cluster is still in use and it mustn't be freed. Otherwise, we are punching the last mapped block in this cluster, so we can free the cluster. The implementation given only does the rigorous checks for the partial clusters at the beginning and end of the punching range. Reviewed-by:
Zheng Liu <wenqing.lz@taobao.com> Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Andreas Dilger authored
The LIST_HEAD() macro conflicts with the <sys/queue.h> declaration of the same name. Delete the unused LIST_HEAD() macro from the libext2fs and libblkid headers to avoid compiler warnings. It can be replaced by INIT_LIST_HEAD() or LIST_HEAD_INIT() if needed. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Andreas Dilger authored
Include ext2fsP.h in fileio.c for ext2fs_file_block_offset_too_big() declaration. Fix up the declaration to mark it extern in the header. Include <strings.h> header for strcasecmp() in tune2fs.c if available, as described in the strcasecmp(3) man page, instead of doing this indirectly by declaring _BSD_SOURCE and getting it from <string.h>. If CONFIG_QUOTA is undefined, parse_quota_opts() is unused in tune2fs.c so #ifdef it out. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Andreas Dilger authored
Don't print a verbose configure error in parse-types.h if <asm/types.h> missing and __[SU]*_TYPEDEF is unset. This is always the case for non-Linux builds. The printf formatting strings all use "%llu" for printing 64-bit values and this it produces a large number of warnings if __u64 is defined as "unsigned long". If __U64_TYPEDEF isn't set use "unsigned long long" for __u64 in ext2-types.h and blkid-types.h by default instead of using "unsigned long". Fix a few places where "%d" or "%u" or "%Lu" were used to print a 64-bit value, by converting them to use "%lld" or "%llu" instead. Fix a few places where "%lu" was used to print .tv_usec, by casting the variable to "(long)" since .tv_usec is "int" on some systems. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 15 Dec, 2013 1 commit
-
-
Darrick J. Wong authored
In the ^extent case, passing ~0ULL as the 'end' parameter to ext2fs_punch() causes the (end - start + 1) calculation to overflow to zero. Since the old-style mapped block files cannot have more than 2^32 blocks, just clamp it to ~0U. This fixes a regression in t_quota_2off with the patch "libext2fs: use ext2fs_punch() to truncate quota file" applied. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 12 Dec, 2013 14 commits
-
-
Darrick J. Wong authored
When we set the file size, find the block containing EOF, and zero everything in that block past EOF so that we can't return stale data if we ever use fallocate or truncate to lengthen the file. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
If we're asked to punch a file with no data blocks mapped to it and a non-zero length, we don't need to do any work in ext2fs_punch_extent() and can return success. Unfortunately, the extent_get() function returns "no current node" because it (correctly) failed to find any extents, which is bubbled up to callers. Since no extents being found is not an error in this corner case, fix up ext2fs_punch_extent() to return 0 to callers. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
When deleting an entire extent, we cannot always slip to the previous leaf extent because there might not /be/ a previous extent. Attempting to correct for that error by asking for the 'current' leaf extent also doesn't work, because the failed attempt to change to the previous extent leaves us with no current extent. Fix this problem by recording the lblk of the next extent before deleting the current extent and _goto()ing to the next extent after the deletion. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
If we're using ext2fs_file_write() to write to a hole in a file, ensure that we can actually allocate the block before updating i_size. In other words, don't update i_size and don't return success if we hit an error while allocating space. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
Zero is a valid file descriptor, so close it. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
Fix up a few places where we ignore return values. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
ext2fs_free_mem() takes a pointer to a pointer, similar to ext2fs_get_mem(). Improve the documentation, and fix debugfs. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
When reading or writing file blocks, use the IO manager routines that can handle 64bit block numbers. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
If we have to create a big symlink (i.e. one that doesn't fit into i_block[]), we are not 64bit block safe and the namei code does not handle extents at all. Fix both. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
Forbid clients from trying to map logical block numbers that are larger than the lblk->pblk data structures are capable of handling. While we're at it, don't let clients set the file size to a number that's beyond what can be mapped. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
For each site where we test for a large file (> 2GB) and set the LARGE_FILE feature, use a helper function to make the size test consistent with the test that's in e2fsck. This fixes the fsck complaints when we try to create a 2GB journal (not so hard with 64k block size) and fixes the incorrect test in fileio.c. Reviewed-by:
Zheng Liu <wenqing.lz@taobao.com> Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Darrick J. Wong authored
On a FS with a rather large blockize (> 4K), the old block map structure can construct a fat enough "tree" (or whatever we call that lopsided thing) that (at least in theory) one could create mappings for logical blocks higher than 32 bits. In practice this doesn't happen, but the 'max' and 'iter' variables that the punch helpers use will overflow because the BLOCK_SIZE_BITS shifts are too large to fit a 32-bit variable. The current variable declarations also cause punch to fail on TIND-mapped blocks even if the file is < 16T. So enlarge the fields to fit. Yes, this is an obscure corner case, but it seems a little silly if we can't punch a file's block 300,000,000 on a 64k-block filesystem. Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 04 Dec, 2013 1 commit
-
-
Andreas Dilger authored
Fix the checking of s_mmp_block in e2fsck_pass1() and ext2fs_mmp_read() to handle the high 32 bits of s_blocks_count. Remove redundant check of s_mmp_block in do_dump_mmp() right before ext2fs_mmp_read() is called. Also fix s_blocks_count_hi in check_backup_super_block(), since it cannot use the ext2fs_blocks_count() helper easily. Signed-off-by:
Andreas Dilger <adilger@dilger.ca> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
- 03 Dec, 2013 3 commits
-
-
Darrick J. Wong authored
Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Eric Whitney authored
A recent patch to fix blk_t to blk64_t assignment mismatches in e2fsprogs (commit 4dbfd79d ) created a printf conversion spec / argument type mismatch in tst_iscan.c. Fix this to avoid truncation of the printed value and to silence a compiler warning seen when "make check" is run. Signed-off-by:
Eric Whitney <enwlinux@gmail.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-
Theodore Ts'o authored
Add some explicit casts to silence some -Wconversion noise. Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
-