]> git.baikalelectronics.ru Git - kernel.git/commit
nfit_test: improve structure offset handling
authorRoss Zwisler <ross.zwisler@linux.intel.com>
Tue, 27 Feb 2018 17:29:50 +0000 (10:29 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 6 Mar 2018 19:05:08 +0000 (11:05 -0800)
commit62f28984a11c91e5da413db779ff3e34d61b83ba
tree7d7d2ce59554fa3c46542ec2f274cd7190e7e5be
parent26b9a2a17cbb4594718366aeb2ddb20eb9b03505
nfit_test: improve structure offset handling

In nfit_test0_setup() and nfit_test1_setup() we keep an 'offset' value
which we use to calculate where in our 'nfit_buf' we will place our next
structure.  The handling of 'offset' and the calculation of the placement
of the next structure is a bit inconsistent, though.  We don't update
'offset' after we insert each structure, sometimes causing us to update it
for multiple structures' sizes at once.  When calculating the position of
the next structure we aren't always able to just use 'offset', but
sometimes have to add in other structure sizes as well.

Fix this by updating 'offset' after each structure insertion in a
consistent way, allowing us to always calculate the position of the next
structure to be inserted by just using 'nfit_buf + offset'.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
tools/testing/nvdimm/test/nfit.c