summaryrefslogtreecommitdiffstats
path: root/src/barebox-state/backend_storage.c
Commit message (Collapse)AuthorAgeFilesLines
* state: Allow to load without authentificationSascha Hauer2017-03-311-2/+4
| | | | | | | Sometimes it's useful to be able to load a state even when it can't be authentificated. Add an option for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_storage: rename more variablesSascha Hauer2017-03-311-6/+6
| | | | | | Use "buckets" rather than "copies" in variable names. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_storage: make locally used variable staticSascha Hauer2017-03-311-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_storage: rewrite function docSascha Hauer2017-03-311-2/+2
| | | | | | | The function documentation for state_storage_file_buckets_init() is not very accurate. Rewrite it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_storage: Rename variable desired_copies to desired_bucketsSascha Hauer2017-03-311-9/+9
| | | | | | | | | We defined what a bucket is, so rename the variable that holds the number of desired buckets from desired_copies to desired_buckets. While at it, make locally used variable static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_storage: Rename variable nr_copies to n_bucketsSascha Hauer2017-03-311-12/+12
| | | | | | | We defined what a bucket is, so use n_buckets when counting buckets, and not nr_copies. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_circular: rewrite function docSascha Hauer2017-03-311-5/+3
| | | | | | | The commment talks about copies where buckets are meant and also claims we start at offset 0, which may not be true. Rewrite comment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_circular: default to circular storageSascha Hauer2017-03-311-6/+8
| | | | | | | | Default to the new circular storage format which saves erase cycles. The old format can still be selected with backend-storage-type = "noncircular". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend: Add some documentationSascha Hauer2017-03-311-0/+22
| | | | | | Write some sentences to make the concepts clearer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend_circular: remove unnecessary warningSascha Hauer2017-03-311-4/+1
| | | | | | | It's expected that NAND flashes contain bad blocks, do not warn about them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend: Add more fields to struct state_backend_storageSascha Hauer2017-03-311-28/+20
| | | | | | To save a few function arguments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: bucket: Make output more informativeSascha Hauer2017-03-311-10/+15
| | | | | | | | | | | Print offset and number of the bucket along with the bucket specific messages to give a hint which bucket a message is for. Also it's pretty much expected that buckets sometimes have no data or need cleanup, so instead of complaining loudly, only write which bucket is used and which buckets are cleaned up. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: Drop cache bucketSascha Hauer2017-03-311-45/+67
| | | | | | | | | | | | | | The cache bucket sits between the storage functions and the backend storage. We only read from the storage once, so there is no need to cache anything. The real purpose of the cache bucket is to keep the -EUCLEAN information when a NAND block needs to be rewritten and to keep the read buffers as long as the backend iterates over all buckets trying to find the one we want to use. This can be coded easier and more obvious in the backend code, so drop the cache bucket. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: Convert all bufs to void *Sascha Hauer2017-03-311-3/+3
| | | | | | | | A void * is a much better type for a buffer than a u8 * as it can be casted to any other type implicitly. Convert all buffers used by the state framework to void *. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: replace len_hint logicSascha Hauer2017-03-311-3/+6
| | | | | | | | The len_hint mechanism is rather hard to understand as it's not clear from where to where the hint is passed and also it's not clear what happens if the hint is empty or wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: simplify direct backendSascha Hauer2017-03-311-131/+14
| | | | | | | | | - drop support for regular files. This, if at all, is only useful for debugging. For the debugging case still a file of sufficient size can be created manually. - make stridesize mandatory. Makes the code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: drop lazy_initSascha Hauer2017-03-311-33/+1
| | | | | | | | | lazy_init is an optimization that makes it possible to read only up to the first valid bucket when starting. However, when restoring consistency, immediately afterwards we have we have to initialize all buckets anyway, so being lazy doesn't give us any gain. Remove it to simplify the code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: storage: initialize variable once outside loopSascha Hauer2017-03-311-4/+6
| | | | | | | writesize is initialized with the same value in each loop iteration, Instead, initialize it once outside the loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: pass struct state * to storage functionsSascha Hauer2017-03-311-4/+3
| | | | | | | We can get a state_backend_storage * and the device * from struct state, so pass this to the storage functions rather than the two pointers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: backend: remove len_hint argument from state_storage_readSascha Hauer2017-03-311-3/+2
| | | | | | The argument is 0 in the only caller, so remove the argument. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* state: Use positive logicSascha Hauer2017-03-311-7/+7
| | | | | | | bools with "non" in the names are rather confusing. Switch to positive logic. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* backend_storage: add fs.h for BLKGETSIZE64Michael Grzeschik2016-09-221-0/+1
| | | | Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
* Update barebox-stateMarkus Pargmann2016-07-051-5/+60
| | | | | | Fixed direct bucket Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
* barebox-state: Import updated state codeMarkus Pargmann2016-05-271-0/+470
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>