[PATCH] base-files: read all 3 bytes in get_magic_vfat() at once

Paul Spooren mail at aparcar.org
Mon Jan 4 03:59:43 EST 2021



On Mo, Jan 4, 2021 at 01:28, Adrian Schmutzler 
<freifunk at adrianschmutzler.de> wrote:
> While the speed improvement might be negligible, there is still no
> reason to read individual bytes.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---

I'm wondering how many times dd needs to be run to sum up to the same 
amount of time this took to create, but let's make it a bit more:
Please add the newly added magic_fat32 function as well.
https://github.com/openwrt/openwrt/commit/927b9df938803d409d6b3a47d6834a6c10f68c3d

>  package/base-files/Makefile                    | 2 +-
>  package/base-files/files/lib/upgrade/common.sh | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/base-files/Makefile b/package/base-files/Makefile
> index da3976424f..8d40eb0e49 100644
> --- a/package/base-files/Makefile
> +++ b/package/base-files/Makefile
> @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
>  include $(INCLUDE_DIR)/feeds.mk
> 
>  PKG_NAME:=base-files
> -PKG_RELEASE:=244
> +PKG_RELEASE:=245
>  PKG_FLAGS:=nonshared
> 
>  PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ 
> $(GENERIC_PLATFORM_DIR)/base-files/
> diff --git a/package/base-files/files/lib/upgrade/common.sh 
> b/package/base-files/files/lib/upgrade/common.sh
> index e8a28f4138..c28bae48a1 100644
> --- a/package/base-files/files/lib/upgrade/common.sh
> +++ b/package/base-files/files/lib/upgrade/common.sh
> @@ -130,7 +130,7 @@ get_magic_gpt() {
>  }
> 
>  get_magic_vfat() {
> -	(get_image "$@" | dd bs=1 count=3 skip=54) 2>/dev/null
> +	(get_image "$@" | dd bs=3 count=1 skip=18) 2>/dev/null
>  }
> 
>  get_magic_fat32() {
> --
> 2.20.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel





More information about the openwrt-devel mailing list