History log of /system/extras/ext4_utils/make_ext4fs.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
63362e153f799f41d3e0dd256d8b8281da3f2672 25-Mar-2017 Jin Qian <jinqian@google.com> ext4_utils: fix crash when filesystem size is too small

make_ext4fs crashes if size is less than block size or less than
header size (super block + descriptors + bitmaps). Check the size
and return errors.

Test: run make_ext4fs with small sizes
Bug: 36576677
Change-Id: I61d92e280cdf290054fadda5a045fc839c6fd8fe
/system/extras/ext4_utils/make_ext4fs.c
7ba1e209f2c96b32bf023e24ff43a77d4f5341cb 06-Feb-2017 Connor O'Brien <connoro@google.com> ext4_utils: allow passing flash block sizes to make_ext4fs_sparse functions

Add versions of make_ext4fs_sparse_fd() and
make_ext4fs_sparse_fd_directory() that accept flash erase & logical
block size as arguments. Refactor to avoid copied code in the new
aligned versions of each function.

Test: Pass block sizes to new functions using fastboot -w and check
that the new userdata has the correct stride and stripe-width values.
Bug: 33243520
Signed-off-by: Connor O'Brien <connoro@google.com>

Change-Id: I16da6e0ce699439c53d1a722c6d56eb3f9cd9bc5
/system/extras/ext4_utils/make_ext4fs.c
bdd06dec245b204ade230ae8d1d03923305c4a04 25-Jan-2017 Connor O'Brien <connoro@google.com> Allow passing flash block sizes to libext4_utils

Flash erase & logical block size can be used to tune the stride
and stripe_width parameters. Add make_ext4fs_directory_align,
which takes these sizes as arguments.

Test: Factory reset marlin, confirm userdata params are set correctly
Bug: 33243520
Change-Id: Ic8343cff221f0e203a463370a4f1be5ee191946d
Signed-off-by: Connor O'Brien <connoro@google.com>
/system/extras/ext4_utils/make_ext4fs.c
cd205307320b4da5dd7899f79b83539c620ae1d1 19-Nov-2016 Dmitry Shmidt <dimitrysh@google.com> ext4_utils: Remove signed/unsigned comparison warnings

Bug: 33012393
Test: Manual

Change-Id: I18e442cb27f28be491b0ef6f620ba4fa0fad6713
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
/system/extras/ext4_utils/make_ext4fs.c
018ef1be61e749d0fbe0f05179a4f0f9b858ae57 05-Oct-2016 Tao Bao <tbao@google.com> ext4_utils: Export headers for libext4_utils* libs.

So we can do "#include <ext4_utils/make_ext4fs.h>" without adding
"LOCAL_C_INCLUDES += system/extras/ext4_utils".

Also clean up the #include lines in system/extras/ext4_utils/.

Test: `m checkbuild` works.

Change-Id: I3c8b07c9b6f5996160e0cb6d9d069579b1609f60
/system/extras/ext4_utils/make_ext4fs.c
1eb2f5433461ad437e7dfedca32ce7bf5f09fd21 05-Oct-2016 Elliott Hughes <enh@google.com> Test for _WIN32 in system/extras instead of USE_MINGW.

Bug: http://b/23392815
Test: builds
Change-Id: Ide007c7ac8414a82548cc99fe384c7de9ba7494b
/system/extras/ext4_utils/make_ext4fs.c
afb52975c3b60b32cf08a3ab270400defccd81f6 30-Sep-2016 Colin Cross <ccross@android.com> Revert "ext4_utils: -Werror"

This reverts commit f55303f4a4a4319e90e671b50a4dcdd131781f35.

Change-Id: I63b6c158536871534cfee9b3fbe416f121d7b75a
/system/extras/ext4_utils/make_ext4fs.c
f55303f4a4a4319e90e671b50a4dcdd131781f35 13-May-2016 Mark Salyzyn <salyzyn@google.com> ext4_utils: -Werror

Correct a few compiler warnings

Test: build success
Bug: 26552300
Bug: 31289077
Change-Id: I52e6143df465c02b94fe89c80b1712706da1ab7c
/system/extras/ext4_utils/make_ext4fs.c
d2ed02a94086e1221041bc59825add3d0a657e19 29-Apr-2016 Mohamad Ayyash <mkayyash@google.com> Incremental Ext4 Bug: prevent out of bound boundary allocations

This happens around the boundary of block groups where a slightly
different block boundary is set based on size of filesystem which means
allocations based on a previous filesystem layout need to verify they're
not crossing that new bounday

BUG: 27698960
Change-Id: I45d444b4477f14f71e8f17144523505a7525b4e2
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
/system/extras/ext4_utils/make_ext4fs.c
dedf8f9705df13e1fd07d3f754216d34725bb269 15-Apr-2016 Mohamad Ayyash <mkayyash@google.com> make_ext4fs: Modify ext4 filesystem setup to speed up fsck

1) Set EXT4_BG_INODE_UNINIT so fsck will skip scanning unused inodes
2) Use EXT4_FEATURE_RO_COMPAT_GDT_CSUM to enable group descriptor
checksums in filesystem which reduces overhead for fsck

BUG: 24747200
BUG: 28013112
Change-Id: I118ab26935442f452962b3a7c29c61acf76ad4d9
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
/system/extras/ext4_utils/make_ext4fs.c
ef24424e32921f509f98aae429b6efd9b0e4eae6 24-Feb-2016 Mohamad Ayyash <mkayyash@google.com> Don't define incremental ext4 for windows

Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
Change-Id: I1eba14f7f4db2174de8feaa9d8e5e41524ac1d32
/system/extras/ext4_utils/make_ext4fs.c
9579198cd7d5b88b3508f1b00ddd77bd8da60682 20-Feb-2016 Mohamad Ayyash <mkayyash@google.com> Redesign make_ext4fs to incrementally generate ext4 images

Allows passing a base fs mapping file through -d which preserves the
location of those mapping in existing files

Internal Design Doc: go/incremental-ext4
BUG: 26839493
Change-Id: I05e296693429d39466d257d1d0a3daf00510dc26
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
/system/extras/ext4_utils/make_ext4fs.c
18785a86a30135ac65b88db9886bfc22d6608849 19-Feb-2016 Mohamad Ayyash <mkayyash@google.com> Revert "Redesign make_ext4fs to incrementally generate ext4 images"

This reverts commit 3d960843a2260a98c8df5cc39ca0dbf3d675f1a2.

Change-Id: I0fb7d65f094feb4013924685270fc847693b6889
/system/extras/ext4_utils/make_ext4fs.c
3d960843a2260a98c8df5cc39ca0dbf3d675f1a2 13-Feb-2016 Mohamad Ayyash <mkayyash@google.com> Redesign make_ext4fs to incrementally generate ext4 images

Allows passing a blk mapping file through -Z which preserves the
location of those mapping in existing files

Internal Design Doc: go/incremental-ext4
BUG: 26839493
Change-Id: I447873bf65ae66dab9923e5a11c497f0722750df
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
/system/extras/ext4_utils/make_ext4fs.c
ef77d0d17fb483f0d2ddec466c6c212d773999df 03-Feb-2016 Dan Albert <danalbert@google.com> Merge "Fix warnings in system/extras." am: 4eb09a62f2
am: 1b0f797a72

* commit '1b0f797a7274737468be7259ed9fde448b54af14':
Fix warnings in system/extras.
879785074ca93e13896ce364a45eb5cc17081c4a 03-Feb-2016 Dan Albert <danalbert@google.com> Fix warnings in system/extras.

Bug: http://b/26936282
Change-Id: I1b9c6c9bb06944c32abcb871279d056eea0fb11a
/system/extras/ext4_utils/make_ext4fs.c
d7a3fb4fc35fe729e5013474914746aeb8de35b7 27-Nov-2015 Paul Crowley <paulcrowley@google.com> Add _directory function for fd-based ext4 filesystem creation

Allow an initializing directory to be specified in ext4 filesystem
creation where the target is specified as as an fd, to match
where it is given as a filename.

Bug: 25898323
Change-Id: I945c9554b885ab9f903fd2985ad4b73399304321
/system/extras/ext4_utils/make_ext4fs.c
01c43f2219df371b1bf6d3c2b7fb8c9059e45168 05-Nov-2015 Paul Lawrence <paullawrence@google.com> Create convert_fbe breadcrumb file to support conversion to FBE

Change-Id: I7d686819fe7966453ab40280a00afee89e3ecaba
/system/extras/ext4_utils/make_ext4fs.c
eee96f654e7a39203e79fdfa8951f240bc15e79a 25-Aug-2015 Daniel Rosenberg <drosen@google.com> make_ext4fs: Turn off EXT4_FEATURE_RO_COMPAT_GDT_CSUM flag for now

Unused inodes is currently being set incorrectly after
factory reset. Disabling uninit_bg until we track down
the cause.

Bug: 22679392
Change-Id: I62d90c92b8a2f7562f73cfb235b9b207d80e9fad
Signed-off-by: Daniel Rosenberg <drosen@google.com>
/system/extras/ext4_utils/make_ext4fs.c
4b481e835ee1c48cade2b22a2f3a9be35faa9eed 10-Jul-2015 Thierry Strudel <tstrudel@google.com> am 830175fa: am b89e81dc: fs_config: align with new explicit fs_config target_out parameter

* commit '830175fa76fea6dff1fc2e79adebfb515b9da993':
fs_config: align with new explicit fs_config target_out parameter
b89e81dcb9bfa707912d9e370949b250367b0998 10-Jul-2015 Thierry Strudel <tstrudel@google.com> fs_config: align with new explicit fs_config target_out parameter

Bug: 21989305
Bug: 22048934
Change-Id: I82c16c70a776e13b3365672b2820ee965525de9a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
/system/extras/ext4_utils/make_ext4fs.c
c28ca56319d72ac9f026689b5516c75f719900af 13-May-2015 Jeff Vander Stoep <jeffv@google.com> Remove selinux/android.h from host tools

For tools built for both host and device, only include if not host.

(cherry-picked from commit 6bc4a54fdbd926c032ed5c99f8b5c69f624c6312)

Change-Id: Ie102bd7575d2cf5eef3f95e6063c2970d143dac8
/system/extras/ext4_utils/make_ext4fs.c
6bc4a54fdbd926c032ed5c99f8b5c69f624c6312 13-May-2015 Jeff Vander Stoep <jeffv@google.com> Remove selinux/android.h from host tools

For tools built for both host and device, only include if not host.

Change-Id: Ie102bd7575d2cf5eef3f95e6063c2970d143dac8
/system/extras/ext4_utils/make_ext4fs.c
aaf32ea5166b6b86023dc283311228cdebb3dc02 17-Apr-2015 Eric Miao <emiao@nvidia.com> make_ext4fs: write out super blocks at last for block devices

Change-Id: I93ee37a649aabff14464030efd88f79e1ae324f0
Signed-off-by: Eric Miao <emiao@nvidia.com>
/system/extras/ext4_utils/make_ext4fs.c
f965968e1912553939e7cf1afc9ff39d306ada54 07-Apr-2015 Jeff Sharkey <jsharkey@android.com> Add real UUID support to ext4_utils.

For some unknown reason, we've always been generating the same UUID
for every single ext4 partition that we formatted. Yikes.

Add a flag to request that a real UUID be generated when creating
filesystem.

(cherry-picked from 7538cc97e1695608123739d6ef8ff2ee1572aaec)

Bug: 19993667
Change-Id: I6f3f6aa373021cb8b6779e5354ac36436c4d98d3
/system/extras/ext4_utils/make_ext4fs.c
7538cc97e1695608123739d6ef8ff2ee1572aaec 07-Apr-2015 Jeff Sharkey <jsharkey@android.com> Add real UUID support to ext4_utils.

For some unknown reason, we've always been generating the same UUID
for every single ext4 partition that we formatted. Yikes.

Add a flag to request that a real UUID be generated when creating
filesystem.

Bug: 19993667
Change-Id: I6f3f6aa373021cb8b6779e5354ac36436c4d98d3
/system/extras/ext4_utils/make_ext4fs.c
04f4839594cb8ceea93b9c709bc5bba231d68ae0 06-Jan-2015 Mihai Serban <mihai.serban@intel.com> make_ext4fs: workaround for a glibc scandir bug

Due to a bug in glibc scandir the make_ext4fs tool fails sometimes
with error message:
"error: build_directory_structure: scandir: Cannot allocate memory"
A simple retry of the failed scandir in case errno is ENOMEM
greatly increases the chances to finish the operation successfully.

The scandir bug is reported here:
https://sourceware.org/bugzilla/show_bug.cgi?id=17804

Change-Id: I87fa283106c0215e4b358459022497d9ec1edb60
Signed-off-by: Mihai Serban <mihai.serban@intel.com>
/system/extras/ext4_utils/make_ext4fs.c
bec598e982301bf2714d37b14e312c9845c7cc0c 12-Aug-2014 Doug Zongker <dougz@google.com> add option to make_ext4fs to record blocks for each file

Add the -B option to make_ext4fs, which causes it to record the block
ranges used for each (regular) file in the image. We can use this
information to construct more efficient block-based incremental OTAs.

Bug: 16984795
Change-Id: I2a5325bb89948f63c76e93fdfa84c51f9b050104
/system/extras/ext4_utils/make_ext4fs.c
f5a6b34a9a6b3827f3f2cad111bf7eae3f1f034b 16-Jun-2014 David 'Digit' Turner <digit@google.com> am fb0c6296: am 9c82554e: Merge "Ignore wipe operation on non-block devices."

* commit 'fb0c62963b5fe1b4f36e281c4c02d98d737d08ee':
Ignore wipe operation on non-block devices.
eb5fcc3e932a8ccac1b580788a213c7782aff31b 12-Jun-2014 David 'Digit' Turner <digit@google.com> Ignore wipe operation on non-block devices.

The implementation of make_ext4fs() calls make_ext4fs_internal() by
forcing the |wipe| parameter to true, which is problematic when the
library is used within the emulator (the wipe operation will always
fail on non-Linux platforms).

This patch does the following:

- Add a 'is_block_device_fd()' function to check that a file descriptor
points to a real block device.

- Modify the implementation of wipe_block_device() uses it to return
silently when trying to wipe a non-block-device file.

- Add a WIPE_IS_SUPPORTED flag in wipe.h that indicates whether
block device wiping is supported on the current platform
(for now, this is only the case on Linux).

BUG=NONE

Change-Id: I62b62b7c3e99b465c3b876154231e7c2fe541b23
/system/extras/ext4_utils/make_ext4fs.c
e37d9e33c4f9e2631c293fdb585e81350f6c727f 16-May-2014 Colin Cross <ccross@android.com> am 14119df1: am b733b3c7: Merge "The situation len = 0 and absolute = false need to be handled"

* commit '14119df19e45b968774fc7242df780b87d93fef4':
The situation len = 0 and absolute = false need to be handled
7b4448de8deaef2512fb0b17a30facc47b2f4a87 28-Aug-2013 Benoit Fradin <benoit.fradin@intel.com> The situation len = 0 and absolute = false need to be handled

Add a return case for len == 0 and absolute == false

Change-Id: Ia36bd67ced6abbe7234eb7e485c1a2d8bd928ffe
Signed-off-by: Benoit Fradin <benoit.fradin@intel.com>
/system/extras/ext4_utils/make_ext4fs.c
d26eb624b931ac5ddb7252a9c77f8806a1bb0456 27-Apr-2014 Nick Kralevich <nnk@google.com> am fde5b354: am 79950456: Merge "Label lost+found directories with SELinux security contexts."

* commit 'fde5b354c85a30f4dbe79bcf4f19473de11e00ef':
Label lost+found directories with SELinux security contexts.
7907ac7c811670643c3606125657a39226507ea1 25-Apr-2014 Stephen Smalley <sds@tycho.nsa.gov> Label lost+found directories with SELinux security contexts.

When an asec image is generated, the lost+found directory has no
security.selinux attribute set and thus shows up as unlabeled.
We already handle this correctly when building images from existing
directories with files, so we just need to do it here as well when
generating an otherwise empty initial image.

Change-Id: I6d449dcc67a5cbc2101718e34ea0e184936d7f0e
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
/system/extras/ext4_utils/make_ext4fs.c
40ce87a70a064eeb462d3c3935422918c1f6114e 03-Mar-2014 Paul Lawrence <paullawrence@google.com> Remove warnings

Remove warnings called by duplicate definition of ALIGN macro.
Note that bionic/libc/include/sys/param.h defines ALIGN as

#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)

which is not good - clashes with every other definition of ALIGN.

Change-Id: I2d716c41ededd2fa072f944e21d94a0c93ca9c46
/system/extras/ext4_utils/make_ext4fs.c
3843c14979dce08cc6f800fa9964bf2f8a4bbb2c 31-Jan-2014 Colin Cross <ccross@android.com> resolved conflicts for merge of 74da0434 to master

Change-Id: I0a7745ecf65a2188c32e7bf2e89fe93259c71b83
af0723439af552c170425416ee8e35f4f20bbe67 23-Jan-2014 Colin Cross <ccross@android.com> ext4_utils: fix build for 64 bit

Correct u64/s64 definitions
Use PRIu64 to print u64

Change-Id: Icaf7998946b0a2faa03495b404af8b94e4e3d047
/system/extras/ext4_utils/make_ext4fs.c
782879ab61fe825835a9c6a701f91aa7d305acef 23-Jan-2014 Colin Cross <ccross@android.com> ext4_utils: move sparse file pointer out of fs_info

Move the sparse file pointer out of the fs_info struct in
preparation for exporting fs_info without sparse file support.

Change-Id: I5a72147fe4fb24296e615cb82dbba91c6dc6f7f0
/system/extras/ext4_utils/make_ext4fs.c
9526680de97e2bc963a70d1fabffe165a688bb1e 06-Dec-2013 Doug Zongker <dougz@android.com> allow fixing timestamps when building ext4 filesystem

When building an image, make_ext4fs currently sets the timestamps in
the image to the timestamps of the source files. Allow this time to
be overridden with a fixed value provided on the command line, to make
it easier to reproduce bit-identical images from a target_files zip.

Change-Id: I52ddab4575a334ee52404f4d5d1c61b55513c618
/system/extras/ext4_utils/make_ext4fs.c
4df62f342dbbe2f5cca831ce789dc0426d32ec03 07-Feb-2013 Nick Kralevich <nnk@google.com> ext4_utils: add filesystem capabilities support.

Add support for specifying filesystem capabilities when
creating a new filesystem.

The combination of SELinux extended attributes plus
filesystem capability extended attributes is too big
to fit inside one inode entry. Because of this, I added
support to ext4_utils to create an xattr block and link
the inode to that block. We continue to try to fit
everything inside the inode if possible, but fall over to
creating a block if the extended attribute is too big.

Change-Id: I40ebb63975b15ecd8c565486e171b4d50cd4dfaa
/system/extras/ext4_utils/make_ext4fs.c
5446bde9c02f6ae95a30d9c178b13a05bb580fe1 20-Feb-2013 Nick Kralevich <nnk@google.com> ext4_utils: clean up some warnings.

Change-Id: Ia9761e5168cfe6baabc0105ea76d5575fc378f48
/system/extras/ext4_utils/make_ext4fs.c
56497f28bd20001dd5f931208e8d948cf2f81b2f 04-Feb-2013 Colin Cross <ccross@android.com> ext4_utils: mark uninitialized inode tables in block groups

Block groups that have no used inodes have their inode table left
uninitialized, unless -t is specified, in which case they are
explicitly zeroed. When they are uninitialized, writing a sparse
ext4 image over existing data can cause e2fsck to confuse the
uninitialized data for lost inodes.

Set the EXT4_BG_INODE_UNINIT flags on block groups that have no
used inodes. This flag requires the block group checksum feature
to be enabled, so also enable the checksum feature in the superblock
and compute the checksum for the block group.

Since zeroing the inode tables is now useless, remove the code for
it and deprecate the -t command line option.

Change-Id: I4927c1d866d051547cf0dadc8c8703ded0163925
/system/extras/ext4_utils/make_ext4fs.c
2929313c66014bce5d53cf4323a9db507ca5b139 30-Jan-2013 Robert Craig <rpcraig@tycho.ncsc.mil> Fix root inode security labeling issue.

Introducing the verbose flag accidentally wrapped the
security label function call for the root inode. The
system.img will not be correctly labeled without this change.

Change-Id: If73b63d4ee815bbf428dc3d72b9df000a2075a45
Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
/system/extras/ext4_utils/make_ext4fs.c
2057370a2db739d8a7d8a475c9a0773efc3d91a0 17-Jan-2013 William Roberts <w.roberts@sta.samsung.com> Add verbose option to make_ext4 command

Enabeling the -v switch will cuase the
make_ext4 command to output the selinux
labeling context for all files.

Change-Id: Ifae8a11eb2c3f4644873d9784affffafb27775bf
/system/extras/ext4_utils/make_ext4fs.c
965298695c981ee5a67e86977a8e40a50f7392ab 24-Jan-2013 Colin Cross <ccross@android.com> ext4_utils: reduce exported apis

Remove unnecessary functions from make_ext4fs.h so they are not
exposed to users of libext4_utils.

Requires fixing up some internal places that depended on the
definitions in the external make_ext4fs.h header.

Change-Id: Ied24e0efb648d4fd2ccdd1a5a1b685e9bde9cfd7
/system/extras/ext4_utils/make_ext4fs.c
03ad99cff5743b9e0ce462f53dd2f0fcb17b169b 24-Jan-2013 Colin Cross <ccross@android.com> ext4_utils: export make_ext4fs_sparse_fd

Export a function to create a sparse image, writing the output to
an fd. Useful for utilities that need to format a partition.

Change-Id: I3737c65c69b7df0a0bd25885ee70aaadef8a4ad5
/system/extras/ext4_utils/make_ext4fs.c
5b89a4a6003d429343e608d78a97f552b13894de 21-Dec-2012 Colin Cross <ccross@android.com> ext4_utils: fix windows build by avoiding asprintf

asprintf is not available on windows. Since it is only being used outside
operations.

Change-Id: I79c3a3934f6de7a3cd3f17db5ae7731e9a68387c
/system/extras/ext4_utils/make_ext4fs.c
a4460149a5fadc639dbb708c332a75f9717c12d6 20-Dec-2012 Colin Cross <ccross@android.com> ext4_utils: canonicalize slashes in paths

Simplify handling of slashes between directories in paths by
forcing them to have leading and trailing slashes as appropriate
when passed in to make_ext4fs, and then keeping all directory
paths with a trailing slash.

As a side effect, using "/" as the mountpoint is now supported.

Change-Id: I73fe709c26003a20b0bdf6504db16cc9e39edf9b
/system/extras/ext4_utils/make_ext4fs.c
a532ecf00fcfdc334c55de75a63c3d0bc95a2379 27-Nov-2012 Colin Cross <ccross@android.com> make_ext4fs: fix sepolicy lookup for lost+found

selabel_lookup needs the full path including mountpoint.

Change-Id: Idc0641683a4e4528d94e54be1897315bf5fcdb0d
/system/extras/ext4_utils/make_ext4fs.c
c18120d04f164c00bad9d7006d29b4a795cf5d05 21-Nov-2012 Colin Cross <ccross@android.com> make_ext4fs: insert lost+found directory into filled filesystems

Insert a lost+found directory if necessary when creating a filesystem
based on a directory structure. This will make the resulting image
clean when tested with e2fsck, allowing e2fsck to be run on all images
as a validity test.

Change-Id: I81d0b6b4a802713270d3469e5a3bc555b680ec7e
/system/extras/ext4_utils/make_ext4fs.c
723f1c75295ce812dc062a537856cd5a54277895 10-Oct-2012 Kenny Root <kroot@google.com> Remove HAVE_SELINUX guards

Change-Id: Ieda8d8c331e9fccc7dcda228852d408ffc94e98c
/system/extras/ext4_utils/make_ext4fs.c
7eac42d21d448b1a7a983ede70d34f0927be37ae 10-Oct-2012 Kenny Root <kroot@google.com> make_ext4fs: add const qualifier to mountpoint

Silence compiler warning and enforce some const correctness by adding
the const qualifier to the mountpoint argument in make_ext4fs_internal

Change-Id: I0ce3c04fc36423e43b89e8e8d24735858a55e537
/system/extras/ext4_utils/make_ext4fs.c
f0ee37ffded79afdb03e15ae3a69969d2b7e6079 25-Apr-2012 Colin Cross <ccross@android.com> libsparse: make API sane

Replaces the libsparse API with a sane one based on an opaque
pointer.

Change-Id: I93bc9cf9a6b912a993ef554dbe6ffe2f0f723383
/system/extras/ext4_utils/make_ext4fs.c
dc5abeee1e6fc4827ee0d5ece12aaed2dd56f4c7 24-Apr-2012 Colin Cross <ccross@android.com> Refactor sparse file support into libsparse

Minimal refactoring of output_file.c into libsparse in preparation
for completely separating libsparse from ext4_utils.

Moves output_file.c, backed_block.c, and parts of ext4_utils.c
into libsparse. The only changes to the remanining files in
ext4_utils are using the new sparse.h header, and moving the
wipe call out of output_file.c and into make_ext4fs.c.

Change-Id: I1f66f6c3e05230a350023c5b4ea4422f16a73c4b
/system/extras/ext4_utils/make_ext4fs.c
2e5c52322d54d0f98d36b499fcaa31a0e84ca87c 31-Mar-2012 Kenny Root <kroot@google.com> resolved conflicts for merge of 8f9b41d9 to master

Change-Id: I9af02b9bba1176174540c849f905dece8ade54d8
6ece70806883534d29a74b9785871505f71ecc1f 09-Feb-2012 Stephen Smalley <sds@tycho.nsa.gov> Extend make_ext4fs() interface to allow callers to pass selabel_handle.

Extend make_ext4fs() to allow callers to pass an selabel_handle for
labeling files in the ext4 image. Previously, this was only done
via the _internal() function. This extends the library interface
so that it can be used by the recovery and updater code for labeling
files from OTA and update packages.

Change-Id: I4f6755fe7c65b69587276d17ef5b971ebec0161f
/system/extras/ext4_utils/make_ext4fs.c
b4eca4b24af9c80ebb2a7fa2ba539a48096b7576 13-Jan-2012 Stephen Smalley <sds@tycho.nsa.gov> Extend make_ext4fs to support setting SELinux security contexts in ext4 images.

Extend make_ext4fs with support for looking up the right security context from
the file_contexts configuration and setting it in the generated image. This is
similar to the existing support for looking up the UID/GID/mode via
android_filesystem_config.h and setting it, but via configuration rather than
defined in a header.

Change-Id: Ief9c44eeaaca4a44100a384b063f40b185469be3
/system/extras/ext4_utils/make_ext4fs.c
68e3dfd81ddb9367a0c3e0c72148c23a3227ed48 29-Mar-2012 Kenny Root <kroot@google.com> make_ext4fs: Allow custom filesystem configs

Before we used the "fs_config" function from
android_filesystem_config.h, but we want to use make_ext4fs with ASEC
containers which will not always be mounted in the same place.

Bug: 6258335
Change-Id: Icf62e3c46425f01434bf92a9823f8d542b0fa5b1
/system/extras/ext4_utils/make_ext4fs.c
0349bd9f14d252673a7a25767da4a80121aaaaf2 12-Jan-2012 Anatol Pomazau <anatol@google.com> Pass file descriptor instead of file name

Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.

Change-Id: Iba3758a0e13a898920d30d7fa5da696c22daa2b7
/system/extras/ext4_utils/make_ext4fs.c
4605b3fb8a00fa37f617a8d0fe3a095d0503a845 04-Feb-2012 Raphael Moll <raphael@google.com> Adapt ext4_utils for windows.

This is not a full port of ext4_utils for windows.
Instead it merely enables use to use the library
for the 'create an empty fs image' functionality
as used by 'fastboot format'.

Change-Id: Ia1ffacd64e4233c4fbb369c4ac5927ccd72ac526
/system/extras/ext4_utils/make_ext4fs.c
354350e3a92955e66abd1ea15536f8b6e5e66493 04-Feb-2012 Anatol Pomazau <anatol@google.com> Revert "Pass file descriptor instead of file name"

This reverts commit 89ddaab97e9214cf331baffee2de4595ad14dc79
/system/extras/ext4_utils/make_ext4fs.c
89ddaab97e9214cf331baffee2de4595ad14dc79 12-Jan-2012 Anatol Pomazau <anatol@google.com> Pass file descriptor instead of file name

Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.

Change-Id: I44146704572c314e1d6cfca7ce918efa7fb92a7a
/system/extras/ext4_utils/make_ext4fs.c
ae4f7dccadfafc36470a3e6f3084c6cf3cc63415 03-Feb-2012 Anatol Pomazau <anatol@google.com> Revert "Pass file descriptor instead of file name"

This reverts commit 93eb1dc9e68d2e9dea94f56d8bce478c1a52b354
/system/extras/ext4_utils/make_ext4fs.c
93eb1dc9e68d2e9dea94f56d8bce478c1a52b354 12-Jan-2012 Anatol Pomazau <anatol@google.com> Pass file descriptor instead of file name

Passing a file descriptor to make_ext4fs_internal() is more flexible.
We can use tmpfile() to create a temporary file.
tmpfile() is better than other solutions because it unlinks the file
right after creating it, so closing fd effectively removes temp file.
Thus we don't have to worry about large temp files accidently left
on the filesystem in case of the program crash.

Change-Id: I44109e98854c314e1d6cfca7ce918efa7fb92a7a
/system/extras/ext4_utils/make_ext4fs.c
88833a6277f305b6a03ff29d8e9ffe717ddb4045 14-Jul-2011 Ken Sumrall <ksumrall@android.com> Round down the filesystem size to a multiple of the block size

If it's not a multiple of the block size, then errors are generated
when making sparse images. This doesn't change the size of the generated
filesystem, because partial blocks are not included in the filesystem.

Change-Id: Ifc00ef7961f651ce22c6400759eadce2775d7811
/system/extras/ext4_utils/make_ext4fs.c
107a9f161babc20daf915311146b0e864d3b4157 30-Jun-2011 Ken Sumrall <ksumrall@android.com> Bug fixes to make_ext4fs

Fix definition of uuid struct.
Properly set the block_group number in each backup copy of the superblock.
Adjust the info.total_inodes field after rounding up the inodes per block group.
Add the option -t to initialize all the inode tables. If also specified with
the -s option, use the CHUNK_TYPE_FILL sparse records to initialize them.

Change-Id: Idd8bcee1b9bde3e82ad8da89ef974fbc12d7a6c6
/system/extras/ext4_utils/make_ext4fs.c
06c35f935a7adadceb9ee326b3231f952f6ad203 01-May-2011 Colin Cross <ccross@android.com> Merge "Make inodes per group a multiple of inodes per block"
96cc54a9bbc788673b7a38c23160d137211fd983 30-Apr-2011 Colin Cross <ccross@android.com> Make inodes per group a multiple of inodes per block

Kernel version 2.6.37 and later refuse to write to filesystems
for which inodes per group is not divisible by inodes per block.
Round the inodes per group up.

Change-Id: I9eb4fb5dd616a8abfd2f1fdc4b7d05538a2fc8fe
/system/extras/ext4_utils/make_ext4fs.c
2ae7663e1e064000356ee9e49ebd08bdddc545f9 24-Mar-2011 Ken Sumrall <ksumrall@android.com> Implement poor man's exception handling to prevent errors from killling recovery

make_ext4fs was originally designed to be a standalone program, and the
error() macro calls exit() after printing a diagnostic. However, when
it was turned into a library that recovery links against, calling exit()
kills the entire recovery process, which the kernel starts back up,
which dies, and the cycle continues.

This changes make_ext4fs to use setjmp() early, and changes error to
use longjmp to return to that point. When longjmp is called, the
error handler just returns an error. If it was invoked as a standalone
program, this causes the program to exit with an error. If it was
invoked as a library function, the error return is gracefully handled
by recovery.

Change-Id: Iad50f46cac0ac399b5cdfd083d5712f88a10e48e
/system/extras/ext4_utils/make_ext4fs.c
c2470654d4b4db09a7052fc5fa108ac21f1b1948 27-Jan-2011 Colin Cross <ccross@android.com> ext4_utils: Add support for wipe option, and wipe by default in recovery

Adds a -w option to make_ext4fs, which will attempt to use the
BLKSECDISCARD ioctl to erase the partition in order to avoid
leaving old data where it could be recovered, and to improve
wear levelling after a reformat.

Also causes factory reset through recovery to do a wipe.

Change-Id: Ibe34bbd84552e526be6bd041024a950806aca6b4
/system/extras/ext4_utils/make_ext4fs.c
983fb19d83d2391b19b289fc150495d8642378c4 20-Jan-2011 Ken Sumrall <ksumrall@android.com> Change the API for make_ext4fs() to better match the user's needs

The current make_ext4fs() is renamed make_ext4fs_internal(), and a new
make_ext4fs() has a simplified interface that supports the needs of
recovery and updater packages that call it.

Change-Id: I9e897f1f442c7f5060f8623ea74c3cf6a9c023e4
/system/extras/ext4_utils/make_ext4fs.c
435a8b61e925e3efb22fce08612efe210e83f791 15-Jan-2011 Ken Sumrall <ksumrall@android.com> Add the ability to specify a reserved space size when making filesystems.

If you specify a negative length when making a filesystem, then the
filesystem size is the size of the partiton (or image file) minus
the absolute value of the negative length specified.

Change-Id: I53e3b6de2ea692f4678682c3f49ff36429d9ad31
/system/extras/ext4_utils/make_ext4fs.c
2e905e5f2a3df605c68cb8633580c918e9f4ba71 29-Dec-2010 Colin Cross <ccross@android.com> ext4_utils: Fix warnings

Change-Id: Ibeb2001a1ac8cfedd9fced11b17afba4940b6bd5
/system/extras/ext4_utils/make_ext4fs.c
757ace516d8e4350616b5fd10da0c982d3d5ec74 29-Dec-2010 Colin Cross <ccross@android.com> ext4_utils: Add an optional CRC chunk at the end of sparse files

Change-Id: Ibfcf1cdeab47ca13870350184abf83e530acbc07
/system/extras/ext4_utils/make_ext4fs.c
b781330b1acae2e5706bbda8d81e5f7575f40e2a 23-Dec-2010 Colin Cross <ccross@android.com> ext4_utils: Get rid of CRC in sparse file header

Also removes the need to seek in the output file, allowing
stdin and stdout to be used for input and output.

Change-Id: I93cbe335d9cc83a6d21daa696af2cb54952dcc9f
/system/extras/ext4_utils/make_ext4fs.c
33f96c66e9a1f2e266a75e5e84c091dffa6ef118 23-Dec-2010 Colin Cross <ccross@android.com> ext4_utils: Add support for >2G input files

Change-Id: I6af69d676610099d3912e90fcab3cbdc27ace4e2
/system/extras/ext4_utils/make_ext4fs.c
22742ce739a046a079b2e1b03342a25472dfa352 23-Dec-2010 Colin Cross <ccross@android.com> ext4_utils: Move bg_desc_reserved_blocks from aux_info to info

Change-Id: Ic635afbb8819a00ca23ba2f93413fe707e2eec87
/system/extras/ext4_utils/make_ext4fs.c
75249edab0b22ea9aae9c7278b9f2c196c7d25d4 14-Aug-2010 Ken Sumrall <ksumrall@android.com> Add support for sparse ext4 image creation.

This adds the -s option to the make_ext4fs tool, which now creates
"sparse" filesystem images, which is very useful for the large 32 Gbyte
filesystems we are now building.
This check-in also fixes make_ext4fs to properly create filesystems
larger thatn 4 Gbytes on 64-bit Linux, 32-bit android and Macs.

Change-Id: Ie5838492fcf944f5c875481693c0dbd7013deae4
/system/extras/ext4_utils/make_ext4fs.c
de61f980c7b034eefac6e0ace718b3c1eb3f6252 05-Aug-2010 Colin Cross <ccross@android.com> Set timestamps on files based on source files

Use the modification time of the source files to set the modification
time, access time, and creation times in the filesystem image.

Change-Id: I720acba5ec435ceae92bb1653e3cc7545327b6ef
/system/extras/ext4_utils/make_ext4fs.c
e4b5ae8ab07e698b95f004c9226000b02f853abc 03-Aug-2010 Colin Cross <ccross@android.com> Create a journal by default

Change-Id: I7ab4e502ba4a0f1f3ae85d6d25f3936f4b66e5e8
/system/extras/ext4_utils/make_ext4fs.c
263eefd9fb9608432636c903423e43848e69f39d 30-Jun-2010 Doug Zongker <dougz@android.com> add make_ext4fs to the libext4_utils

Move the bulk of make_ext4fs into libext4_utils, leaving a main() that
does only option parsing. Add reset functionality so that
make_ext4fs() can be called multiple times within a process.

Change-Id: Ia09a2385eab32bf3ca9eb9257c4f9df2c85e55be
/system/extras/ext4_utils/make_ext4fs.c
881cca2f88ddcce86483b3ba95546b5641de8c0e 21-Jun-2010 Colin Cross <ccross@android.com> Split out libext4_utils

Change-Id: I12aa52b75607379add2669fddba4cd7dc2bb527f
/system/extras/ext4_utils/make_ext4fs.c
8aef66d2125af8de7672a12895276802fcc1948f 21-Jun-2010 Colin Cross <ccross@android.com> Fix whitespace

Change-Id: I37da6c38cd33ae22a0578ed8e91650e35972bf6a
/system/extras/ext4_utils/make_ext4fs.c
7a8bee7653c393d8da0e28668cb51d3ccab793e8 20-Jun-2010 Colin Cross <ccross@android.com> Add support for writing a gzip compressed image

Change-Id: Ica2ff90060f6a4ced2c671084205b58eede66cdf
/system/extras/ext4_utils/make_ext4fs.c
4b83b8acdcc4dad375adaf0f3b41fc41b22ee742 18-Jun-2010 Colin Cross <ccross@android.com> Fix ifdefs for linux

Change-Id: Iaf6fcd0f691e14edc82c9d1286c3d1b8ebeb1237
/system/extras/ext4_utils/make_ext4fs.c
ec0a2e83dc66d67addeb90e83144187691852a3e 11-Jun-2010 Colin Cross <ccross@android.com> Initial commit of ext4_utils

Change-Id: I911d5b7fd7170ec81d544850717d8e69976e272b
/system/extras/ext4_utils/make_ext4fs.c