From 53edda1e3668752d18b2bbf4c3d6edc7e3ab1b6e Mon Sep 17 00:00:00 2001 From: mirko Date: Wed, 19 Dec 2012 16:07:46 +0000 Subject: Do not overload mount-call - trying to reduce confusion The behaviour of calling 'mount' differed depending on whether it called the busybox-mount, the mount of util-linux, the mount defined in /lib/functions.sh and /lib/functions/boot.sh /etc/preinit even included /lib/functions.sh and /lib/functions/boot.sh, both re-defining 'mount'. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34792 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files/lib/firstboot/20_no_fo_mount_jffs | 4 ++-- .../files/lib/firstboot/30_is_rootfs_mounted | 2 +- package/base-files/files/lib/functions.sh | 3 --- package/base-files/files/lib/functions/boot.sh | 26 +++++++++------------- .../base-files/files/lib/preinit/10_check_for_mtd | 2 +- .../base-files/files/lib/preinit/10_essential_fs | 6 ++--- .../files/lib/preinit/20_device_fs_mount | 8 +++---- .../base-files/files/lib/preinit/40_mount_devpts | 2 +- .../base-files/files/lib/preinit/40_mount_jffs2 | 2 +- .../files/lib/preinit/70_pivot_jffs2_root | 2 +- package/base-files/files/lib/upgrade/common.sh | 12 +++++----- 11 files changed, 31 insertions(+), 38 deletions(-) (limited to 'package/base-files/files/lib') diff --git a/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs b/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs index 8a1d4e06d..c03714fa6 100644 --- a/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs +++ b/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs @@ -5,8 +5,8 @@ no_fo_mount_jffs() { # initialize jffs2 - mount "$mtdpart" /overlay -t jffs2 || exit - + mount -o noatime "$mtdpart" /overlay -t jffs2 || exit + # workaround to ensure that union can attach properly sync ls /overlay >/dev/null diff --git a/package/base-files/files/lib/firstboot/30_is_rootfs_mounted b/package/base-files/files/lib/firstboot/30_is_rootfs_mounted index e2ba01d50..7233fd903 100644 --- a/package/base-files/files/lib/firstboot/30_is_rootfs_mounted +++ b/package/base-files/files/lib/firstboot/30_is_rootfs_mounted @@ -4,7 +4,7 @@ # Copyright (C) 2010 Vertical Communications skip_if_rootfs_mounted() { - mount "$mtdpart" /rom/overlay -t jffs2 || exit + mount -o noatime -t jffs2 "$mtdpart" /rom/overlay || exit } boot_hook_add switch2jffs skip_if_rootfs_mounted diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index b924fce28..db59706bc 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -6,9 +6,6 @@ debug () { ${DEBUG:-:} "$@" } -mount() { - busybox mount "$@" -} # newline N=" diff --git a/package/base-files/files/lib/functions/boot.sh b/package/base-files/files/lib/functions/boot.sh index 8c3f27ba4..137c3bf47 100644 --- a/package/base-files/files/lib/functions/boot.sh +++ b/package/base-files/files/lib/functions/boot.sh @@ -2,10 +2,6 @@ # Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2010 Vertical Communications -mount() { - /bin/busybox mount -o noatime "$@" -} - boot_hook_splice_start() { export -n PI_HOOK_SPLICE=1 } @@ -112,12 +108,12 @@ dupe() { # } pivot() { # - mount -o move /proc $1/proc && \ + mount -o noatime,move /proc $1/proc && \ pivot_root $1 $1$2 && { - mount -o move $2/dev /dev - mount -o move $2/tmp /tmp - mount -o move $2/sys /sys 2>&- - mount -o move $2/overlay /overlay 2>&- + mount -o noatime,move $2/dev /dev + mount -o noatime,move $2/tmp /tmp + mount -o noatime,move $2/sys /sys 2>&- + mount -o noatime,move $2/overlay /overlay 2>&- return 0 } } @@ -126,16 +122,16 @@ fopivot() { # root=$1 { if grep -q overlay /proc/filesystems; then - mount -t overlayfs -olowerdir=/,upperdir=$1 "overlayfs:$1" /mnt && root=/mnt + mount -o noatime,lowerdir=/,upperdir=$1 -t overlayfs "overlayfs:$1" /mnt && root=/mnt elif grep -q mini_fo /proc/filesystems; then - mount -t mini_fo -o base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt + mount -t mini_fo -o noatime,base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt else - mount --bind / /mnt - mount --bind -o union "$1" /mnt && root=/mnt + mount --bind -o noatime / /mnt + mount --bind -o noatime,union "$1" /mnt && root=/mnt fi } || { [ "$3" = "1" ] && { - mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1 + mount | grep "on $1 type" 2>&- 1>&- || mount -o noatime,bind $1 $1 dupe $1 $rom } } @@ -144,7 +140,7 @@ fopivot() { # ramoverlay() { mkdir -p /tmp/root - mount -t tmpfs -o mode=0755 root /tmp/root + mount -t tmpfs -o noatime,mode=0755 root /tmp/root fopivot /tmp/root /rom 1 } diff --git a/package/base-files/files/lib/preinit/10_check_for_mtd b/package/base-files/files/lib/preinit/10_check_for_mtd index 66f185e1a..6a7bd307f 100644 --- a/package/base-files/files/lib/preinit/10_check_for_mtd +++ b/package/base-files/files/lib/preinit/10_check_for_mtd @@ -5,7 +5,7 @@ mount_no_mtd() { mtd unlock rootfs - mount -o remount,rw /dev/root / + mount -o noatime,remount,rw /dev/root / } check_for_mtd() { diff --git a/package/base-files/files/lib/preinit/10_essential_fs b/package/base-files/files/lib/preinit/10_essential_fs index 5d979fd49..fc04eb7ff 100644 --- a/package/base-files/files/lib/preinit/10_essential_fs +++ b/package/base-files/files/lib/preinit/10_essential_fs @@ -3,11 +3,11 @@ # Copyright (C) 2010 Vertical Communications do_mount_procfs() { - mount -t proc proc /proc + mount -o noatime -t proc proc /proc } do_mount_sysfs() { - mount -t sysfs sysfs /sys + mount -o noatime -tsysfs sysfs /sys } calc_tmpfs_size() { @@ -16,7 +16,7 @@ calc_tmpfs_size() { do_mount_tmpfs() { calc_tmpfs_size - mount -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp + mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp } boot_hook_add preinit_essential do_mount_procfs diff --git a/package/base-files/files/lib/preinit/20_device_fs_mount b/package/base-files/files/lib/preinit/20_device_fs_mount index ed59b5b23..7535b3ff9 100644 --- a/package/base-files/files/lib/preinit/20_device_fs_mount +++ b/package/base-files/files/lib/preinit/20_device_fs_mount @@ -6,19 +6,19 @@ do_move_devtmpfs() { local mnt="$(grep devtmpfs /proc/mounts)" mnt="${mnt#* }"; mnt="${mnt%% *}" - [ "$mnt" = "/dev" ] || mount -o move "$mnt" /dev + [ "$mnt" = "/dev" ] || mount -o noatime,move "$mnt" /dev } do_mount_devfs() { - mount -t devfs devfs /dev + mount -o noatime -t devfs devfs /dev } do_mount_hotplug() { - mount -t tmpfs -o mode=0755,size=512K tmpfs /dev + mount -t tmpfs -o noatime,mode=0755,size=512K tmpfs /dev } do_mount_udev() { - mount -n -t tmpfs -o mode=0755 udev /dev + mount -n -t tmpfs -o noatime,mode=0755 udev /dev } choose_device_fs() { diff --git a/package/base-files/files/lib/preinit/40_mount_devpts b/package/base-files/files/lib/preinit/40_mount_devpts index b75d69287..b55a7f2e8 100644 --- a/package/base-files/files/lib/preinit/40_mount_devpts +++ b/package/base-files/files/lib/preinit/40_mount_devpts @@ -7,7 +7,7 @@ init_devpts() { } do_mount_devpts() { - mount -t devpts devpts /dev/pts + mount -o noatime -t devpts devpts /dev/pts } boot_hook_add preinit_essential init_devpts diff --git a/package/base-files/files/lib/preinit/40_mount_jffs2 b/package/base-files/files/lib/preinit/40_mount_jffs2 index 00f45a890..ded785ed5 100644 --- a/package/base-files/files/lib/preinit/40_mount_jffs2 +++ b/package/base-files/files/lib/preinit/40_mount_jffs2 @@ -4,7 +4,7 @@ find_mount_jffs2() { mkdir -p /tmp/overlay - mount "$(find_mtd_part rootfs_data)" /tmp/overlay -t jffs2 + mount -o noatime -t jffs2 "$(find_mtd_part rootfs_data)" /tmp/overlay mtd -qq unlock rootfs_data } diff --git a/package/base-files/files/lib/preinit/70_pivot_jffs2_root b/package/base-files/files/lib/preinit/70_pivot_jffs2_root index 821bfb14f..b76f111ca 100644 --- a/package/base-files/files/lib/preinit/70_pivot_jffs2_root +++ b/package/base-files/files/lib/preinit/70_pivot_jffs2_root @@ -5,7 +5,7 @@ rootfs_pivot() { check_skip || jffs2_not_mounted || { echo "switching to jffs2" - mount -o move /tmp/overlay /overlay 2>&- + mount -o noatime,move /tmp/overlay /overlay 2>&- fopivot /overlay /rom && pi_mount_skip_next=true } } diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index e6de34849..e796c7bac 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -36,16 +36,16 @@ install_bin() { # [ ... ] pivot() { # mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1 mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \ - mount -o move /proc $1/proc && \ + mount -o noatime,move /proc $1/proc && \ pivot_root $1 $1$2 || { umount $1 $1 return 1 } - mount -o move $2/sys /sys - mount -o move $2/dev /dev - mount -o move $2/tmp /tmp - mount -o move $2/overlay /overlay 2>&- + mount -o noatime,move $2/sys /sys + mount -o noatime,move $2/dev /dev + mount -o noatime,move $2/tmp /tmp + mount -o noatime,move $2/overlay /overlay 2>&- return 0 } @@ -71,7 +71,7 @@ run_ramfs() { # [...] umount -l /mnt grep /overlay /proc/mounts > /dev/null && { - mount -o remount,ro /overlay + mount -o noatime,remount,ro /overlay umount -l /overlay } -- cgit v1.2.3