From 439a869090282f229cf0edb41cc2d6e94f02b5c2 Mon Sep 17 00:00:00 2001 From: Mirko Vogt 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'. SVN-Revision: 34792 --- package/base-files/files/etc/init.d/boot | 2 +- package/base-files/files/etc/init.d/usb | 2 +- .../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 +++++----- package/base-files/files/sbin/firstboot | 2 +- 14 files changed, 34 insertions(+), 41 deletions(-) (limited to 'package/base-files') diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 43837a8..ef97383 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -66,7 +66,7 @@ start() { touch /var/log/lastlog touch /tmp/resolv.conf.auto ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf - grep -q debugfs /proc/filesystems && mount -t debugfs debugfs /sys/kernel/debug + grep -q debugfs /proc/filesystems && mount -o noatime -t debugfs debugfs /sys/kernel/debug [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe load_modules /etc/modules.d/* diff --git a/package/base-files/files/etc/init.d/usb b/package/base-files/files/etc/init.d/usb index 7b443b6..43cdfd9 100755 --- a/package/base-files/files/etc/init.d/usb +++ b/package/base-files/files/etc/init.d/usb @@ -4,6 +4,6 @@ START=39 start() { [ -d /proc/bus/usb ] && { - /bin/mount -t usbfs none /proc/bus/usb + mount -o noatime -t usbfs none /proc/bus/usb } } 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 8a1d4e0..c03714f 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 e2ba01d..7233fd9 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 b924fce..db59706 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 8c3f27b..137c3bf 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 66f185e..6a7bd30 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 5d979fd..fc04eb7 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 ed59b5b..7535b3f 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 b75d692..b55a7f2 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 00f45a8..ded785e 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 821bfb1..b76f111 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 e6de348..e796c7b 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 } diff --git a/package/base-files/files/sbin/firstboot b/package/base-files/files/sbin/firstboot index 4da2991..8fbd499 100755 --- a/package/base-files/files/sbin/firstboot +++ b/package/base-files/files/sbin/firstboot @@ -27,7 +27,7 @@ if [ "${0##*/}" = "firstboot" ]; then boot_run_hook jffs2reset else mtd erase "$partname" - mount "$mtdpart" /overlay -t jffs2 + mount -o noatime "$mtdpart" /overlay -t jffs2 fopivot /overlay /rom 1 fi fi -- cgit v1.1