diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c index ec78748..f71e5c2 100644 --- a/src/barebox-state/backend_bucket_circular.c +++ b/src/barebox-state/backend_bucket_circular.c @@ -23,6 +23,10 @@ #include #include +#ifndef __BAREBOX__ +#include +#endif + #include "state.h" /* @@ -249,7 +253,7 @@ circ->write_area = 0; dev_info(circ->dev, "Detected old on-storage format\n"); } else if (circ->last_written_length > circ->write_area - || !IS_ALIGNED(circ->last_written_length, circ->writesize)) { + || (circ->last_written_length % circ->writesize != 0)) { circ->write_area = 0; dev_err(circ->dev, "Error, invalid number of bytes written last time %d\n", circ->last_written_length); @@ -296,7 +300,7 @@ get_bucket_circular(bucket); off_t offset; struct state_backend_storage_bucket_circular_meta *meta; - uint32_t written_length = ALIGN(len + sizeof(*meta), circ->writesize); + uint32_t written_length = roundup(len + sizeof(*meta), circ->writesize); int ret; void *write_buf;