Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp809792lqt; Thu, 6 Jun 2024 21:39:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+a/X1CJH1zXinzp2p9ZNcukDXQymAmVDI6Y79CykqwHTWf3ukItlEY9ljU8ADZ+k2OJR0/GoRFIrFtrv2QF9gZAG/+0PhS64utppEGg== X-Google-Smtp-Source: AGHT+IFvSpLExokpM/g6r2P0zzB9201Os4ptCOS1aZuqrgJM6aI7M+L5i5aaPgtIvTRI5Y+ANxL4 X-Received: by 2002:a50:9f2c:0:b0:57a:2400:3a56 with SMTP id 4fb4d7f45d1cf-57c508fb076mr970868a12.23.1717735167297; Thu, 06 Jun 2024 21:39:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717735167; cv=pass; d=google.com; s=arc-20160816; b=fP1eO/Qg+Kz1SRW3ivD433SJVVPt8IulNJj53gkl7ZiBcFjpt1j/C6WNWUDsW2DikD Bys7q1Vl+3pzUpAO29qzYK4CG7RnMgcKTxr5e96H0KKszIvdOMr/+CHhkxnFSkMr5K81 p+Mf5MCbQGY7n2JiI6kxi9AbjCu1qUnI2ZaPWklmX3KYxF/SXJYIGKrQk6VCwoQJU9uR tyqDaPwq9TO1WK1u5lVauA3Sk2aQIPBgI8+POyxuGXFQN+RMAAdseT2038eIKO6WAEav 4V/uUbLX2RjjdlGTQPgFbAhAQDwz3/GsfRyPv3PN/bFbXBef99332N2Dkh9HdZmwaZih 1RyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2tm9AyXVu5zcWxLT0Bb7iayOe5Teguuw+cQsNQKRzNg=; fh=yXYChwFvQA/NaaLzCC0IJdkW11OhjXgO4DHXzVmnGFw=; b=R1QVx9MB0R4yLe6kCjuy6yJSDwSyTPt1PmtTSNgk9+bWrYj064k2nGrBchUam6KcWU 8/JFHxbh5LOfLPycyNGdEWKLYk4Q8qIXiuAaH4mgtopq4mIcs3x9vqi3zFcU0xYi8IOq MmmI/UO0IIZR/djxC0xH3W4C1+xISOiTpREmwmKfq8iYIjbiTyScndl10CrZtuIjSN44 VWy7Gt1i8g+R8XJ2RRjO8GSx0JgYn22xtavPpSSyn03gNiGQ3eL8uvIUKxjkEwe7frxJ t1Apuc5tvby72gSRPm3N9DFafwhDpflFE07EqgWvvmpwaZBaW4N1EMBrohEl7bviCs1p XSKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-205332-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae1fc3f2si1375372a12.299.2024.06.06.21.39.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 21:39:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205332-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-205332-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 076031F25CAE for ; Fri, 7 Jun 2024 04:39:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2387E15ADB4; Fri, 7 Jun 2024 04:27:32 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7DAA155728 for ; Fri, 7 Jun 2024 04:27:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717734449; cv=none; b=QRt3Efrr8qdfbdrpgUIE+FuMdRWpA1b4sSLLj9BbQIbZch5LRMBExDt9GS0rApoZywEb3Xcwity1VF5uIVsjd5Nv0nMrwXV6bhCm4ZmxXd3cXMEfETLdXWVKhpZdB0rHCMkSmMznk3dlChLnQd2ZEoWvEqClKj91x/ObPr00k44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717734449; c=relaxed/simple; bh=rxXvsXe4e6l7SgXcVxy20OPEtvYS7zT2R13h1D1xl5M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Tosb8IKCNSMALoayb5m+WCL1yV196BwmR0w1F7OHVAJNX/cMEqG5I9MZCi9beQMidDtl+xGLuuJY23un8ok59m9KFbusBWxFQYhLSsnHSKB77VWeE4rSzxdPH0u+WRVgMSIpYKHOCed0ago+9ieJ0BiUg93zlnMi1Jn4JQE3SCs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VwSjP3X7JzmXhG; Fri, 7 Jun 2024 12:22:49 +0800 (CST) Received: from kwepemm600013.china.huawei.com (unknown [7.193.23.68]) by mail.maildlp.com (Postfix) with ESMTPS id 4D786180085; Fri, 7 Jun 2024 12:27:25 +0800 (CST) Received: from huawei.com (10.175.104.67) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 12:27:05 +0800 From: Zhihao Cheng To: , , , , , CC: , Subject: [RFC PATCH mtd-utils 052/110] ubifs-utils: Adapt gc subsystem in libubifs Date: Fri, 7 Jun 2024 12:25:17 +0800 Message-ID: <20240607042615.2069840-53-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240607042615.2069840-1-chengzhihao1@huawei.com> References: <20240607042615.2069840-1-chengzhihao1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600013.china.huawei.com (7.193.23.68) Adapt gc subsystem(find.c, gc.c, scan.c) in libubifs, compared with linux kernel implementations: 1. Adapt print_hex_dump based on implementations in hexdump.c. Signed-off-by: Zhihao Cheng --- ubifs-utils/libubifs/find.c | 9 ++++++++- ubifs-utils/libubifs/gc.c | 10 +++++++--- ubifs-utils/libubifs/scan.c | 7 ++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ubifs-utils/libubifs/find.c b/ubifs-utils/libubifs/find.c index 873e6e1c..ecf689c4 100644 --- a/ubifs-utils/libubifs/find.c +++ b/ubifs-utils/libubifs/find.c @@ -14,8 +14,15 @@ * for fast access, falling back on scanning the LPT as a last resort. */ -#include +#include + +#include "linux_err.h" +#include "bitops.h" +#include "sort.h" #include "ubifs.h" +#include "defs.h" +#include "debug.h" +#include "misc.h" /** * struct scan_data - data provided to scan callback functions diff --git a/ubifs-utils/libubifs/gc.c b/ubifs-utils/libubifs/gc.c index 3134d070..c3595358 100644 --- a/ubifs-utils/libubifs/gc.c +++ b/ubifs-utils/libubifs/gc.c @@ -41,10 +41,14 @@ * good, and GC takes extra care when moving them. */ -#include -#include -#include +#include "linux_err.h" +#include "bitops.h" +#include "kmem.h" #include "ubifs.h" +#include "defs.h" +#include "debug.h" +#include "key.h" +#include "misc.h" /* * GC may need to move more than one LEB to make progress. The below constants diff --git a/ubifs-utils/libubifs/scan.c b/ubifs-utils/libubifs/scan.c index 84a9157d..74509fd0 100644 --- a/ubifs-utils/libubifs/scan.c +++ b/ubifs-utils/libubifs/scan.c @@ -15,7 +15,12 @@ * debugging functions. */ +#include "linux_err.h" +#include "kmem.h" #include "ubifs.h" +#include "defs.h" +#include "debug.h" +#include "key.h" /** * scan_padding_bytes - scan for padding bytes. @@ -232,7 +237,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, if (len > 8192) len = 8192; ubifs_err(c, "first %d bytes from LEB %d:%d", len, lnum, offs); - print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); + print_hex_dump("", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); } /** -- 2.13.6