aboutsummaryrefslogtreecommitdiffstats
path: root/misc
Commit message (Collapse)AuthorAgeFilesLines
* Ignore quotes in safe_print().HEADreplicant-6.0-0004-transitionreplicant-6.0-0004-rc6replicant-6.0-0004-rc5-transitionreplicant-6.0-0004-rc5replicant-6.0-0004-rc4replicant-6.0-0004-rc3replicant-6.0-0004-rc2replicant-6.0-0004cm-13.0Jeff Sharkey2018-08-081-1/+3
| | | | | | | | | | | | | If the value being printed has embedded quotes ("), then printing those quotes could confuse other tools when parsing the value. This is the simplest CL to fix the security issue, and we can circle back to think about more robust escaping in a future CL. Bug: 80436257 Test: manual Change-Id: Ica17f2c5701573bceafe34f20110d230a3925483 (cherry picked from commit efe90c297a8df591c051fdbfacb92b5283390bba)
* e2fsprogs: Rework build configurationreplicant-6.0-0004-rc1replicant-6.0-0003replicant-6.0-0002replicant-6.0-0001stable/cm-13.0-ZNH5Ystable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2Kstable/cm-13.0-ZNH0ESteve Kondik2015-11-103-397/+300
| | | | Change-Id: I8d6137a9c22b165e79e19ab3997cabf182bba363
* e2fsprogs: Disable relocation packing for static binariesSteve Kondik2015-10-161-2/+4
| | | | Change-Id: I85b35222c825e5d6cb72ac543c49c78e99ad64b7
* build static e2fsprogsAusten Dicken2015-10-161-0/+64
| | | | | | | | | | | | | | | | | | | | | change makefies to build static mke2fs and tune2fs and place them in $(PRODUCT_OUT)/utilities Change-Id: I0139b3dcfe64a4031db7719ddd71120d174d1990 static e2fsck, tune2fs, and mke2fs for recovery Change-Id: I8725cc296be8967265261e92da743c149e9ec45b resize: allow static build Change-Id: Id5dabaf87de775bb7461f83a9e7ae9ca754a1635 e2fsprogs: Clean up makefiles * Remove duplicate modules Change-Id: If68c5685a76943bc6bfdcb630c15c2f9ac59effd
* tune2fs: Allow building it as a static libJP Abgrall2014-11-213-2/+54
| | | | | | | | | | 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
* kill HAVE_TERMIO_HYabin Cui2014-11-171-2/+3
| | | | | Bug: 18398307 Change-Id: I72bd78c845cc7d052ca1c3f44fe69f49de9c5c3e
* Switch back to 1.42.9 now that there is a fixJP Abgrall2014-03-1938-1685/+6590
| | | | | | Revert "Revert changes that moved from 1.41.14 to 1.42.9" This reverts commit 65f0aab98b20b5994a726ab90d355248bcddfffd.
* Revert changes that moved from 1.41.14 to 1.42.9JP Abgrall2014-03-0638-6590/+1685
| | | | | | | | | | | | | | | | Revert "e2fsck: Don't use e2fsck_global_ctx unless HAVE_SIGNAL_H" commit e80e74c41d85ff93f3d212ba6512340f48054a93. Revert "Merge remote-tracking branch 'linaro/linaro-1.42.9' into aosp_master" This reverts commit e97b2b6fc82f840e84dfc631b87f21be44ff2421, reversing changes made to 7e2fb9d09c245eba70ee008b78007315e9c0f1df. Revert "Prepare for upstream 1.42.9" This reverts commit 7e2fb9d09c245eba70ee008b78007315e9c0f1df. Bug: 13340735 Change-Id: If48b153a95ef5f69f7cdccb00e23524abff3c5a8 Signed-off-by: JP Abgrall <jpa@google.com>
* Add missing libext2_quota linkage and resource_track.cBernhard Rosenkraenzer2014-02-191-0/+2
| | | | | Change-Id: If3983d882f97c5b4cfaf2a177d5d84c68c66fad3 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
* Add files that would normally be generated by the e2fsprogs build systemBernhard Rosenkränzer2014-01-0525-24/+59
| | | | | | | | | | | | | | | | | 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>
* Re-add Android makefiles from AOSP masterBernhard Rosenkränzer2013-12-311-0/+424
| | | | | Change-Id: I6c6dbe11baa395442f4cf845ad39801f1c426129 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
* e2freefrag: avoid integer overflow when reporting free space statisticsTheodore Ts'o2013-12-281-4/+4
| | | | | | | | | An integer overflow could happen if the file system is large and has very large contiguous chunks of free space. Addresses-Debian-Bug: #718205 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: clarify documentation about bigalloc in the man pageTheodore Ts'o2013-12-281-3/+5
| | | | | | Addresses-Debian-Bug: #669730 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: clarify the description of the -I option in the man pageTheodore Ts'o2013-12-281-7/+17
| | | | | | Addresses-Debian-Bug: #698076 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: Clarify e2image's usage messageTheodore Ts'o2013-12-272-6/+27
| | | | | | Also reflect a similar change to e2image's man page. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: write progress information to stderrTheodore Ts'o2013-12-271-19/+28
| | | | | | | | | | | This allows "e2image -rp /dev/sdc1 - | bzip2 > sdc1.img.bz2" to work correctly, so the progress information doesn't corrupt the image being sent to stdout. Also add a diagnostic indicating that the -p option is currently only implemented for raw mode. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: clean up progress reportingTheodore Ts'o2013-12-261-29/+23
| | | | | | | | | | | | | | The old progress reporting code would crash on small file systems. For example: cp /dev/null /tmp/foo.img mke2fs -t ext4 -F /tmp/foo.img 100 e2image -o 0 -O 4096 -rap /tmp/foo.img Fix this, and while we're at it, factor out the code to make it easier to read and maintain. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* dumpe2fs: don't try to print the journal info when using image filesTheodore Ts'o2013-12-261-0/+2
| | | | | | | | If dumpe2fs tries to print journal info when using an image file created using e2image, it will crash since the journal isn't available. So don't even try to print it. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: make sure all strings are marked for internationalizationTheodore Ts'o2013-12-261-62/+64
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: add -n option to show what blocks would have been writtenTheodore Ts'o2013-12-262-14/+28
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: add -c option to optimize file system copying for flash devicesTheodore Ts'o2013-12-262-7/+75
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: only skip writing zero blocks when writing to a new fileTheodore Ts'o2013-12-261-3/+15
| | | | | | | | | | | | | 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>
* e2image: clean up gcc -Wall and sparse nitsTheodore Ts'o2013-12-261-22/+21
| | | | | | | | Fix up the gcc -Wall and sparse nits introduced by Phillip Susi's e2image patches. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Phillip Susi <psusi@ubuntu.com>
* e2image: refactor calls to ext2fs_llseek()Theodore Ts'o2013-12-261-73/+56
| | | | | | | | Refactor calls to ext2fs_llseek(). This makes the code more compact, easier to read, and it also fixes a number of places where we call ext2fs_llseek() without doing proper error checking. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: handle SIGINT safelyPhillip Susi2013-12-261-0/+39
| | | | | | | | | | When doing an in place move, interrupting it past the point of no return will destroy the filesystem since parts of it have been overwritten. Catch SIGINT the first time and issue a warning if this is the case. Signed-off-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: add progress indicatorPhillip Susi2013-12-262-4/+68
| | | | | | | | | When given the -p switch, print progress information, including block counts, percentage complete, estimated time remaining, and throughput. Signed-off-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: perform in-place movePhillip Susi2013-12-262-7/+67
| | | | | | | | If given at least one offset and only one file, assume source and dest are the same, and do an in place move. Signed-off-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: add offset switchesPhillip Susi2013-12-242-6/+60
| | | | | | | | | Add -o and -O switches to specify the offset where the source and destination filesystems start. This is useful if you have an image of a partitioned disk or wish to create one. Signed-off-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* Add ext4 man page and update and clean up the other man pagesTheodore Ts'o2013-12-245-213/+308
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: further updates for mke2fs(8) man pageAndreas Dilger2013-12-241-14/+22
| | | | | | | | | | | The mke2fs(8) man page was updated in 4727c67dc2, but needs some more clear descriptions for extra_isize and metadta_csum features. The uninit_bg feature is supported by all ext4-capable kernels, and does have a slow e2fsck pass for newly-formatted filesystems, so remove the caveat. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs, e2fsck: fix s_desc_size handlingAndreas Dilger2013-12-241-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Clean up sparse warningsTheodore Ts'o2013-12-169-104/+105
| | | | | | | 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>
* e2fsprogs: mke2fs manpage updatesUri Corin2013-12-161-32/+136
| | | | | | | | | | | | | | I've added documentation for all available filesystem features settable by mke2fs. * Features now include the kernel constant attached to the function. * Some pre-existing feature explanations have been expanded based on ext4.wiki.kernel.org. [ Edited by tytso for stylistic and correctness. ] Addresses-Debian-Bug: #586218 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* mke2fs: fix force option to create filesystem on mounted deviceKazuya Mio2013-12-161-2/+2
| | | | | | | | | | | | | According to mke2fs man, we can create a filesystem on the mounted device when -FF option is specified. However, currently we have to specify -F option third to force mke2fs. This patch fixes the problem. Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext2fs: quiet compiler warningsAndreas Dilger2013-12-151-3/+7
| | | | | | | | | | | | | | | 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>
* build: quiet LLVM non-literal string format warningAndreas Dilger2013-12-159-162/+188
| | | | | | | | | | | | | | | | | Compiling with LLVM generates a large number of warnings due to the use of _() for wrapping strings for i18n: warning: format string is not a string literal (potentially insecure) [-Wformat-security] ./nls-enable.h:4:14: note: expanded from macro '_' #define _(a) (gettext (a)) ^~~~~~~~~~~~ These warnings are fixed by using "%s" as the format string, and then _() is used as the string argument. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* build: use long long for __u64 by defaultAndreas Dilger2013-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* tune2fs: forbid changing uuid on an uninit_bg filesystemDarrick J. Wong2013-12-141-0/+23
| | | | | | | | | | | The old uninit_bg checksums depend on the UUID, so prohibit changes to the UUID if a checksumming filesystem is mounted, because this introduces a nasty race where the kernel and tune2fs are both trying to rewrite group descriptors at the same time, with different ideas about what the UUID is. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* dumpe2fs: check return valuesDarrick J. Wong2013-12-121-8/+18
| | | | | | | | Check the return values from ext2fs_get_block_bitmap_range2(); if an error happened, print that and don't print garbage bitmap. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: check return value from check_if_mounted()Darrick J. Wong2013-12-121-1/+5
| | | | | Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e4defrag: defensively check results of sysconf(_SC_PAGESIZE)Darrick J. Wong2013-12-121-0/+3
| | | | | | | | | sysconf(_SC_PAGESIZE) will probably never return an error, but just in case it does, we shouldn't pass what looks like a huge number to sync_file_range() and posix_fadvise(). Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e4defrag: don't crash if umounts the filesystem races with usDarrick J. Wong2013-12-121-1/+1
| | | | | | | | | If someone umounts the filesystem between statfs64() and the getmntent() iteration, we can exit the loop having never set mnt_type, and strcmp can crash. Fix the potential NULL dereference. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: don't leak memory (on error path)Darrick J. Wong2013-12-121-3/+8
| | | | | Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* misc: don't leak file descriptors (on error paths)Darrick J. Wong2013-12-122-0/+3
| | | | | Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: load configfile blocksize setting before 64bit checksDarrick J. Wong2013-12-121-62/+72
| | | | | | | | | | | | | | | | mke2fs has a series of checks to ensure that we don't create a filesystem too big for its blocksize -- if auto-64bit is on, then it turns on 64bit; otherwise it complains. Unfortunately, it performs these checks before looking in mke2fs.conf for a blocksize, which means that the checks are incorrect if the user specifies a non-4096 blocksize in the config file and says nothing on the command line. The bug also has the effect of mandating a 4k block size on any block device larger than 4T in that situation. Therefore, read the block size from the config file before performing the 64bit checks. 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>
* dumpe2fs: fix printing of block offsets for 64-bit file systemsTheodore Ts'o2013-12-021-1/+1
| | | | | | | | Use ext2fs_group_first_block2() instead of ext2fs_group_first_block() to avoid dumpe2fs from printing crazy block offsets when we have block numbers which are larger than 32 bits. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* e2image: pass the correct size write_headerTheodore Ts'o2013-12-021-2/+2
| | | | | | | | | | | | | Commit bf0449b1a654, which added the ability to write qcow2 files, generalized the write_header() file to take the size of the header structure which it writes out. Unfortunately, it changed the call which supported original e2image format to pass in fs->blocksize, instead of the actual size of the e2image header structure (which is substantially smaller than fs->blocksize). This meant that we copied in stack garbage into the e2image file, and it made valgrind quite unhappy. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* libext2fs: reject 64bit badblocks numbersDarrick J. Wong2013-10-231-3/+18
| | | | | | | | Don't accept block numbers larger than 2^32 for the badblocks list, and don't run badblocks on them either. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* mke2fs: don't let resize= turn on resize_inode when meta_bg is setTheodore Ts'o2013-10-231-9/+9
| | | | | | | | | | | Passing the "-E resize=NNN" option to mke2fs sets the resize_inode feature. However, resize_inode and meta_bg are mutually exclusive; unfortunately, we check this constraint before we parse the extended options. Fix this by moving this check after the calls parse_extended_opts(). Reported-by: "Darrick J. Wong" <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* mke2fs: clarify inode ratio in man pagePhillip Susi2013-10-151-3/+3
| | | | | | | | The man page still said it was not possible to change the number of inodes on a filesystem after creating it. You actually can by resizing the fs, so clarify this language a bit. Signed-off-by: Theodore Ts'o <tytso@mit.edu>