From patchwork Tue Aug 29 06:24:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 806970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xhJwT6Rhmz9t38 for ; Tue, 29 Aug 2017 16:42:33 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xhJwT5MJmzDqm8 for ; Tue, 29 Aug 2017 16:42:33 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xhJY56p5hzDqZq for ; Tue, 29 Aug 2017 16:25:45 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7T6OBoq119049 for ; Tue, 29 Aug 2017 02:25:41 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cn1kje0me-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 29 Aug 2017 02:25:41 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Aug 2017 16:25:39 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 29 Aug 2017 16:25:36 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7T6PZIH38404256 for ; Tue, 29 Aug 2017 16:25:35 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v7T6PZTh022628 for ; Tue, 29 Aug 2017 16:25:35 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7T6PZes022623; Tue, 29 Aug 2017 16:25:35 +1000 Received: from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 29655A0259; Tue, 29 Aug 2017 16:25:35 +1000 (AEST) From: Cyril Bur To: skiboot@lists.ozlabs.org, stewart@linux.vnet.ibm.com Date: Tue, 29 Aug 2017 16:24:56 +1000 X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170829062506.8317-1-cyril.bur@au1.ibm.com> References: <20170829062506.8317-1-cyril.bur@au1.ibm.com> X-TM-AS-MML: disable x-cbid: 17082906-0016-0000-0000-000002619C45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17082906-0017-0000-0000-000006E4665A Message-Id: <20170829062506.8317-4-cyril.bur@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-29_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1708290096 Subject: [Skiboot] [RFC PATCH 03/13] external/pflash: Use ffs_entry_user_to_string() to standardise flag strings X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Cyril Bur --- external/pflash/pflash.c | 14 +++++--------- external/pflash/test/results/01-info.out | 10 +++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index a08ea946..3be43ac0 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -101,8 +101,8 @@ static uint32_t print_ffs_info(struct ffs_handle *ffsh, uint32_t toc) for (i = 0;; i++) { uint32_t start, size, act, end; + struct ffs_entry_user user; char *name = NULL, *flags; - int l; rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, NULL); if (rc == FFS_ERR_PART_NOT_FOUND) @@ -115,17 +115,13 @@ static uint32_t print_ffs_info(struct ffs_handle *ffsh, uint32_t toc) goto out; } - l = asprintf(&flags, "[%c%c%c%c%c]", - has_ecc(ent) ? 'E' : '-', - has_flag(ent, FFS_MISCFLAGS_PRESERVED) ? 'P' : '-', - has_flag(ent, FFS_MISCFLAGS_READONLY) ? 'R' : '-', - has_flag(ent, FFS_MISCFLAGS_BACKUP) ? 'B' : '-', - has_flag(ent, FFS_MISCFLAGS_REPROVISION) ? 'F' : '-'); - if (l < 0) + user = ffs_entry_user_get(ent); + flags = ffs_entry_user_to_string(&user); + if (!flags) goto out; end = start + size; - printf("ID=%02d %15s 0x%08x..0x%08x (actual=0x%08x) %s\n", + printf("ID=%02d %15s 0x%08x..0x%08x (actual=0x%08x) [%s]\n", i, name, start, end, act, flags); if (strcmp(name, "OTHER_SIDE") == 0) diff --git a/external/pflash/test/results/01-info.out b/external/pflash/test/results/01-info.out index 43baf316..840890f4 100644 --- a/external/pflash/test/results/01-info.out +++ b/external/pflash/test/results/01-info.out @@ -6,8 +6,8 @@ Erase granule = 0KB B:BACKUP, F:REPROVISION TOC@0x00000000 Partitions: ----------- -ID=00 part 0x00000000..0x00000300 (actual=0x00000300) [-----] -ID=01 ONE 0x00000300..0x00000400 (actual=0x00000100) [E----] -ID=02 TWO 0x00000400..0x00000500 (actual=0x00000100) [E---F] -ID=03 THREE 0x00000500..0x00000600 (actual=0x00000100) [E---F] -ID=04 FOUR 0x00000600..0x00000700 (actual=0x00000100) [E---F] +ID=00 part 0x00000000..0x00000300 (actual=0x00000300) [-------] +ID=01 ONE 0x00000300..0x00000400 (actual=0x00000100) [EV-----] +ID=02 TWO 0x00000400..0x00000500 (actual=0x00000100) [E-----F] +ID=03 THREE 0x00000500..0x00000600 (actual=0x00000100) [E-----F] +ID=04 FOUR 0x00000600..0x00000700 (actual=0x00000100) [E-----F]