vold: Fix encryption issue due to stack corruption.

Ioctl BLKGETSIZE expects pointer to unsigned long as argument.

On 64bit target using pointer to unsigned int can cause stack
corruption due to type mismatch.

Change-Id: I422068ba5006c0b685f1504e1e6aa30152ee8433
On bad removal unmount mountpoint of storage without partitions.

On bad removal of storage device, this change
will make sure to unmount the mount point
of the storage device having only disk and no partitions.

Change-Id: Ieb6ad1297883b93050abdf7d98346388cd5610df
Changes for supporting UICC feature

To have UICC support with multiple sysfs entries with
the same volume label, one boolean flag is added to validate
the correct sysfs entry in fstab.qcom

Change-Id: Ic254e514db95fca82552fea3f9b09310ac09b33b
vold: add support for Per-File-Encryption (PFE)

Add PFE-Enable command to crypto command listener.
The command handler creates the crypto-block-device
and mount it to /data, same as done for Full-Disk-Encryption (FDE)

Conflicts:
	cryptfs.h

Change-Id: I03e15e26800b96c0bf06398c6fc9fbb11fee6e71
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: cryptfs: add useful info messages

The vold can mount /data either to dm-crypt or dm-req-crypt target
with different parameters.
print that important info to the user space log.

Change-Id: I5a6925175b4b556f2675cef47f65f709a1b857e2
vold: reduce debug info printed

Print real_blk_name and extra_params instead of crypt_params.

Change-Id: I2c7e7f61d77b46ca1ae4ac9942e6052d5b7d13a4
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.

Conflicts:
cryptfs.c
Change-Id: Ic541d4d1b9db4ce32465e30c5f25619a80975767
vold: Fixes for HW FDE issues

SW FDE is using default password to encrypt the device by default.
Hence whenever password is updated, vold check if default password
was used to encrypt the device. Similar change is required for HW
based FDE as well.

Change-Id: Id251d7f93a034786fbff00ae9b921731353d9edc
vold: cryptfs: compiler fix

Add extra input to wait_and_unmount.

Change-Id: I8e2c68408965aab7142ee5c6b078e6d37a36224a
Build minivold for recovery

 * We can't link to the main recovery executable due to various issues,
   so just build a static minivold.

 * Updated for 4.4

Change-Id: If110aa4fca9608d5c2a03f471773e7ce2c77dc91

minivold: adjustments for vold in recovery

- Mount directly to /storage/ instead of /mnt/media_rw
- Do not attempt to mount ASEC

Change-Id: Icb088a413e07222b302264d10f7c7f2aadfebcab

minivold: Adjust to 5.0

Change-Id: I9defc2c8642da603bfa0dcf0962152485f75f547
vold: allow override of MAX_PARTITIONS for devices with > 4 partitions

Change-Id: I3847109be69539c23f92077b0b81aaf6ad224af5
DirectVolume: handle discs with multiple major numbers

CFlag: BOARD_VOLD_DISC_HAS_MULTIPLE_MAJORS

Allows Direct Volume to handle discs with multiple major numbers.
Needed on Samsung Galaxy S II and variants.

For example:
mmcblk0p1 - 179:0
mmcblk0p2 - 179:1
mmcblk0p3 - 179:2
mmcblk0p4 - 256:0
mmcblk0p5 - 256:1

Change-Id: If8f0f9d275e4642dd8e098817c993e07a5f1ada1
Reintroduce BOARD_VOLD_EMMC_SHARES_DEV_MAJOR

Code taken from CM7's vold

Change-Id: Iaa6ebe57710ffe93156e3a9e47739ad771bd314b
vold: use blkid to detect filesystem type

In preparation for handling ext4 partitions via vold and fuse.

Change-Id: Ibaccded63a7a293ad53f16afb80448ddd493554c
vold: Add NTFS support

Squashed commit of the following:

Author: kallt_kaffe <kallt_kaffe@apedroid.com>
vold: Add ntfs (read-only) support.

See http://review.cyanogenmod.com/#change,7457 for more info.
Change-Id: Ic841e73be6435e8bbbb22984cc749e27c46826e8

Author: Steve Kondik <shade@chemlab.org>
vold: Add NTFS read+write support via ntfs-3g

 * Use ntfs-3g for full NTFS support.
 * Original code from Freescale.
Change-Id: I01191c3c339421904dc9415eb00143f7f8365152

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
vold: Replace usage of discontinued logwrap()
Change-Id: Ia76bf8998064beee5e0ea4451c4dd8418c2193c4

Author: Steve Kondik <shade@chemlab.org>
Add support for formatting NTFS.

Change-Id: Ic841e73be6435e8bbbb22984cc749e27c46826e8
vold: exFAT support

 * Add support for exFAT using FUSE implementation.
Change-Id: I590c7b1bc8fbcb8c0b2c669f4073ac022857e4da

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
vold: Replace usage of discontinued logwrap()
Change-Id: Ia76bf8998064beee5e0ea4451c4dd8418c2193c4

Change-Id: I590c7b1bc8fbcb8c0b2c669f4073ac022857e4da
vold: add support for ext4 media

Squashed commit of the following:

Author: codeworkx <codeworkx@cyanogenmod.org>
vold: add support for ext4 media

Depends on:
http://review.cyanogenmod.org/31202
http://review.cyanogenmod.org/31211

Result:
http://pastebin.com/nzUbvW7K
Change-Id: I5bd227e637f2a1ed4d13a2eb81390c56c953f482

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
vold: Replace usage of discontinued logwrap()
Change-Id: Ia76bf8998064beee5e0ea4451c4dd8418c2193c4

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Apply the mounts to the SDCARD /storage path instead of /mnt/media_rw
Change-Id: I6c8d73a00c6ffa64875f3c4c718d8a416d08d5c1

Author: Pawit Pornkitprasan <p.pawit@gmail.com>
vold: restore 4.4 sdcard logic

Mount points in 4.4 are always fuse-wrapped to provide granular
permission. Unix file systems no longer need to be manually
fuse-wrapped by us.
Change-Id: I6885b0baeaae7c380ec32d410a70a4f53801157b

Change-Id: I5bd227e637f2a1ed4d13a2eb81390c56c953f482
vold: Add selinux support to ext4

Squashed commit of the following:

Author: Pawit Pornkitprasan <p.pawit@gmail.com>
vold: mount ext4 with forced SELinux context

Always mount voldmanaged ext4 partitions with the SELinux sdcard_external
context. For other file systems, this is done via the genfs_context,
but since ext4 supports SELinux natively, it must be set here.
Change-Id: I1364f37018b25d79b1826c85849def64e868d72f

Author: Pawit Pornkitprasan <p.pawit@gmail.com>
vold: force SELinux context only for sdcard

Google uses this code to mount ASEC as well and we shouldn't force
their SELinux contexts
Change-Id: I873af4dc2309d3d0942ce466b8acf8158abb85ae

Author: Jorge Ruesga <jorge@ruesga.com>
vold: pass selinux context to ext4 mount (remount ro)
Change-Id: Ic0bb314b30e42489c45caec29d35d6896c9849eb
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>

Change-Id: I1364f37018b25d79b1826c85849def64e868d72f
vold: allow non-vfat devices to be used as ASEC

CM supports alternative file systems (which some devices specify
in the fstab as 'auto').

Change-Id: I7e78fe87a7efc49d6749d5892107085d55156cce