Add SELinux restorecon calls on ASEC containers.

This will allow fine-grained labeling of the
contents of ASEC containers. Some of the contents
need to be world readable and thus should be
distinguishable in policy.

Change-Id: Iefee74214d664acd262edecbb4f981d633ff96ce
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
Convert all selinux_android_restorecon and _setfilecon calls to new API.

libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Avoid segv by checking argc in "storage user <mountpoint>"

Change-Id: Iffd67746e2e273c4c3f87741e5f13aa511ccb557
Signed-off-by: JP Abgrall <jpa@google.com>
Add missing head sys/types.h to Volume.h
 Fix compile error of build with C++

Change-Id: I2dec329d23c2187d878c1244541d627c68c09a69
Signed-off-by: sndnvaps <sndnvaps@gmail.com>
Do not show disk errors if they are expected.

An error shows up during boot if vold disk has different majors.
On some devices this is expected and set in config, so do not
confuse users and skip the error (as it ain't one)
Bonus: Better log for duplicate state. It was useless...

Change-Id: Ibc047729432e2f6746a9439b828d1443951ade1f
Revert "[4/4] exFAT Support"

still supports exFAT just cleanup.

This reverts commit 3cfd9e4280e07cc61823f16f7bd02ad3085c834c.

Change-Id: Ifdad9fbe7f2c91af88c7a6892e2c456d7b38cac0
vold: don't crash when formatting unformatted volume

When formatting unformatting volumes, fstype will be NULL causing
a crash in strcmp. Set it to "vfat" to avoid the crash.

Change-Id: I3876ea2a6d91e78f579537fd6ea3d030fb18ee7b
vold: Allow specifying the filesystem type when formatting

 * Optional parameter added to "volume format" to specify the filesystem
   type to use. If not specified, default is to auto-detect.
 * Add support for formatting NTFS.
 * Use mke2fs to format when not creating containers.

Change-Id: I2bc0f92d59adb9604b35a1f70febccfba68715d3
vold: Clean up warnings

 * Clean up all the dead code and get rid of all warnings

Change-Id: I8101b6314012a39e8e3a9b9b9aa8f4841b4c430d
Volume: Don't crap out when dealing with unformatted cards

And plug a memory leak when formatting them

Change-Id: I2ab58328d07a343a5ec9e1c4b58f8258f0c9133c
vold: Honor mount options for ext4 mounts

Change-Id: Ie77e0d402c2c16d544251f7fdaeaad34d030d121
Add Flash-Friendly File System (f2fs) support.

Change-Id: If46bf7329a7453122a4379f9bc41cf9553426e74
f2fs: disable fsck check

fsck.f2fs does not fix any inconsistencies "yet".

Disable fsck routine as this is just wasting time consumed to mount f2fs volumes.

The kernel can determine if a f2fs volume is too damaged that it shouldn't get mounted.

We should wait for f2fs-tools version higher than v1.3.0.
(fsck.f2fs for fixing inconsistencies is a work-in-progress)

References:
https://github.com/torvalds/linux/blob/master/Documentation/filesystems/f2fs.txt#L261
https://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git

Change-Id: I7e0a4662ac70860fe139bb9331b7aee1ad76220f
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Adding support of dm-req-crypt

Currently Android provides disk encryption support using dm-crypt
which is based on bios. dm-crypt uses 512 bytes packet size for
crypto operations. While 512 bytes size packet is ok for SW based
disk encryption, it is inefficient for HW based crypto engines.
dm-req-crypt is similar to dm-crypt except it uses block requests
rathe bios for crypto operations. block requests when unpacked
carries data upto 512KB. Hence, HW based crypto engine can be used
more efficiently.

Change-Id: Ic541d4d1b9db4ce32465e30c5f25619a80975767
Create disk encryption key before framework start

HW based disk encryption creates key in secure side. Key creation
can take sometime to create the key securely. If framework is
started before creating the key, it is possible that framework
requests service from secure side. Secure side can serve mostly one
request at a time. Secure side may reject framework request if key
creation request is still going on. This may cause problem in the
system

Change-Id: I5480ab72a37c02532218a18faaba598a824589fd
vold: Support for moving crypto metadata

 * We have a situation where we need to move the crypto metadata
   from a partition footer to a new place. Add support for this.

Change-Id: I5ccc312f7f062d8a8215530957da9c6283ed7ca5
Validate asec names.

Make sure asec names only contain alphanumeric, underscores,
dots, or dashes. Don't allow double dots.

Bug: 12504045
Change-Id: I3dd0350c79327dc91a5a10d5724d85d99814e769
vold: Send UUID with list response

UUID defaults to 0 if not available

Change-Id: I59df514aeffa7d926a31d02589e6ff3031bde79e