| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Ensures writes can resize the backing files up to the limit of the
partition size.
Change-Id: Ie399d556dd485a235b7f6731d35536b2a6c703be
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
| |
The patch file in question is smaller than the partition defined for it.
This configuration exposes a bug where mboxd responds to a
CREATE_READ_WINDOW for the blocks after the length of the patch file
with a 0-sized window. Outside of the test environment this behaviour
causes the host to enter an unterminated loop in firmware.
Change-Id: I13aafb58a7876dc1589f695a9f5c80d082b4e15f
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: If557811530f9a886355d023ea73c3412ba5797f8
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I5a4d6bb7b019767c19d45e68d4ac01c92c024abe
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I25726e9fe97b37d9be0bab10a84f20d0bab9f5c9
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Ic15daa8198df660d7c2e7c26921ce43e671d5c38
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The RORequest and RWRequest classes did not provide a clear abstraction
over the operation of populating a window or partition associated with a
CREATE_{READ,WRITE}_WINDOW request. The role of the classes was to find
the partition for the provided offset, locate and then open its backing
file.
However, the file-descriptor for the backing file was exposed outside of
the class, as was the FFS partition struct, both of which were managed
_internal_ to the class. Thus the classes provided no encapsulation of
state and awkwardly split the tasks of managing and utilising the
resources between the callee and caller.
This commit inverts the behaviour in a fulfil() method handles the
mechanics of locating, opening, manipulating and closing the backing
file, requiring nothing of the caller. The pnor_partition reference is
managed entirely inside the Request class, derived from the offset
passed to the constructor.
Unifying the mechanics into fulfil() results in a decent reduction in
lines of code at the expense of some cyclomatic complexity. fulfil() is
publicly exposed via read() and write() wrappers on the class, and the
RORequest and RWRequest classes are removed as a result.
Change-Id: Ie587ed31f1a6db97bcb490dbcc2e27ece0b1f82c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Ide8012846732649780a8989c8040bece8ffdf272
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
The CREATE_READ_WINDOW request asks for an offset below the one defined
partition, between it and the ToC.
Change-Id: Iafaa530a3d6b02626106508b81c7aa7eaef9c876
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow reads and writes of offsets that don't map onto partitions defined
in the ToC. Do so by ignoring the mapping failure and filling a window
with 0xff in the hole from the requested offset to the following
partition.
This change also removes the reliance on InternalFailure as the
exception of choice for communicating failures. We can do better without
the teeth-pulling required by phosphor-logging by translating custom
exceptions into phosphor-logging exceptions at the edges.
Change-Id: Ibfa961a66b0b979354c6dc226ccbe7e9fbafc16d
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
| |
Create a local variable for the partition of interest.
Change-Id: I7c0ec008f8b616cec15f10664afca73736324029
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
| |
Allow use of the definition in other parts of the codebase.
Change-Id: I5f4f23c909a09f12fd16728183aadbf36b565dba
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I0523a451c03c05f2851f06f99326c792149849b6
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Icde607847812bcba3c7e2a131d7f46e223d44440
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
As the handling of the ToC is separate to the mapping of other
partitions, ensure we have appropriate coverage of copy_flash.
Change-Id: If362c667df65b2648849cab2e0c11ebe0416d254
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
Attempts to access an offset beyond the end of what's defined in the
partition table.
Change-Id: I43c55423625261947965155cb1d53ef276a4ed05
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I6fb96c921bead334ff178d0d78e9c7e7c7234f0a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I3dbb4a14c5052c1689f930744a59b465b482fb68
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I5243ee9d093445437cc6d75400d1d51ff5885719
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I25c6a6c4cee69ce9ba28c238851c7b7c622bb9b3
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Iafddb01ad174b27e3f12272e107cc0323d824c81
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a collection of small fixes:
* Always initialise the field for PARTITION_ECC_PROTECTED so it doesn't
contain garbage
* Provide a warning when we encounter a flag we don't understand
* Ignore empty flags so we don't trigger the unknown flag warning
* Unset the READONLY bit if we encounter READWRITE, implementing
last-configuration-wins rather than sticky-readonly
Change-Id: I3dd45139716fe241f9d3e7997e1269d13de638ca
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
| |
Exercises the flags associated with FFS properties.
Change-Id: Id710784cbbf3115712f7ce55e1fd38c8889b2c1f
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I17e876fcb18b69d29bcc439e0f270760e015f246
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I0122a2239df3ec7c83e2bf778d4d8df5a348d495
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: If712eac2e0f7b2c46e8bd473a5dc1c5b62c534b4
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: If0861efb0f6bccf82a2df94204821f22198e17b0
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Iaac0e7783f1ceba0d009fcd4865861b0109639e4
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I30325d8dbee300fc93911a7e9e2650fc592a7055
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
| |
The CREATE_READ_WINDOW command supplied by the test case worked by
accident more than design with respect to the specified PNOR layout.
Make the partition size one block for sanity.
Change-Id: I2f3e55c8be309b3940447148289b0c5aced0b094
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
For separate tests of access to offsets that do and don't contain a
partition.
Change-Id: I2466821b81eb721eeffe7db02d177c6f78e06101
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I36f3946487d0b613fa0ada9bfa777e4d12444fac
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Idec2747e2233eea5631740ed702623b5e4409a1c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I10b82d84cd40d52b0a489dc834269eec1a0d5240
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I71641b2c67eebf0b2babd677a46dbc45e0848795
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
Define a new variable to capture the library requirements of the vpnor
tests.
Change-Id: I966f699a9a96ee943602476d1d1015347cfe9c0b
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I635a085283d86a1f672f736a26981901d38ea599
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I9d18bd108d1c0972a5fefa384152757a2483c103
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
| |
Instead use strncpy() and specify the size of the destination buf, then
null-terminate the result.
Change-Id: I02b50010d4ba11feed5a96f27b3ec2bb50b2eabf
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I5d49a090482d280317e75c7a7e2dc68d7fa265e2
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously it represented any one of the ro/rw/prsv/patch directories.
It's better if we can deal with all of them at once, so rework the
abstraction.
In the process, the patch exploits other features of
std::experimental::filesystem to increase readability of the code.
Change-Id: I06000709622dd66945cc88cb5333847c69215dc7
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: Ibb2ea631d3bb903a6607edac085d3025479e5ff7
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
| |
The VpnorRoot class prepares a temporary directory for use as a VPNOR
backing store. Implementing it as a class allows us to use RAII to get
it to clean up after itself.
Change-Id: Ia5a839e751f8dc2126a4c0b474e9a7b8593cfd57
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
| |
Move the createVpnorTree() helper function out from the
create_pnor_partition_table test case into its own header. This way
multiple tests can make use of its function.
Change-Id: Ieb4149e736c7ff87ecdbf7aa586b58baf936cd97
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The helper function makes use of parseTocLine() which we just spent a
bunch of effort on extracting from the Table class. This means the tests
and the daemon both share the same parsing code, and thus the same bugs.
By passing in an array of ToC line strings we can have enough
information to populate a directory tree of test zeroed out files in the
read-only directory and write the corresponding ToC file. This way when
the code under test is pointed at the read-only directory it can
correctly construct the environment dictated by the test code and begin
servicing access requests.
Change-Id: I229393be5f53913c9f61102bbb5f8f7f9177c39e
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was roughly achieved by the following shell script:
$ git ls-files |
grep '\.[ch]p*$' |
while read F; do EXT=${F##*.}; cat spdx.$EXT <(sed '/^\/\*$/,/^ \*\/$/d' $F) > ${F}.tmp; mv ${F}.tmp $F; done
With the following context:
$ cat spdx.c
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
$ cat spdx.h
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */
$ ls -l spdx.*
-rw-r--r-- 1 andrew andrew 71 Feb 27 12:02 spdx.c
lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.cpp -> spdx.c
-rw-r--r-- 1 andrew andrew 77 Feb 27 12:02 spdx.h
lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.hpp -> spdx.h
The `sed` invocation catches a lot of function documentation, so the
hunks were manually added to avoid removing information that we want to
keep.
Change-Id: I63e49ca2593aa0db0568c7a63bfdead388642e76
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was roughly achieved with:
$ git ls-files |
grep '.[ch]p*$' |
while read F; do head -n 1 $F | fgrep -v '/*' > /dev/null && echo $F; done |
while read L; do cat apache $L > ${L}.tmp; mv ${L}.tmp ${L}; done
Some fixups performed by hand to eliminate modifications to files that
were hit which should not have been.
Change-Id: I9fa5af4644687d8b595a6cf70d6f7575a767d11a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I5fe7f625ad642cef17fe53bd244dcde8fd99f3ad
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
| |
Change-Id: I46d5b165ed668ace67ae237b16d65a24586dd87d
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Table::size() now returns the exact table size in bytes,
Table::capacity() returns the block-aligned size in bytes (capacity in
terms of how much the table could grow before expanding to another
block), and Table::blocks() returns the size in blocks.
This helps out with code clarity around the codebase and enables the
introduction of ToC-related integration tests.
The one wrinkle is vpnor_get_partition_table_size(), which is modified
to call Table::blocks() but retains 'size' in its name. This is largely
unimportant as the function will go away shortly.
Change-Id: I3becf47f2201df5fe0bed86fcb92d7b94d06ab11
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
|