From patchwork Thu Mar 15 05:58:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 886561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 402QlB2Lm4z9sVP for ; Fri, 16 Mar 2018 11:07:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 402QlB0qqRzF1X6 for ; Fri, 16 Mar 2018 11:07:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=au1.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=cyril.bur@au1.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=au1.ibm.com 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 402QgN31NzzF1T4 for ; Fri, 16 Mar 2018 11:04:32 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2FNxbm7099989 for ; Thu, 15 Mar 2018 20:04:28 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gr2qarkwq-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 15 Mar 2018 20:04:28 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Mar 2018 00:04:25 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Mar 2018 00:04:23 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2G04NRZ52297888 for ; Fri, 16 Mar 2018 00:04:23 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B29DEAE055 for ; Thu, 15 Mar 2018 23:54:48 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22E53AE056 for ; Thu, 15 Mar 2018 23:54:48 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 15 Mar 2018 23:54:48 +0000 (GMT) Received: from camb691.ozlabs.ibm.com (unknown [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 E1E1CA03B0 for ; Thu, 15 Mar 2018 16:58:41 +1100 (AEDT) From: Cyril Bur To: skiboot@lists.ozlabs.org Date: Thu, 15 Mar 2018 16:58:12 +1100 X-Mailer: git-send-email 2.16.2 X-TM-AS-GCONF: 00 x-cbid: 18031600-0040-0000-0000-00000421A494 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031600-0041-0000-0000-00002624AFA8 Message-Id: <20180315055827.8999-1-cyril.bur@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-15_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=40 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803150258 Subject: [Skiboot] [PATCH 00/15] libffs and ffspart rework X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 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" Hi, Currently the libffs api to generate TOCs is a bit experimental/developmental and it needs work. The original version abstracted too much which meant needless complexity within the library. I've ripped quite a lot of the complexity out of the libffs in favour of some added (but overall less) complexity in ffspart. Unfortunately this does change libffs just a tad, hopefully none of the functions have been used by anyone outside of skiboot, and the input file to ffspart had to change a bit too, but I haven't heard of anyone actually using it. This is version two of that attempt. Fundamentally they're the same but differences have accumulated so lets pretend this is a brand new unrelated attempt. I've been using it to generate pnor files within op-build. If you want to see that: https://github.com/cyrilbur-ibm/op-build/tree/ffspart it is happening here. I'd like to get everything upstream, so we'll start with ffspart Feedback very much welcome, Thanks Cyril Bur (15): external/ffspart: Allow # comments in input file libffs: Standardise ffs partition flags external/pflash: Use ffs_entry_user_to_string() to standardise flag strings libflash/libffs: Add setter for a partitions actual size libflash/libffs: ffs_close() should use ffs_hdr_free() external/ffspart: Remove side, order and backup options libflash/libffs: Always add entries to the end of the TOC libflash/libffs: Remove the 'sides' from the FFS TOC generation code libflash/libffs: Remove backup partition from TOC generation code libflash/libffs: Switch to storing header entries in an array libflash/libffs: Refcount ffs entries libflash/libffs: Allow caller to specifiy header partition external/ffspart: Use new interface libffs: Fix bad checks for partition overlap external/ffspart: Improve error output external/ffspart/ffspart.c | 612 +++++++++++---------- external/ffspart/test/files/03-tiny-pnor.in | 8 +- .../ffspart/test/files/03.1-tiny-pnor-backup.in | 4 - .../ffspart/test/files/03.1-tiny-pnor-backup.out | Bin 3840 -> 0 bytes external/ffspart/test/files/04-tiny-pnor2.in | 8 +- external/ffspart/test/files/05-hdr-overlap.in | 8 +- .../ffspart/test/files/05.1-hdr-overlap-backup.in | 3 - external/ffspart/test/files/06-small-flash.in | 10 +- external/ffspart/test/files/07-big-files.in | 8 +- external/ffspart/test/files/08-small-files.in | 8 +- external/ffspart/test/files/10-bad-input.in | 8 +- external/ffspart/test/files/11-long-name.in | 8 +- external/ffspart/test/files/12-bad-numbers-base.in | 8 +- external/ffspart/test/files/13-bad-numbers-size.in | 8 +- external/ffspart/test/files/14-bad-input-flags.in | 8 +- .../test/files/15-overlapping-partitions.in | 8 +- external/ffspart/test/results/00-usage.out | 5 - external/ffspart/test/results/01-param-sanity.err | 1 - external/ffspart/test/results/01-param-sanity.out | 5 - .../ffspart/test/results/01.1-param-sanity.err | 0 .../{02-param-sides.out => 01.1-param-sanity.out} | 5 - external/ffspart/test/results/02-param-sides.err | 1 - external/ffspart/test/results/05-hdr-overlap.err | 5 +- external/ffspart/test/results/05-hdr-overlap.out | 4 - .../test/results/05.1-hdr-overlap-backup.err | 2 - .../test/results/05.1-hdr-overlap-backup.out | 4 - external/ffspart/test/results/06-small-flash.err | 5 +- external/ffspart/test/results/06-small-flash.out | 3 - external/ffspart/test/results/07-big-files.err | 5 +- external/ffspart/test/results/07-big-files.out | 2 - external/ffspart/test/results/08-small-files.err | 2 + external/ffspart/test/results/08-small-files.out | 5 - external/ffspart/test/results/10-bad-input.err | 5 +- external/ffspart/test/results/10-bad-input.out | 1 - external/ffspart/test/results/11-long-name.err | 6 +- external/ffspart/test/results/11-long-name.out | 5 - .../ffspart/test/results/12-bad-numbers-base.err | 5 +- .../ffspart/test/results/12-bad-numbers-base.out | 1 - .../ffspart/test/results/13-bad-numbers-size.err | 5 +- .../ffspart/test/results/13-bad-numbers-size.out | 1 - .../ffspart/test/results/14-bad-input-flags.err | 5 +- .../ffspart/test/results/14-bad-input-flags.out | 1 - .../test/results/15-overlapping-partitions.err | 5 +- .../test/results/15-overlapping-partitions.out | 3 - external/ffspart/test/tests/01-param-sanity | 2 +- .../tests/{02-param-sides => 01.1-param-sanity} | 2 +- external/ffspart/test/tests/03.1-tiny-pnor-backup | 15 - external/ffspart/test/tests/05-hdr-overlap | 7 +- .../ffspart/test/tests/05.1-hdr-overlap-backup | 15 - external/ffspart/test/tests/06-small-flash | 5 +- external/ffspart/test/tests/07-big-files | 4 + external/ffspart/test/tests/10-bad-input | 2 + external/ffspart/test/tests/12-bad-numbers-base | 2 + external/ffspart/test/tests/13-bad-numbers-size | 2 + external/ffspart/test/tests/14-bad-input-flags | 2 + .../ffspart/test/tests/15-overlapping-partitions | 4 +- external/pflash/pflash.c | 18 +- external/pflash/test/files/01-info.ffs | 12 +- external/pflash/test/files/02-erase.ffs | 8 +- external/pflash/test/files/03-erase-parts.ffs | 8 +- external/pflash/test/files/04-program-rand.ffs | 8 +- external/pflash/test/files/05-bad-numbers.ffs | 8 +- external/pflash/test/files/06-miscprint.ffs | 12 +- external/pflash/test/results/01-info.out | 14 +- external/pflash/test/results/06-miscprint.out | 2 +- libflash/ffs.h | 16 +- libflash/libffs.c | 491 +++++++++-------- libflash/libffs.h | 18 +- 68 files changed, 768 insertions(+), 723 deletions(-) delete mode 100644 external/ffspart/test/files/03.1-tiny-pnor-backup.in delete mode 100644 external/ffspart/test/files/03.1-tiny-pnor-backup.out delete mode 100644 external/ffspart/test/files/05.1-hdr-overlap-backup.in create mode 100644 external/ffspart/test/results/01.1-param-sanity.err rename external/ffspart/test/results/{02-param-sides.out => 01.1-param-sanity.out} (67%) delete mode 100644 external/ffspart/test/results/02-param-sides.err delete mode 100644 external/ffspart/test/results/05.1-hdr-overlap-backup.err delete mode 100644 external/ffspart/test/results/05.1-hdr-overlap-backup.out rename external/ffspart/test/tests/{02-param-sides => 01.1-param-sanity} (63%) delete mode 100644 external/ffspart/test/tests/03.1-tiny-pnor-backup delete mode 100644 external/ffspart/test/tests/05.1-hdr-overlap-backup