[PATCH 0/2] Properly save and restore multiple pressure sensors

Dirk Hohndel dirk at hohndel.org
Tue Jul 25 22:08:45 PDT 2017


On Tue, Jul 25, 2017 at 07:24:36PM -0700, Linus Torvalds wrote:
> 
> By "multiple" I obviously currently mean just two sensors for each sample, 
> since that's our current limitation. But I have test-data that then 
> alternates multiple sensors over those two slots, and the code is also 
> written so that if people really end up wanting more than two concurrent 
> pressure sensors, at least the saving and restoring should happily handle 
> it.

So this doesn't break any of the existing tests, but I think it would be
worth while to have some tests that exercise this code. I know that you
aren't a C++ fan, but it would be nice to add a few tests for that, and
you might indeed be the best person to do so as you know exactly what the
corner cases here might be.

> Note that while saving and restoring can handle multiple sensors per 
> sample, other parts of the code are still limited to just two (and some 
> code only iterates over one single sensor). But with this code, I can at 
> least save and load test-files with sensor data from multiple sensors, 
> which will help me a lot. And from my (admittedly fairly limited) testing, 
> we still save old-style data with no changes.
> 
> The first patch should introduce no changes at all, just moving one helper 
> file and introducing another one. That prepares for a simpler and more 
> legible second patch, which then actually looks at the dive sample data to 
> see if it should be saved in the old legacy format or the new "pressure 
> and cylinder index together" format.
> 
> For the git save format, we simply add a ":sensor" to the pressure reading 
> to indicate which cylinder the pressure reading is from.
> 
> For the XML save format, we use "pressureN='xyz bar'" for cylinder N, 
> since XML doesn't like having multiple nodes with the same name (so you 
> can't just repeat "pressure=xyz" in XML and use the same trick we used for 
> the git save format).

That's not TOO ugly...

Thanks for working on this!

/D


More information about the subsurface mailing list