Merge "Revert "Revert "Move fstab files to /vendor/etc/."""
diff --git a/aosp_marlin.mk b/aosp_marlin.mk
index edc959f..2c7e061 100644
--- a/aosp_marlin.mk
+++ b/aosp_marlin.mk
@@ -31,7 +31,7 @@
 PRODUCT_MANUFACTURER := google
 PRODUCT_RESTRICT_VENDOR_FILES := true
 
-PRODUCT_COPY_FILES += device/google/marlin/fstab.aosp_common:root/fstab.marlin
+PRODUCT_COPY_FILES += device/google/marlin/fstab.common:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.marlin
 
 $(call inherit-product, device/google/marlin/device-marlin.mk)
 $(call inherit-product-if-exists, vendor/google_devices/marlin/device-vendor-marlin.mk)
diff --git a/aosp_sailfish.mk b/aosp_sailfish.mk
index e3f77fc..d24877a 100644
--- a/aosp_sailfish.mk
+++ b/aosp_sailfish.mk
@@ -31,7 +31,7 @@
 PRODUCT_MANUFACTURER := google
 PRODUCT_RESTRICT_VENDOR_FILES := true
 
-PRODUCT_COPY_FILES += device/google/marlin/fstab.aosp_common:root/fstab.sailfish
+PRODUCT_COPY_FILES += device/google/marlin/fstab.common:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.sailfish
 
 $(call inherit-product, device/google/marlin/device-sailfish.mk)
 $(call inherit-product-if-exists, vendor/google_devices/marlin/device-vendor-sailfish.mk)
diff --git a/device-marlin.mk b/device-marlin.mk
index 778ca93..59ebd05 100644
--- a/device-marlin.mk
+++ b/device-marlin.mk
@@ -42,7 +42,7 @@
     ro.hwui.path_cache_size=32
 
 PRODUCT_COPY_FILES += \
-    device/google/marlin/fstab.common:root/fstab.marlin \
+    device/google/marlin/fstab.common:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.marlin \
     device/google/marlin/init.recovery.common.rc:root/init.recovery.marlin.rc
 
 # Sensor packages
diff --git a/device-sailfish.mk b/device-sailfish.mk
index 2e32269..4075ba3 100644
--- a/device-sailfish.mk
+++ b/device-sailfish.mk
@@ -42,7 +42,7 @@
     ro.hwui.path_cache_size=16
 
 PRODUCT_COPY_FILES += \
-    device/google/marlin/fstab.common:root/fstab.sailfish \
+    device/google/marlin/fstab.common:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.sailfish \
     device/google/marlin/init.recovery.common.rc:root/init.recovery.sailfish.rc
 
 # Sensor packages
diff --git a/fstab.aosp_common b/fstab.aosp_common
deleted file mode 100755
index 9b5f0b1..0000000
--- a/fstab.aosp_common
+++ /dev/null
@@ -1,16 +0,0 @@
-# Android fstab file.
-# 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
-
-#TODO: Add 'check' as fs_mgr_flags with data partition.
-# Currently we dont have e2fsck compiled. So fs check would failed.
-
-#<src>                                  <mnt_point>       <type>  <mnt_flags and options>                     <fs_mgr_flags>
-/dev/block/platform/soc/624000.ufshc/by-name/system    /           ext4    ro,barrier=1                                wait,slotselect,verify
-# 'vendor' partition is now early-mounted and fstab entry is specified in device tree
-# /dev/block/platform/soc/624000.ufshc/by-name/vendor    /vendor     ext4    ro,barrier=1                                wait,slotselect
-/dev/block/platform/soc/624000.ufshc/by-name/modem     /firmware/radio    vfat    ro,shortname=lower,uid=1000,gid=0,dmask=227,fmask=337,context=u:object_r:firmware_file:s0   wait,slotselect
-/dev/block/platform/soc/624000.ufshc/by-name/userdata    /data             ext4    noatime,nosuid,nodev,barrier=1,noauto_da_alloc      latemount,wait,check,formattable,fileencryption=ice
-/dev/block/zram0                        none              swap    defaults                                            zramsize=536870912
-/dev/block/platform/soc/624000.ufshc/by-name/misc        /misc           emmc  defaults defaults
-/devices/*/xhci-hcd.0.auto/usb*           auto              vfat    defaults                                            voldmanaged=usb:auto
diff --git a/fstab.common b/fstab.common
index 803f1de..0c1111f 100755
--- a/fstab.common
+++ b/fstab.common
@@ -1,16 +1,14 @@
 # Android fstab file.
-# 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
+# The filesystem that contains the filesystem e2fsck binary (typically /system) cannot
+# specify 'check', and must come before any filesystems that do specify 'check'
 
-#TODO: Add 'check' as fs_mgr_flags with data partition.
-# Currently we dont have e2fsck compiled. So fs check would failed.
-# NOTE: fstab.aosp_common is used for aosp. Make changes there as well.
-#<src>                                  <mnt_point>       <type>  <mnt_flags and options>                     <fs_mgr_flags>
-/dev/block/platform/soc/624000.ufshc/by-name/system    /           ext4    ro,barrier=1                                wait,slotselect,verify
-# 'vendor' partition is now early-mounted and fstab entry is specified in device tree
-# /dev/block/platform/soc/624000.ufshc/by-name/vendor    /vendor     ext4    ro,barrier=1                                wait,slotselect,verify
-/dev/block/platform/soc/624000.ufshc/by-name/modem     /firmware/radio    vfat    ro,shortname=lower,uid=1000,gid=0,dmask=227,fmask=337,context=u:object_r:firmware_file:s0   wait,slotselect
-/dev/block/platform/soc/624000.ufshc/by-name/userdata    /data             ext4    noatime,nosuid,nodev,barrier=1,noauto_da_alloc      latemount,wait,check,formattable,fileencryption=ice,quota
-/dev/block/zram0                        none              swap    defaults                                            zramsize=536870912
-/dev/block/platform/soc/624000.ufshc/by-name/misc        /misc           emmc  defaults defaults
-/devices/*/xhci-hcd.0.auto/usb*           auto              vfat    defaults                                            voldmanaged=usb:auto
+# NOTE: /vendor partition is now early-mounted and the fstab entry is specified in device tree:
+#       /proc/device-tree/firmware/android/fstab/vendor
+
+#<src>                                                  <mnt_point>         <type>  <mnt_flags and options>     <fs_mgr_flags>
+/dev/block/platform/soc/624000.ufshc/by-name/system     /                   ext4    ro,barrier=1                wait,slotselect,verify
+/dev/block/platform/soc/624000.ufshc/by-name/modem      /firmware/radio     vfat    ro,shortname=lower,uid=1000,gid=0,dmask=227,fmask=337,context=u:object_r:firmware_file:s0   wait,slotselect
+/dev/block/platform/soc/624000.ufshc/by-name/userdata   /data               ext4    noatime,nosuid,nodev,barrier=1,noauto_da_alloc  latemount,wait,check,formattable,fileencryption=ice,quota
+/dev/block/zram0                                        none                swap    defaults                    zramsize=536870912
+/dev/block/platform/soc/624000.ufshc/by-name/misc       /misc               emmc    defaults                    defaults
+/devices/*/xhci-hcd.0.auto/usb*                         auto                vfat    defaults                    voldmanaged=usb:auto
diff --git a/init.common.rc b/init.common.rc
index 63dd9ec..5a60c78 100644
--- a/init.common.rc
+++ b/init.common.rc
@@ -90,8 +90,8 @@
     wait /dev/block/platform/soc/${ro.boot.bootdevice}
     symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
 
-    mount_all fstab.${ro.hardware} --early
-    swapon_all fstab.${ro.hardware}
+    mount_all /vendor/etc/fstab.${ro.hardware} --early
+    swapon_all /vendor/etc/fstab.${ro.hardware}
 
     # Keeping following partitions outside fstab file. As user may not have
     # these partition flashed on the device. Failure to mount any partition in fstab file
@@ -129,7 +129,7 @@
     start gralloc-2-0
 
     # Mount RW partitions which need run fsck
-    mount_all fstab.${ro.hardware} --late
+    mount_all /vendor/etc/fstab.${ro.hardware} --late
 
     # boot time fs tune
     write /sys/block/sda/queue/iostats 0