History log of /system/core/fs_mgr/fs_mgr.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0a423d994a0dbd05924ae6cff702b5d4d7dd43f0 29-Apr-2015 Paul Lawrence <paullawrence@google.com> DO NOT MERGE Securely encrypt the master key

(chery-picked from commit 806d10be2336f32cdca16c2540cbf3d548f2fec7)

Move all key management into vold
Reuse vold's existing key management through the crypto footer
to manage the device wide keys.

Use ro.crypto.type flag to determine crypto type, which prevents
any issues when running in block encrypted mode, as well as speeding
up boot in block or no encryption.

This is one of four changes to enable this functionality:
https://android-review.googlesource.com/#/c/148586/
https://android-review.googlesource.com/#/c/148604/
https://android-review.googlesource.com/#/c/148606/
https://android-review.googlesource.com/#/c/148607/

Bug: 18151196

Change-Id: I6a8a18f43ae837e330e2785bd26c2c306ae1816b
/system/core/fs_mgr/fs_mgr.c
9fc834377297cb2dcc418e4ce7e38e89dd09812b 16-May-2015 Elliott Hughes <enh@google.com> Don't use TEMP_FAILURE_RETRY on close in system/core.

Bug: http://b/20501816
Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
(cherry picked from commit 47b0134ec2b5e8c8b5b5671cd4a3e41261275532)
/system/core/fs_mgr/fs_mgr.c
92f075aa08a2665ad03c80a0408667f8864f1ecd 24-Apr-2015 Elliott Hughes <enh@google.com> am 48ba7587: am 34dd04db: Merge "Improve bad error reporting seen in shamu SELinux boot failures."

* commit '48ba758782bed8c50f450fd77c4b3284c3fa7316':
Improve bad error reporting seen in shamu SELinux boot failures.
5e7dd4454f066f5d2d138f4f8bb8739245b29bf2 24-Apr-2015 Elliott Hughes <enh@google.com> Improve bad error reporting seen in shamu SELinux boot failures.

Explain why mount failed, and explicitly say that the umount fixed it.

Change-Id: I13b0927a36517f2fc9f9580945ba6ebefc4882df
/system/core/fs_mgr/fs_mgr.c
438443e742d9cfb91c1193144a3b41744ffad34b 14-Apr-2015 Ed Tam <etam@google.com> resolved conflicts for merge of 79f33846 to lmp-mr1-dev-plus-aosp

Change-Id: I24c60a2747931917a3ea09b953905ce0f4145280
79f338465213885900cea5a39f3aeeea083bbe51 05-Sep-2013 Chris Fries <cfries@motorola.com> fs_mgr: introduce fs_mgr_format to format wiped partitions

Move fastboot's format logic into fs_mgr, to consolidate the knowledge
about how to do this (and when to wipe metadata).

Try to format these formattable paritions if they are wiped.

If formatting fails, we will fall out to let recovery mode handle it.

Bug: 20082763
Change-Id: I397cc197550e78d932e8a154fd234695c46dbe7b
/system/core/fs_mgr/fs_mgr.c
b8c9d273a07f3fc45780e763bb3f7f6266b8cab7 26-Mar-2015 Paul Lawrence <paullawrence@google.com> Revert "Revert "Adding e4crypt support""

Fix build break caused by original change

This reverts commit 84b0bab58fcc7f225e9a17a15c531b0c2fc509c5.

Change-Id: I99fbd7c3d1ed92db1f546033c8493bb71a327924
/system/core/fs_mgr/fs_mgr.c
622d44d86481295660534cd06a8b5914466acf29 28-Feb-2015 Sami Tolvanen <samitolvanen@google.com> am fbb3f8ca: Merge "Set underlying block device RO when enabling verity"

* commit 'fbb3f8ca499b04c82437155f87c8666cad607c6b':
Set underlying block device RO when enabling verity
214f33b8c095feedfdbaa680ff6ffb763f47d375 18-Dec-2014 Sami Tolvanen <samitolvanen@google.com> Set underlying block device RO when enabling verity

Currently, when verity is set up on a block device, the underlying
device is still accessible directly. Change the existing function
fs_set_blk_ro visible to other fs_mgr modules, change the behavior
to match the comment above the function definition, and call it to
disable write access to the block device when setting up verity.

Bug: 18609347
Change-Id: I7884175df15f9161174788d74d20a08e4cd472ca
/system/core/fs_mgr/fs_mgr.c
a1738915329e704ea52fc09c222bb4893e6e51df 07-Feb-2015 Paul Lawrence <paullawrence@google.com> am 317b4024: Revert "Make encryption configurable"

* commit '317b4024a2a46b8c57abfa08f2a649df13572bd3':
Revert "Make encryption configurable"
846c8e0d34ab15de84adc462440f2e95f53ac863 06-Feb-2015 Nick Kralevich <nnk@google.com> am 17b5b352: Merge "fs_mgr: error check umount calls / add retry logic"

* commit '17b5b3520094de679c9e43a872c02d15758c83b8':
fs_mgr: error check umount calls / add retry logic
317b4024a2a46b8c57abfa08f2a649df13572bd3 06-Feb-2015 Paul Lawrence <paullawrence@google.com> Revert "Make encryption configurable"

This reverts commit bda6272446454886339841a62daaa1b66c07ad60.

The original fix seems to have led to boot failures in QA. Rather than
risk shipping, revert the change. Bug 18764230 reopened.

Requires change
https://googleplex-android-review.git.corp.google.com/#/c/629764/

Bug: 19278390
Bug: 19199624

Change-Id: I8b6ab585666f2b0f585ffb2a5f61ac2e3462e06e
/system/core/fs_mgr/fs_mgr.c
7294eb6cae4b201c481b2a171d042c56b810b8b3 06-Feb-2015 Nick Kralevich <nnk@google.com> fs_mgr: error check umount calls / add retry logic

Don't silently ignore umount errors. At a minimum, log them.

Add strerror(errno) to another umount call, to make sure we get
some actionable data.

check_fs: try 5 times umounting the filesystem. It appears that
the umount is failing, perhaps because some service is opening
the file on the device or other error. Try unmounting it multiple
times in case it's a transient problem and we can recover.

Bug: 19199624
Bug: 19156134
Change-Id: I7213eb52d55116fb2419a36494d26d5e159981a7
/system/core/fs_mgr/fs_mgr.c
36d0eaecd7bd7970b91ac35d6753bf715097e3b9 21-Jan-2015 Paul Lawrence <paullawrence@google.com> Make encryption configurable

Delay mounting encryptable but unencrypted volumes until we can
check the ro.vold.forceencrypt flag, then optionally encrypt.

Requires matching vold change from
https://googleplex-android-review.git.corp.google.com/#/c/615309/

Bug: 18764230
Change-Id: If22008be8de6a4f3216b349f81ace49be1730314
/system/core/fs_mgr/fs_mgr.c
2f7ee6b7dd36f3d5c55473b67dc2430c795402ce 07-Jan-2015 Paul Lawrence <paullawrence@google.com> Provide a way to select force encryption from vendor partition

This allows a vendor to force encryption on devices via a vendor
partition flag:

ro.vold.forceencryption 1

Bug: 18764230
Change-Id: Id0049ce64e34e4f6f96e593aadd70c277ac131c8
/system/core/fs_mgr/fs_mgr.c
7e890a4d32816d34b30fb5d1f651d966d64bbf36 26-Jan-2015 Paul Lawrence <paullawrence@google.com> am bda62724: Make encryption configurable

* commit 'bda6272446454886339841a62daaa1b66c07ad60':
Make encryption configurable
0944e305ff0a04fd1be8c1d5d157e68d11936802 23-Jan-2015 Elliott Hughes <enh@google.com> am 4e0bdd10: Merge "fs_mgr: Support filesystem labels in fstab"

* commit '4e0bdd1034ffcf55f4ebcbd547cf4aad59c05f03':
fs_mgr: Support filesystem labels in fstab
829823484703968acc7201400f2de4ab7d80e04b 17-Dec-2014 Christoffer Dall <christoffer.dall@linaro.org> fs_mgr: Support filesystem labels in fstab

When mounting fstab entries it is practical to be able to specify
for example LABEL=data instead of a specific block device.

This is particularly important for the new Android Emulator code base,
which uses virtio block devices for the various partitions
(system,data,cache), because there is no defined ordering between the
way the filesystems are specified to the emulator and how they are
enumerated by the android kernel as /dev/vdX.

Change-Id: I7aef95f12e8f7b02ac2e33804ba7897fdcb9ad7f
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
/system/core/fs_mgr/fs_mgr.c
1fdd4dc0bc44af0dbbd458b44a84db9e775ebe7d 23-Jan-2015 Elliott Hughes <enh@google.com> am 4083ed7d: Merge "Revert "fs_mgr: Support filesystem labels in fstab""

* commit '4083ed7dff6e1dd8e20bec04f9451061951394f5':
Revert "fs_mgr: Support filesystem labels in fstab"
253b9cfba53d3f45e908856d311e28de9e5c1017 23-Jan-2015 JP Abgrall <jpa@google.com> am f9e23395: Merge "fs_mgr: Support filesystem labels in fstab"

* commit 'f9e2339553f70aebdd170e96ab9332b28c3851b4':
fs_mgr: Support filesystem labels in fstab
4083ed7dff6e1dd8e20bec04f9451061951394f5 23-Jan-2015 Elliott Hughes <enh@google.com> Merge "Revert "fs_mgr: Support filesystem labels in fstab""
572226c25cce1890880813c051feb86e51eddad5 23-Jan-2015 Elliott Hughes <enh@google.com> Revert "fs_mgr: Support filesystem labels in fstab"

This reverts commit 69407ccb02a6b1b63f96657cd40a07c48e648cea.

Change-Id: I537a3b4257b7bc2a69f1f4d62b4e18e91f2dc713
/system/core/fs_mgr/fs_mgr.c
f9e2339553f70aebdd170e96ab9332b28c3851b4 23-Jan-2015 JP Abgrall <jpa@google.com> Merge "fs_mgr: Support filesystem labels in fstab"
bda6272446454886339841a62daaa1b66c07ad60 21-Jan-2015 Paul Lawrence <paullawrence@google.com> Make encryption configurable

Delay mounting encryptable but unencrypted volumes until we can
check the ro.vold.forceencrypt flag, then optionally encrypt.

Requires matching vold change from
https://googleplex-android-review.git.corp.google.com/#/c/615309/

Bug: 18764230
Change-Id: If22008be8de6a4f3216b349f81ace49be1730314
/system/core/fs_mgr/fs_mgr.c
69407ccb02a6b1b63f96657cd40a07c48e648cea 17-Dec-2014 Christoffer Dall <christoffer.dall@linaro.org> fs_mgr: Support filesystem labels in fstab

When mounting fstab entries it is practical to be able to specify
for example LABEL=data instead of a specific block device.

This is particularly important for the new Android Emulator code base,
which uses virtio block devices for the various partitions
(system,data,cache), because there is no defined ordering between the
way the filesystems are specified to the emulator and how they are
enumerated by the android kernel as /dev/vdX.

Change-Id: I12c3db0ba6a515dc8e917e0349afd257888d3aef
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
/system/core/fs_mgr/fs_mgr.c
703b87de5b84e24ea119556dcc3683cb4ce941cf 07-Jan-2015 Paul Lawrence <paullawrence@google.com> Provide a way to select force encryption from vendor partition

This allows a vendor to force encryption on devices via a vendor
partition flag:

ro.vold.forceencryption 1

Bug: 18764230
Change-Id: Id0049ce64e34e4f6f96e593aadd70c277ac131c8
/system/core/fs_mgr/fs_mgr.c
ec900bba20630934dc51a1b3a57d6d7a30fed325 09-Oct-2014 Paul Lawrence <paullawrence@google.com> Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""

This reverts commit 152d2d4234ba89e0c20c4af13e291b6049a7bc33.

Fixed build error, and also fixed memory leak spotted from warning.

(cherry-pick of bbb36319119edde9377fb80015235893c30d2bc9.)

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
/system/core/fs_mgr/fs_mgr.c
eb6036ac6be82dcc6e110de22574972631c8f83e 08-Nov-2014 JP Abgrall <jpa@google.com> fs_mgr: let fsck.f2fs actually attempt a fix

The newer fsck.f2fs (1.4.0++) has better fix support, so invoke it.

Requires http://ag/583949 f2fs-tools update.

Bug: 17640053
Bug: 18292088
Change-Id: I42370d92b232e0bdbf28cccf7035a15dbffeb268
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
bbb36319119edde9377fb80015235893c30d2bc9 09-Oct-2014 Paul Lawrence <paullawrence@google.com> Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""

This reverts commit 152d2d4234ba89e0c20c4af13e291b6049a7bc33.

Fixed build error, and also fixed memory leak spotted from warning.

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
/system/core/fs_mgr/fs_mgr.c
152d2d4234ba89e0c20c4af13e291b6049a7bc33 09-Oct-2014 Nick Kralevich <nnk@google.com> Revert "Enable verity on userdebug, and add disable-verity to adb"

Build is broken.

system/core/fs_mgr/fs_mgr_verity.c: In function 'fs_mgr_setup_verity':
system/core/fs_mgr/fs_mgr_verity.c:103:20: error: 'verity_table_signature' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!RSA_verify(key,
^
system/core/fs_mgr/fs_mgr_verity.c:374:11: note: 'verity_table_signature' was declared here
char *verity_table_signature;
^
cc1: all warnings being treated as errors
make: *** [out/target/product/minnow/obj/STATIC_LIBRARIES/libfs_mgr_intermediates/fs_mgr_verity.o] Error 1
make: *** Waiting for unfinished jobs....

This reverts commit d4cea0bc16d1ad96cc6d6177232d7b339785460c.

Change-Id: I6862cc79ef9d944a2472b6fb2e46dae514cea8ce
/system/core/fs_mgr/fs_mgr.c
d4cea0bc16d1ad96cc6d6177232d7b339785460c 07-Oct-2014 Paul Lawrence <paullawrence@google.com> Enable verity on userdebug, and add disable-verity to adb

Bug: 17691572

Change-Id: I58f588f318e7952d06a41325337d946d7c007e31
/system/core/fs_mgr/fs_mgr.c
cf234dc7e081ac4063c3c5ddcdd4da40c82d51cb 09-Sep-2014 Paul Lawrence <paullawrence@google.com> Preserve errno from fsmgr_do_mount

Bug: 17358530
Change-Id: I4cd7403c0b7c4f878d6afa5199f998e6f614adb9
/system/core/fs_mgr/fs_mgr.c
cee206880ef80ac570df6b369d12f111c00f653a 02-Jul-2014 JP Abgrall <jpa@google.com> [HACK]fs_mgr+init: Format via recovery if encryptable /data is wiped

If the encryptable partition is wiped (4KB worth of 0 or 0xff),
then reboot into recovery to format /data+/cache

This is while waiting for the Mac OS support to format f2fs.
The flashstation running on Mac OS will currently just erase userdata
and not format it with f2fs.

Bug: 15720406
Bug: 15747366
Change-Id: Ib7cca3e1701483a09573457a835750f34da71ee0
/system/core/fs_mgr/fs_mgr.c
f22b7452940c99b830749cabdd929f9f7cfdaacc 02-Jul-2014 JP Abgrall <jpa@google.com> fs_mrg: clean up multi-type mount_all

Move the code that attempts to mount alternative fstab entries
into its own function.
Clarify return codes.
Suggest wipe via recovery in error messages.

Bug: 15747366
Change-Id: I3634477cd4d1d73f974f3e906c53285f0d9e0eac
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
7553d57298c3d807371298b5e5d99eb9ce5ca6aa 30-Jun-2014 JP Abgrall <jpa@google.com> fs_msg: fix bad tmpfs detection (fix /persist mount errors)

Without this, the wrong mount point is flagged as being mounted.
Which leads to:

<6>[ 3.278040] fs_mgr: __mount(source=/dev/block/platform/msm_sdcc.1/by-name/userdata,target=/data,type=ext4)=-1
<7>[ 3.278834] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<6>[ 3.278925] fs_mgr: fs_mgr_mount_all(): skipping fstab dup mountpoint=/persist rec[3].fs_type=ext4 already mounted.


Bug: 15925030
Bug: 15976144
Change-Id: I0bc617f11dfc97c32bb2d0e52b94ec19282568eb
/system/core/fs_mgr/fs_mgr.c
f67d6bd3c0fb41d167c675b9d2b5d377b6f38a74 26-Jun-2014 Daniel Rosenberg <drosen@google.com> Moved symlink back up.

Moving the vendor symlink down was causing issues with some devices.
Moved it back up, and adjusted mount to remove symlinks if necessary.

Change-Id: I77126d77cfbef32250012bea3960c99b55db4cbb
Signed-off-by: Daniel Rosenberg <drosen@google.com>
/system/core/fs_mgr/fs_mgr.c
983411318fb3b841c567cf1357649335806a0657 25-Jun-2014 JP Abgrall <jpa@google.com> fs_mgr: fix double mounting of partition

When looking for partitions to encrypt, it would setup a tmpfs
onto the mount point. But with multi-type mount points it would
repeat the mount.
This would lead to having and extra tmpfs mounted on /data, as
only one would get removed.

Change-Id: I28f2c2c4955906f1172342ea07e0795d6880986b
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
f530c93c4aab818de51fd7123199bef6621047f8 28-May-2014 Daniel Rosenberg <drosen@google.com> Added support for vendor partition and image

Modified fastboot to flash vendor.img as well. Moved symlink
for /vendor to occur after mounting partitions. Changed mount
to also create the mount point.

Change-Id: I78e1ba24e6bb8b4af96a67ee0569af579439e682
Signed-off-by: Daniel Rosenberg <drosen@google.com>
/system/core/fs_mgr/fs_mgr.c
4bb7bba118ae02b8f4c52d5c7eeac15514794971 20-Jun-2014 JP Abgrall <jpa@google.com> [HACK]fs_mgr: force recovery+wipe if data looks wiped

We do the recovery+wipe if
- the mount fails and
- the partition is forceencrypt
- the partition seems wiped (== the 1st 4KB are all 0x00 or 0xFF).

This is a hack until we get the flashstation up and running with f2fs.
Bug: 15731906

The alternative would be for the user to manually enter
recovery and wipe his device.

Bug: 15747366
Change-Id: Ic8f3ef59f3d7d01d5d93d8e4c01502080f422157
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
5c01dac6d81a804dcff233da777882bec852f25b 18-Jun-2014 JP Abgrall <jpa@google.com> fsmgr: support multiple fs-types/mountpoint

Previous attempt was broken.
It would incorrectly be affected by mount failures.

This changes allows an fstab to contain multiple lines for a given
mount point.
The lines sharing a mount MUST be after each other.

The 1st matching line is the primary when it comes to mounting
and look ups for wiping.

Mounting based on a mount_point will attempt each dup in turn
until one succeeds.
The reported error will be that of the last failed attempt.

This is to allow quick experimentation between different FSes.

Bug: 15702546
Change-Id: I378d68ad13eb0098ec1ccb8dcf108b82acbe9ebb
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
f786fe54388cb4461f8e13845ca6a1df0d2e1236 18-Jun-2014 JP Abgrall <jpa@google.com> fsmgr: revert multiple fs-types/mountpoint (fix N5 boot)

This is apparently breaking N5, so reverting for now.

This reverts commit a794f86522f9125f2547c94ebc7c74d1e7ace013.

Bug: 15709256
Change-Id: I37a5160eead17e153e2c83fa94632ffa5d8553c2
/system/core/fs_mgr/fs_mgr.c
a794f86522f9125f2547c94ebc7c74d1e7ace013 18-Jun-2014 JP Abgrall <jpa@google.com> fsmgr: allow for a multiple fs-types for a mount point.

This changes allows an fstab to contain multiple lines for a given
mount point.
The lines sharing a mount MUST be after each other.

The 1st matching line is the primary when it comes to mounting
and look ups for wiping.

Mounting based on a mount_point will attempt each dup in turn
until one succeeds.

This is to allow quick experimentations between different FSes.
It does not deal with checkfs yet, because the underlying invocation
of fs-type appropriate fsck does not handle the error code.
Only the primary FS (1st in the dups) is checked.

Change-Id: I8329737454b53e2681436fe85cd00a9bc522676b
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
1235158c29909132fbe9aa52939061fc81f0800e 18-Jun-2014 JP Abgrall <jpa@google.com> F2FS support for fastboot format and fsmgr

- Enables fsck.f2fs for partitions with type F2FS.
- Adds support for f2fs as format fs-type.
- f2fs is optional and support is dlopen()d when needed.

Needs changes in
system/extras/f2fs_utils
external/f2fs-tools

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/fs_mgr/fs_mgr.c
2e5ae0a4f90ad7a2a1aa9382abb97d9450209c50 04-Apr-2014 Paul Lawrence <paullawrence@google.com> Add force_encrypt flag to fstab to force encryption on appropriate devices

forceencrypt= will encrypt the drive at boot if it is not encrypted. This change
will not have an impact until we set this flag in appropirate fstabs.

Bug: 11985952

Change-Id: I6c65eda7f109e4936aa160da50f871703aefb351
/system/core/fs_mgr/fs_mgr.c
cd642fc0b5ab4c17428bc35b670815e037a3a0af 02-Apr-2014 Geremy Condra <gcondra@google.com> fs_mgr: disable verified partitions on debuggable devices.

This checks ro.debuggable to determine whether a device is in the
debuggable state or not, disabling verification if it is.

Eventually we'd like to narrow this down to only devices which
need to disable it, but we aren't there yet.

Change-Id: I06a329fe5449deab6bae595877dbb1f200850241
/system/core/fs_mgr/fs_mgr.c
166fa3de7060198252b43a4a9ddd841fb6d65cf7 03-Feb-2014 Paul Lawrence <paullawrence@google.com> Auto-encrypt drive at startup

Modify fs_mgr to unmount encryptable drives after test mounting them and
then trigger an auto-encrypt via the init script

Needs matching vold changes from
https://googleplex-android-review.googlesource.com/#/c/414200/

Feature is limited to list of serial numbers with this change

Bug: 11985952
Change-Id: I84f85a258b6a7e9809467c9149249302e203c41b
/system/core/fs_mgr/fs_mgr.c
611f5e960c24961dfa2b3ad236aba43fd84d89cb 12-Mar-2014 Mohamad Ayyash <mkayyash@google.com> fs_mgr: fix mount_all when handling already mounted encryptable fs.

Since 38afe5f4ba5fd834a221a636e63d311fa5a17c8a
fs_mgr_mount_all() will try to behave more like "mount -a"

So prevent inaccessible or busy (already mounted) encryptable filesystems
from mounting tmpfs in their mount points.


Change-Id: I32e5b3e26f2138d1e4d9ef8ba01c1466f8051d39
/system/core/fs_mgr/fs_mgr.c
38afe5f4ba5fd834a221a636e63d311fa5a17c8a 10-Mar-2014 Mohamad Ayyash <mkayyash@google.com> fs_mgr: Ensure mount_all will process all fstab entries despite logging errors.

Change-Id: I0d58dd17d979b749a9ac03567cf2d395f9782f10
/system/core/fs_mgr/fs_mgr.c
28483d7ec497e06850be1d8f87d7fa522c8ab9d4 17-Feb-2014 David 'Digit' Turner <digit@google.com> fs_mgr: Don't run e2fsck inside SDK system images.

These images do not have GPL-ed binaries like /system/bin/e2fsck so
avoid running the program when we detect that we're running inside
one of them.

Note that this does not affect other emulator-based build products
(e..g full-eng instead of sdk-eng), which do have the binaries.

BUG=13057123

Change-Id: Ia42f1d02a3845fbf4b2f9d95818f35d760711a12
/system/core/fs_mgr/fs_mgr.c
5edee2aca94cb0bfc45786260e23fbce1b239d87 23-Jan-2014 Colin Cross <ccross@android.com> fs_mgr: split fstab parsing into separate file

Move fstab parsing into fs_mgr_fstab.c so that it compiles into a
separate compilation unit. uncrypt links against it but doesn't
need to pull in the rest of the dependencies on fs_mgr.c.

Change-Id: I6bffe1cd42720151533e958028259d1931aaa4bf
/system/core/fs_mgr/fs_mgr.c
071f28ae0e6dc55e13303282b185c76b23ff1c3a 14-Jan-2014 William Roberts <wroberts@tresys.com> fs_mgr: increase verboseness on mount errors

While debugging a mount error, the dmesg output was less
than ideal. The error would be declared but why the mount
failed, and what options were passed was not present. This
patch ensures that the mount options and underlying
errno are printed.

Change-Id: I2b3a2c113149df878c0a8a10ef86fd9e4f909658
/system/core/fs_mgr/fs_mgr.c
bc7776716a2b94edae66e0e7dea2900d569a75ef 15-Jan-2014 Nick Kralevich <nnk@google.com> Revert "fs_mgr: correct warning on unused function parameter"

The build is broken.

system/core/fs_mgr/fs_mgr.c:824:77: error: expected '(' before 'unused'
const char *blk_device, long long length __attribute__(unused))
^
system/core/fs_mgr/fs_mgr.c: In function 'fs_mgr_add_entry':
system/core/fs_mgr/fs_mgr.c:824:56: warning: unused parameter 'length' [-Wunused-parameter]
const char *blk_device, long long length __attribute__(unused))
^
make: *** [out/target/product/generic_x86/obj/STATIC_LIBRARIES/libfs_mgr_intermediates/fs_mgr.o] Error 1
make: *** Waiting for unfinished jobs....
This reverts commit 21095d0cae64c70b4ac7e90af7a6787019cc317a.

Change-Id: I64f8c4d9c17c0e3bbf2eb427a2c0b81bbe66ec3a
/system/core/fs_mgr/fs_mgr.c
21095d0cae64c70b4ac7e90af7a6787019cc317a 14-Jan-2014 William Roberts <wroberts@tresys.com> fs_mgr: correct warning on unused function parameter

target thumb C: libfs_mgr <= system/core/fs_mgr/fs_mgr.c
system/core/fs_mgr/fs_mgr.c: In function 'fs_mgr_add_entry':
system/core/fs_mgr/fs_mgr.c:828:56: warning: unused parameter 'length' [-Wunused-parameter]
const char *blk_device, long long length)

Change-Id: Ide1bfa120c4f8d8e2f643929cb84c1be065e3310
/system/core/fs_mgr/fs_mgr.c
bfa7d0822b2811d667fba1b326fd54a083fd5a95 08-Jan-2014 Elliott Hughes <enh@google.com> SWAP_FLAG_* constants are now in <sys/swap.h>.

Bug: 9336527
Change-Id: I77e2b05cefbfb4eebda39b4079107833f4160563
/system/core/fs_mgr/fs_mgr.c
b5ffadedd48a3e9a5e302925a87eeec47ac00dbe 24-Sep-2013 Rom Lemarchand <romlem@google.com> am 397a3642: fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab

* commit '397a3642145dbd0919f8148ff24f0cafe1714b55':
fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab
397a3642145dbd0919f8148ff24f0cafe1714b55 24-Sep-2013 Rom Lemarchand <romlem@google.com> fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab

Make sure fstab is not NULL before freeing it

Bug: 10911605
Change-Id: I549c0a470dd183fb15a2f3c5cf4f3dd393b6e307
/system/core/fs_mgr/fs_mgr.c
dfcbf02bb0a6705e3714a59e42e052fbb0ce8799 24-Sep-2013 Ken Sumrall <ksumrall@android.com> am 6b1a0272: Merge "Create a separate copy of the fsck logs" into klp-dev

* commit '6b1a027239689a817aa5ca44a2bcbfe48ed21408':
Create a separate copy of the fsck logs
12d71925862c9268a06c4a9bbf0904f22e1c5323 24-Sep-2013 Ken Sumrall <ksumrall@android.com> am 777a00e3: Merge "New fstab flags to support more expressive SD card permissions" into klp-dev

* commit '777a00e3d193e45d928b1a26de85ae5a238271c4':
New fstab flags to support more expressive SD card permissions
4eaf905858c6a1d7cf0639bed3e8de3bd7987646 19-Sep-2013 Ken Sumrall <ksumrall@android.com> Create a separate copy of the fsck logs

The log_target parameter of android_fork_execvp_ext() is now a
bit field, and multiple targets can be set to log to multiple
places at the same time.

The new target LOG_FILE will log to a file specified by the new
parameter file_path.

Set LOG_FILE and log to a file in /dev (the only writable filesystem
avilable when e2fsck runs) when invoking e2fsck in fs_mgr.

Bug: 10021342

Change-Id: I63baf644cc8c3afccc8345df27a74203b44d0400
/system/core/fs_mgr/fs_mgr.c
887f2892062c64fa688fc9525ebd09cc98ca70d8 12-Sep-2013 Ken Sumrall <ksumrall@android.com> New fstab flags to support more expressive SD card permissions

Bug: 10330128

Change-Id: I41fb178b839487b604762fbc1ccba097d25c7aa0
/system/core/fs_mgr/fs_mgr.c
a2a93250f625b776886d3c5d41599abdaddb2e50 19-Sep-2013 Elliott Hughes <enh@google.com> am c67bd8d7: am a208ea63: Merge "Fix fstab memory leak"

* commit 'c67bd8d7cd9b43a5a5ef249ea787ac9786359d22':
Fix fstab memory leak
d431b8d7f1396fe984b946f55e480ead99219484 18-Sep-2013 Irina Tirdea <irina.tirdea@intel.com> Fix fstab memory leak

When reading the fstab config file fails, fstab memory is not freed.
When fstab structure is no longer needed, only half of it is freed.

Free fstab memory in all cases (error or when it is no longer needed).

Change-Id: Ib0758a5aaa69505285bf64143632986a2dbbdccb
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
/system/core/fs_mgr/fs_mgr.c
9f25b565f716d865597dd24761137a93f08d4bb1 19-Sep-2013 Elliott Hughes <enh@google.com> am c4295d9b: am 810ff696: Merge "Cleanup fs_getline from fs_mgr"

* commit 'c4295d9b72812afbaebd7f2512c7a5bba9e7d5fa':
Cleanup fs_getline from fs_mgr
e16d747b5105f52895c5e1a687568ea4cab804d5 06-Sep-2013 Irina Tirdea <irina.tirdea@intel.com> Cleanup fs_getline from fs_mgr

Since getline is included in bionic, fs_mgr can use this version instead of
the one defined internally by fs_getline.

Replace fs_getline with getline.

Change-Id: I49b53d639bd995f051256fb7573ff6ab45d9c36d
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
/system/core/fs_mgr/fs_mgr.c
3ad3d1c4b5856d4e314febc5671c74e78a76db00 23-Feb-2013 Geremy Condra <gcondra@google.com> Add basic verity support to fs_mgr.

This change adds a "verify" fs_mgr flag specifying that
the device in question should be verified.

Devices marked with this flag are expected to have a
footer immediately after their data containing all
the information needed to set up a verity instance.

Change-Id: I10101f2c3240228ee0932e3767fe35e673d2e720
/system/core/fs_mgr/fs_mgr.c
5bc31a2632f453e03edac714b865773970bba608 09-Jul-2013 Ken Sumrall <ksumrall@android.com> Add support for swap entries in fstab

Swap entries can optionally specify a swapprio= or zramsize= flag
in the fs_mgr flags field.

Change-Id: I30530501efd4112af4e158898a9f65f6443c4fdb
/system/core/fs_mgr/fs_mgr.c
e18c0d508a6d8b4376c6f0b8c22600e5aca37f69 17-Apr-2013 Nick Kralevich <nnk@google.com> fs_mgr: make block devices read-only

When a filesystem is mounted read-only, make the underlying
block device read-only too. This helps prevent an attacker
who is able to change permissions on the files in /dev
(for example, symlink attack) from modifying the block device.

In particular, this change would have stopped the LG Thrill / Optimus
3D rooting exploit
(http://vulnfactory.org/blog/2012/02/26/rooting-the-lg-thrill-optimus-3d/)
as that exploit modified the raw block device corresponding to /system.

This change also makes UID=0 less powerful. Block devices cannot
be made writable again without CAP_SYS_ADMIN, so an escalation
to UID=0 by itself doesn't give full root access.

adb/mount: Prior to mounting something read-write, remove the
read-only restrictions on the underlying block device. This avoids
messing up developer workflows.

Change-Id: I135098a8fe06f327336f045aab0d48ed9de33807
/system/core/fs_mgr/fs_mgr.c
bf021b4cd760a48b38c58347a35157180593c4b8 20-Mar-2013 Ken Sumrall <ksumrall@android.com> fs_mgr: Capture the output of e2fsck and add to the kernel log

Currently, the output of e2fsck is not saved, and we have no insight
into how many errors e2fsck is finding and fixing. Using the new
abbreviated logging feature in liblogwrap, up to the first 100 lines,
and last 4K bytes of the output of e2fsck is captured by fs_mgr, and
added to the kernel log.

Usually, the filesystem will be clean, and this will only add a few
lines to the kernel log on boot, but when things go wrong, it should
save enough to indicate what the problem is, without potentially
filling the kernel log with only e2fsck output if the filesystem is
really corrupted.

Change-Id: I9c264798e6fe721c8f818b5ce15d0975027ddbdd
/system/core/fs_mgr/fs_mgr.c
6c2c121386f5e19ed74dc8d706bcb1e6f65fc1ba 23-Feb-2013 Ken Sumrall <ksumrall@android.com> fs_mgr: add support for new recoveryonly flag

If a device has an ext4 partition that contains the radio
firmware, and that filesystem is not mounted in normal
operation, we need a flag to prevent mount_all from
mounting it, so the new flag recoveryonly was added.

Change-Id: I361800c494e751b04c4faf956870f15fd0d8fe20
/system/core/fs_mgr/fs_mgr.c
ab6b852235d99d752678312c155a3f1c140fb483 13-Feb-2013 Ken Sumrall <ksumrall@android.com> fs_mgr: support a unified fstab format.

Update fs_mgr to support more flags needed to unify the 3
fstabs currently in android into one.

Change-Id: Ie46cea61a5b19882c55098bdd70f39e78fb603be
/system/core/fs_mgr/fs_mgr.c
1626b98c5b1d4755f0f146698d487732dcc0a2cc 12-Nov-2012 Ken Sumrall <ksumrall@android.com> am 7fd51b36: am b20fa762: Merge "Fix fs_mgr to properly invoke e2fsck on encrypted devices" into jb-mr1.1-dev

* commit '7fd51b36dabedee4de159213237e71ba20865812':
Fix fs_mgr to properly invoke e2fsck on encrypted devices
d42d327c176d5819423f4bf9e211bb12bb5dde72 07-Nov-2012 Ken Sumrall <ksumrall@android.com> Fix fs_mgr to properly invoke e2fsck on encrypted devices

Change-Id: Ie220f5cb7b614a48ec8afe66f4721ede3a368166
/system/core/fs_mgr/fs_mgr.c
07266528740d860ed42ea881214e44cd0411bd6a 27-Sep-2012 Elliott Hughes <enh@google.com> am cfd7c2a0: am 1c0c5250: Merge "Rename getline to fs_getline for fs_mgr"

* commit 'cfd7c2a05166a3ff27b2145b007834408d95a2e0':
Rename getline to fs_getline for fs_mgr
cfd7c2a05166a3ff27b2145b007834408d95a2e0 27-Sep-2012 Elliott Hughes <enh@google.com> am 1c0c5250: Merge "Rename getline to fs_getline for fs_mgr"

* commit '1c0c52503dcedff1a75775bf8bfffe7ec77b722b':
Rename getline to fs_getline for fs_mgr
295b82bd691d413c07665c7e7607fe0e5d3485f5 27-Aug-2012 Irina Tirdea <irina.tirdea@intel.com> Rename getline to fs_getline for fs_mgr

fs_mgr defines its own version of getline and uses it
internally. This leads to a build error if getline is
also defined in bionic, since fs_mgr will see readline
as defined internally.

Rename getline in fs_mgr to a local name (fs_getline)
so that there will no longer be any conflicts.

This is needed it we want to add getline in bionic.

Change-Id: I3a32be71a645e122629802d98ff8f9ab9c419e86
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
/system/core/fs_mgr/fs_mgr.c
e50ac5f7771872331df70251d23d6bd8155da4a7 14-Aug-2012 Jeff Sharkey <jsharkey@android.com> Support shared-subtree and bind mount flags.

Bug: 6925012
Change-Id: Id8d887d17c6b1b2f90cfd1a1de991ccaba730b7d
/system/core/fs_mgr/fs_mgr.c
5dc5bfefa078f2aded34f85db4613ba91ad49b76 24-Jul-2012 Ken Sumrall <ksumrall@android.com> Mount/unmount filesystems before running e2fsck

This works around a performance problem in the firmware of
some emmc chips.

Change-Id: Ia414b4604d11e47ce9cb3f86ac82602e081bb09e
/system/core/fs_mgr/fs_mgr.c
c1bf89663ca71949b508007d4df2b5b06038f96d 07-Jan-2012 Ken Sumrall <ksumrall@android.com> A filesystem manager library to mount filesystems for init.

Instead of specifying in init what to mount, and having various hacks in init
itself to deal with encryption, use a filesystem manager library to do the
work, that can also be invoked by vold when mounting an encrypted volume.
Keep all the magic filesystem info an a device specific fstab file.

Change-Id: Ib988f1e4fb0638ba1d5fd98407fa6d8cf862aaca
/system/core/fs_mgr/fs_mgr.c