From patchwork Thu Jun 24 19:05:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1496767 X-Patchwork-Delegate: mail@aparcar.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=rKrtDWgs; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CqdWv3tK; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G9qQz0zGRz9sPf for ; Fri, 25 Jun 2021 05:08:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GI7PmpwWsxZ81lK4zPxcv8nVlL9O2YV2vq7EHQSUhXU=; b=rKrtDWgsqA7COK UQ6EBzTvYbbTLckt0avPLms5RD2WQOmp3cgNkwBhf+4pxQr7GaNOjpG9K0rODOoomGxeqdxLfyeGk 3RFEM1FHQ5MZbuvv3s1L3RGrIwoP5ciH/B/pVsrRPKqpEffibum09c56/do4tGwy6yzH8OIzM2fpd wognFkZDSs/Tsn/StZ1NvSGQfECDQK+SP/1h2qpfQF/jSUWy/Ot+JAHTRXvmljDnxqlkRJWPJUGUh j+ghR4ijzBG5velN6mlJIOa2CoAUE4k/0sVBQhIgik0DhQa9322wR1IcAwks1ovYvKr/qnqTaVC6N 7nH/dsAKy4N76vXq4qDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUg0-00Fxt9-12; Thu, 24 Jun 2021 19:06:13 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUfN-00FxfZ-I7 for openwrt-devel@lists.openwrt.org; Thu, 24 Jun 2021 19:05:35 +0000 Received: by mail-ej1-x62a.google.com with SMTP id he7so11074304ejc.13 for ; Thu, 24 Jun 2021 12:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H7BLhU/VUF4zqWBJJExRtZbctknre8ZbjXblF7WXUN8=; b=CqdWv3tK58kUkTriccyzGVNYnlRCuVhi4q/EoeN1EpU/vlImz9DbJ06If8PquMO4fQ P3GmGzz/V4zinBdaHPM5FwRCA17hFbwHokrKYpU2vIAxSk086vrqjJDcUme1mGwRV58K obLtis+WMeRuY3d7Sfq99J5LYDMldPtqqaFSjt+dlSojRhXyVzjHCfk9LZso5JaL6XOO zQpp9q4P+XXHcchyycNTCRLgXlIKS5gmLDILxUQbMiYD/ljjuSAf/jueiS2ciJpgDq3g QY8I7sbc0fLgxBDLkgV9Gw7Q1kS3XQSEcFbnJTxo6viRyWaoJIrVTpGul5bHTuBd/JR+ BEJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H7BLhU/VUF4zqWBJJExRtZbctknre8ZbjXblF7WXUN8=; b=sSs67yGI4JsUgS9AhcE/qK/wVOTsDUigOatUdDSbENsBHiQDBUnLtb0dz/4Ji2i5HN 2cOtRqNt/YoGqpcbqycfmtMOw0y2GKlqhVE7SJzmXeV27GLC3yre48Ji6PAl1vAnGtMr ZgX9GlNT8ZNQ6bx4OlkF/2SbzCFBDiGo3FJLAkyWUiOo+FsiKb1EG7V95EhPZNJFOHOn 81OyifcUjRIDdXC+I7uVlsbf9ba/tkGanIDQ0QuYfzmVejBG6hBW5CIbE47/JHQkoFr+ 4B8R5GZ5V3Ie+ncr19ASgspWofUo/LH6xO4matcxhT1JxYXqbl9ftdGz2dGYDBnIq1hE LoSQ== X-Gm-Message-State: AOAM531fj6puKRxxqi1ExtAlI7f8BxQc/kP4CJQYULYumapL+8tMvp20 zN6Ul7zq2EYhZAESlUpDsCZ3EIOkow== X-Google-Smtp-Source: ABdhPJzinTRrTb0FXVH/QhQdIG9jEasStT9IWbKw1jqDMv2L+YQJ8YXS/R073Og6NKXKb9BA698w1A== X-Received: by 2002:a17:907:990f:: with SMTP id ka15mr6787796ejc.132.1624561531268; Thu, 24 Jun 2021 12:05:31 -0700 (PDT) Received: from mallard.lan (a95-93-125-60.cpe.netcabo.pt. [95.93.125.60]) by smtp.gmail.com with ESMTPSA id b19sm2398843edd.10.2021.06.24.12.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 12:05:31 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/3] zram-swap: robustify mkswap/swapon/swapoff invocation Date: Thu, 24 Jun 2021 20:05:21 +0100 Message-Id: <20210624190523.296296-2-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210624190523.296296-1-rsalvaterra@gmail.com> References: <20210624190523.296296-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_120533_657797_6EF62702 X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Instead of assuming /sbin contains the correct BusyBox symlinks, directly invoke the busybox executable. The required utilities are guaranteed to be present, since the zram-swap package selects them. [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:62a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Instead of assuming /sbin contains the correct BusyBox symlinks, directly invoke the busybox executable. The required utilities are guaranteed to be present, since the zram-swap package selects them. Additionally, don't assume busybox resides in /bin, rely on PATH to find it. While at it, update the copyright year, use SPDX and switch to AUTORELEASE. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/Makefile | 9 ++---- package/system/zram-swap/files/zram.init | 40 ++++++------------------ 2 files changed, 13 insertions(+), 36 deletions(-) diff --git a/package/system/zram-swap/Makefile b/package/system/zram-swap/Makefile index 80f87fcdff..d0d1baddd1 100644 --- a/package/system/zram-swap/Makefile +++ b/package/system/zram-swap/Makefile @@ -1,14 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2013-2021 OpenWrt.org include $(TOPDIR)/rules.mk PKG_NAME:=zram-swap -PKG_RELEASE:=8 +PKG_RELEASE:=$(AUTORELEASE) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index d97e85efa5..9fce5e4797 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -25,31 +25,6 @@ zram_getsize() # in megabytes fi } -zram_applicable() -{ - local zram_dev="$1" - - [ -e "$zram_dev" ] || { - logger -s -t zram_applicable -p daemon.crit "[ERROR] device '$zram_dev' not found" - return 1 - } - - [ -x /sbin/mkswap ] || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox mkswap' not installed" - return 1 - } - - [ -x /sbin/swapon ] || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapon' not installed" - return 1 - } - - [ -x /sbin/swapoff ] || { - logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapoff' not installed" - return 1 - } -} - zram_dev() { local idx="$1" @@ -160,9 +135,14 @@ start() return 1 fi - local zram_size="$( zram_getsize )" local zram_dev="$( zram_getdev )" - zram_applicable "$zram_dev" || return 1 + + [ -e "$zram_dev" ] || { + logger -s -t zram_start -p daemon.crit "[ERROR] device '$zram_dev' not found" + return 1 + } + + local zram_size="$( zram_getsize )" local zram_priority="$( uci -q get system.@system[0].zram_priority )" zram_priority=${zram_priority:+-p $zram_priority} @@ -171,8 +151,8 @@ start() zram_reset "$zram_dev" "enforcing defaults" zram_comp_algo "$zram_dev" echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize" - /sbin/mkswap "$zram_dev" - /sbin/swapon -d $zram_priority "$zram_dev" + busybox mkswap "$zram_dev" + busybox swapon -d $zram_priority "$zram_dev" } stop() @@ -181,7 +161,7 @@ stop() for zram_dev in $( grep zram /proc/swaps |awk '{print $1}' ); do { logger -s -t zram_stop -p daemon.debug "deactivate swap $zram_dev" - /sbin/swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back" + busybox swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back" local dev_index="$( echo $zram_dev | grep -o "[0-9]*$" )" if [ $dev_index -ne 0 ]; then logger -s -t zram_stop -p daemon.debug "removing zram $zram_dev" From patchwork Thu Jun 24 19:05:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1496765 X-Patchwork-Delegate: mail@aparcar.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=u/wu1exG; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XLcV8qGs; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G9qQH6hglz9sPf for ; Fri, 25 Jun 2021 05:07:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YAj2MrSA1WLC8OwVlccFMAYCjOqFlEIlYDd8y+X+tvE=; b=u/wu1exG/ZXoTf FNE81VFpUwd+yrSx6PI2GdtSvtyc0MopFYKwvsbTn30aS/hko2er2/rX2SakBf0NBIzDNQ63v5z0B rTf2TOdkff1pV+XY4rLjVk8FnlYfazN+AviDUvksbaaeOLu+++kUixfykYltCWi6xZzyWaAVnh6N8 1vQmhPWF8wtNmGbRLY63XdDsp3NRJLkFHey2NCqnRi6pNzWQMHM92KYCInyHdVtRmPgUchmgirlL4 bZt931MAKsTF98ZZwWJPubmP7za6f/kOhkvxuZ6AE2csZxVRYPrpVcbiXn992WK8PTDwa2Vda6PlG /njt689PdSvESih0jJCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUfe-00Fxl8-HN; Thu, 24 Jun 2021 19:05:50 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUfN-00Fxfg-0K for openwrt-devel@lists.openwrt.org; Thu, 24 Jun 2021 19:05:34 +0000 Received: by mail-ej1-x62e.google.com with SMTP id he7so11074339ejc.13 for ; Thu, 24 Jun 2021 12:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2TmeIwMmlBUPfvLjtGMwtydyu+Du0ixfQXxrFftSDXQ=; b=XLcV8qGsngc5/ER4nRNLck32zqtOfREBilyTXZ7xGgOYWeP6M83sBOkNxqgReslRaY cUlqO+6ZvvZ8pOTvssB7MBeMDOjdr7cGdY5svGoowdrwnw4QGkeaI4ATsmn5HoWzUS7O ldSIs89g0v116aWBs8MOzSmeS6VmVMxnxltfzjhU4MENVY69yWq1E+YPiptTeYXlmw3g 7XopbP3N3AilLKtJ3jQFsIR4sD6droaEnG21evp8sLTUOEhIa3Dbo2tqkVNKIbJZgMA2 AN42ulg3NoHWyXXcxE4bkDeRUTg6/4atKSgHzGBhj1099giayO2diTrTP1RFx/pXGRxz vWFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2TmeIwMmlBUPfvLjtGMwtydyu+Du0ixfQXxrFftSDXQ=; b=mlSg26nc9pnYzfYzFJKHpcuu6pTuxfsd3wuKAsM9yM2RnHx7JzyYRzH+m4grWehvHj FPpIUVaBUoK6vxX+1oSn1AAb3/4/fW2Y1IDy8lPXRnaBDSWt7eS1ZBZ41qd5pqhFTE8O 4rGPlTMu7bbH50mAUxs7aM2ey6NVOncpgbiNl0mJeEbLRiyIcJy9XbB2P+S5nqcGdrYg iLc3OaC7cRnCDKOa1o2VjGxkdS7nUkj79hBP6Sd3FqguqmSA1cNjh0A0sYxKahFwgINU io5WRmwHxJnGm8FqXu9cPaqh8PDT9W7jJds2D1xDOmh5MMjFLPoTz1Fziqqe0ZFkxbqW qYMg== X-Gm-Message-State: AOAM533lbI7CQPu1loKRNIC9VMEzKqh9sa+XDumW72zXhKIiwooxBUHU LxXErVtAMj0lMWlcwmHCOI6JifpUsw== X-Google-Smtp-Source: ABdhPJxnznF8cHwV8dEfW5A7VhyvzLB/l1g0HKe87m2+dp1LMvsGqSgMtuF68gq7GB6vVCbbPYBxtQ== X-Received: by 2002:a17:907:3f23:: with SMTP id hq35mr6897999ejc.477.1624561531874; Thu, 24 Jun 2021 12:05:31 -0700 (PDT) Received: from mallard.lan (a95-93-125-60.cpe.netcabo.pt. [95.93.125.60]) by smtp.gmail.com with ESMTPSA id b19sm2398843edd.10.2021.06.24.12.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 12:05:31 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/3] zram-swap: set the zram swap priority to 100 by default Date: Thu, 24 Jun 2021 20:05:22 +0100 Message-Id: <20210624190523.296296-3-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210624190523.296296-1-rsalvaterra@gmail.com> References: <20210624190523.296296-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_120533_088769_CB466D6A X-CRM114-Status: UNSURE ( 8.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: New swap devices are added in decreasing priority order, starting at -1. Make sure the zram swap device has the highest priority, by default. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:62e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org New swap devices are added in decreasing priority order, starting at -1. Make sure the zram swap device has the highest priority, by default. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index 9fce5e4797..ea9b55680e 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -144,7 +144,10 @@ start() local zram_size="$( zram_getsize )" local zram_priority="$( uci -q get system.@system[0].zram_priority )" - zram_priority=${zram_priority:+-p $zram_priority} + + if [ -z "$zram_priority" ]; then + zram_priority="100" + fi logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MegaBytes)" @@ -152,7 +155,7 @@ start() zram_comp_algo "$zram_dev" echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize" busybox mkswap "$zram_dev" - busybox swapon -d $zram_priority "$zram_dev" + busybox swapon -d -p $zram_priority "$zram_dev" } stop() From patchwork Thu Jun 24 19:05:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1496768 X-Patchwork-Delegate: mail@aparcar.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=a5xuli6c; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lq0veWe5; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G9qRF2LYbz9sPf for ; Fri, 25 Jun 2021 05:08:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qhKLFpoIpDKqkYJnMSqk/RG1yjaQ6LIv4k+c09sTER8=; b=a5xuli6cFbvFbk UKD8N+BcVkxgfzR6yNQ7MZFpq8yDWItHncZHOkTdoBh3SOn9GVa8NltF5TZE7e5Xpg6n7Q5I2vjym 5LPQ2vj1Eku5MTuCD3sIWJOzyJrkDyCW7uQLd+Ka1GHmxZIzqV3xFK+JKkM235QUAfHVq7Ok2/Ylk KZDsNKqdz1ml535nH/DTiiRNJGQGfH2rf7VZYklIcXcHrHeSJxk/nzlBgZkL2Yg2i8x1qw9s7YM1W fRAVTTWzgCidjc9gYuI7BcZGvW5J0N1OUPTJ42jISqRN+XlFtxSn2JcNPxmqcvjaQz1X26NFB/sUR tyCMuFE9LfmUyfvljSGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUgP-00Fy1J-A1; Thu, 24 Jun 2021 19:06:37 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwUfN-00Fxfq-TJ for openwrt-devel@lists.openwrt.org; Thu, 24 Jun 2021 19:05:35 +0000 Received: by mail-ej1-x630.google.com with SMTP id nb6so11115663ejc.10 for ; Thu, 24 Jun 2021 12:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qzezjjlUtQ9TfAu7Xjv1SrnJ6ArIhZlWhMakeoDwAW0=; b=lq0veWe5gv7uaMkEiAXTXmxAIfx8iNcrdFw5+V8jkTHGGbH3spzxMpdLBNj/ON2hqC vR9aNJ/YGJ/AXFNf/xqC4jGCxRzVvW+3vUWyVaL9jg3TbKXCgn0pwU+3YzjXan0/60Wb cbAwRwUT1EwBFurWLOmDgEiUKiDoX5UHcok8Uohl1lVJGXQwyiWRuE7Q5kRRya5/yrhS bDTk8VqTBTdhWYfW+J7ZUgvU/bYRVDdspPe+bhqbFIio2T/sODPdZ7jN5BaON3N4Nnxu lvqhYNp0AhoLHQjxfksS8eJRepVsFVkSHYhBmmWJV12qJShsUakYZ2idnRrOu4cTRdiv DJ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qzezjjlUtQ9TfAu7Xjv1SrnJ6ArIhZlWhMakeoDwAW0=; b=Hx+o4+WHHcACTaCI2LvnBwWCRm3595SEuPqZZ1q40KvTep3L0Mlp2r++UsXIIgGuYS MZT9p5sC+901+q7d/mEVC1vc13k+9jdN9+cZzI/zvhjFHqH/yvykdbHjJF67BESswVtQ Oime7uqq62Wu8j2QcpXnfCUMN8eqkzyrM4CcKBR2+vtSnHh1sIqjY7MFE/kKqHXT2rck hXfLfehO2/RwrM8ARjPj2wTMX1iLFGVMmi+5WGVondWthYNZgnG0ZgTR+PCWVZz38oFO Tdj1A6M446PLAHjOVdpI2E/JRr82Jcw7ngtiw/3R3okC2Exoaic3O4cqiNVXawvIQMjf ChFg== X-Gm-Message-State: AOAM532yZazSe1hekkqOZ0ZGlDacAK5WoG/oQ8qSWscpaVinPTxg5Fjz rzscMeb/4AHZTc5f5diwxBmo9b41uA== X-Google-Smtp-Source: ABdhPJxmMsz+mWeiXKkxCpNIiGb4141F1ljQWMtdis5Q58TGWqYxy0rHoI1D/6bPyRu1bppjv5pV1A== X-Received: by 2002:a17:906:2608:: with SMTP id h8mr6607783ejc.380.1624561532502; Thu, 24 Jun 2021 12:05:32 -0700 (PDT) Received: from mallard.lan (a95-93-125-60.cpe.netcabo.pt. [95.93.125.60]) by smtp.gmail.com with ESMTPSA id b19sm2398843edd.10.2021.06.24.12.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 12:05:32 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH 3/3] zram-swap: clean up the log messages Date: Thu, 24 Jun 2021 20:05:23 +0100 Message-Id: <20210624190523.296296-4-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210624190523.296296-1-rsalvaterra@gmail.com> References: <20210624190523.296296-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_120534_024100_E748B7DD X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Remove redundant tags and name things more consistently. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:630 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Remove redundant tags and name things more consistently. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index ea9b55680e..e894025b38 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -2,8 +2,8 @@ START=15 -extra_command "compact" "Trigger compaction for all Z-RAM swap dev's" -extra_command "status" "Print out information & statistics about Z-RAM swap devices" +extra_command "compact" "Trigger compaction for all zram swap devices" +extra_command "status" "Print out information & statistics about zram swap devices" ram_getsize() { @@ -60,15 +60,15 @@ zram_comp_algo() local zram_comp_algo="$( uci -q get system.@system[0].zram_comp_algo )" if [ -z "$zram_comp_algo" ]; then - # lzo-rle fails on small RAM devices, default to lzo, which is always available + # default to lzo, which is always available zram_comp_algo="lzo" fi if [ $(grep -c "$zram_comp_algo" /sys/block/$( basename $dev )/comp_algorithm) -ne 0 ]; then - logger -s -t zram_comp_algo -p daemon.debug "Set compression algorithm '$zram_comp_algo' for zram '$dev'" + logger -s -t zram_comp_algo -p daemon.debug "set compression algorithm '$zram_comp_algo' for zram '$dev'" echo $zram_comp_algo > "/sys/block/$( basename $dev )/comp_algorithm" else - logger -s -t zram_comp_algo -p daemon.debug "Compression algorithm '$zram_comp_algo' is not supported for '$dev'" + logger -s -t zram_comp_algo -p daemon.debug "compression algorithm '$zram_comp_algo' is not supported for '$dev'" fi } @@ -79,7 +79,7 @@ zram_stats() printf "\nGathering stats info for zram device \"$( basename "$1" )\"\n\n" - printf "Z-RAM\n-----\n" + printf "ZRAM\n-----\n" printf "%-25s - %s\n" "Block device" $zdev awk '{ printf "%-25s - %d MiB\n", "Device size", $1/1024/1024 }' <$zdev/disksize printf "%-25s - %s\n" "Compression algo" "$(cat $zdev/comp_algorithm)" @@ -131,7 +131,7 @@ start() } if [ $( grep -cs zram /proc/swaps ) -ne 0 ]; then - logger -s -t zram_start -p daemon.notice "[OK] zram swap is already mounted" + logger -s -t zram_start -p daemon.notice "zram swap is already mounted" return 1 fi @@ -149,7 +149,7 @@ start() zram_priority="100" fi - logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MegaBytes)" + logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MiB)" zram_reset "$zram_dev" "enforcing defaults" zram_comp_algo "$zram_dev"