Use the filesystem mounter to mount and check filesystems

fs_mgr reads /fstab.<device> to determine what to mount and what to
check, and removes the details from the init.<device>.rc file.

Change-Id: Idf9f9ba737a4850dc15a926a74e74b9d7023693f
diff --git a/device.mk b/device.mk
index 6b89b58..3ecc226 100644
--- a/device.mk
+++ b/device.mk
@@ -69,6 +69,7 @@
 	$(LOCAL_KERNEL):kernel \
 	device/samsung/tuna/init.tuna.rc:root/init.tuna.rc \
 	device/samsung/tuna/init.tuna.usb.rc:root/init.tuna.usb.rc \
+	device/samsung/tuna/fstab.tuna:root/fstab.tuna \
 	device/samsung/tuna/ueventd.tuna.rc:root/ueventd.tuna.rc \
 	device/samsung/tuna/media_profiles.xml:system/etc/media_profiles.xml \
 	device/samsung/tuna/media_codecs.xml:system/etc/media_codecs.xml \
@@ -192,6 +193,7 @@
 # Filesystem management tools
 PRODUCT_PACKAGES += \
 	make_ext4fs \
+	e2fsck \
 	setup_fs
 
 # for bugmailer
diff --git a/fstab.tuna b/fstab.tuna
new file mode 100644
index 0000000..d9b7503
--- /dev/null
+++ b/fstab.tuna
@@ -0,0 +1,11 @@
+# Android fstab file.
+#<src>                                                  <mnt_point>         <type>    <mnt_flags and options>                               <fs_mgr_flags>
+# The filesystem that contains the filesystem checker binary (typically /system) cannot
+# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
+
+
+/dev/block/platform/omap/omap_hsmmc.0/by-name/system    /system             ext4      ro                                                    wait
+/dev/block/platform/omap/omap_hsmmc.0/by-name/efs       /factory            ext4      ro                                                    wait
+/dev/block/platform/omap/omap_hsmmc.0/by-name/cache     /cache              ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic    wait,check
+/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata  /data               ext4      noatime,nosuid,nodev,nomblk_io_submit,errors=panic    wait,check,encryptable=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
+
diff --git a/init.tuna.rc b/init.tuna.rc
index 36d6bb9..1e0a87f 100755
--- a/init.tuna.rc
+++ b/init.tuna.rc
@@ -41,7 +41,6 @@
 on boot
 	mount debugfs /sys/kernel/debug /sys/kernel/debug
 	chmod 0666 /dev/pvrsrvkm
-	setprop ro.crypto.keyfile.userdata /dev/block/platform/omap/omap_hsmmc.0/by-name/metadata
 
 # autosuspend root hubs immediatly after attached devices
 	write /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms 0
@@ -49,11 +48,7 @@
 
 on fs
 	mkdir /factory 0775 radio radio
-	mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system wait ro
-	setprop ro.crypto.tmpfs_options size=128m,mode=0771,uid=1000,gid=1000
-	mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /data wait noatime nosuid nodev nomblk_io_submit,errors=panic
-	mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/cache /cache wait noatime nosuid nodev nomblk_io_submit,errors=panic
-	mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory wait ro
+	mount_all /fstab.tuna
 	setprop ro.crypto.fuse_sdcard true
 
 # change permissions for mtd device