Conversation
|
I'm realizing that there's no test application for this new package. So it won't be built by the CI. I would be nice to add a simple one (you can use |
Yep, I'm currently working on that. The reason why this is a draft PR. |
|
You can probably squash when you rebase |
3ca9440 to
b7997a9
Compare
b7997a9 to
9ba4d2f
Compare
|
I think everything should be in place, now. I'm ready to be |
9ba4d2f to
28e9e12
Compare
fjmolinas
left a comment
There was a problem hiding this comment.
Seems CI is mostly happy, but this will need some blacklisting
|
Thank you for your reviews, @benpicco @fjmolinas! Is it okay if I squash all fixups before addressing your suggestions? |
|
Rebased on latest master. |
| * vcdiff_vfs_t target = VCDIFF_VFS_INIT(fd_target); | ||
| * vcdiff_set_target_driver(&vcdiff, &vcdiff_vfs_driver, &target); | ||
| * | ||
| * rc = vcdiff_apply_delta(&vcdiff, data, data_len); |
There was a problem hiding this comment.
Is there a requirement on how this needs to be fragmented?
There was a problem hiding this comment.
Nope, It should work byte-wise. Like shown here.
If it doesn't, it's a bug ;-)
|
Has anyone an idea how to handle this CI error? |
|
Can you make the fall-throughs explicit with |
|
Well, I could. But that produces really noisy code :-/ |
| /* mtd_read_page will take care of calculation the right page | ||
| * it's safe to call mtd_read_page_raw: the erase driver already | ||
| * prepared the sector for writing */ | ||
| int rc = mtd_write_page_raw(mtd->dev, src, 0, offset, len); |
There was a problem hiding this comment.
Are you sure this is right? The input offset is offset in bytes, while the offset parameter to mtd_write_page_raw is the offset in the page being written to, shouldn't it be something like:
| int rc = mtd_write_page_raw(mtd->dev, src, 0, offset, len); | |
| uint32_t page = offset / mtd->dev->page_size; | |
| uint32_t page_offset = (offset % mtd->dev->page_size); | |
| int rc = mtd_write_page_raw(mtd->dev, src, page, page_offset, len); |
(untested)
There was a problem hiding this comment.
Same question goes for the read function actually.
There was a problem hiding this comment.
It should work to start at page 0 and let the MTD implemenation figure out the right page.
There was a problem hiding this comment.
But that is only if there is write_page, not the case for mtd_flashpage for example.
There was a problem hiding this comment.
Ah sorry, my bad, I misunderstood the API I think.
There was a problem hiding this comment.
Well, but another problem could occur: un-aligned writes (i.e. addr % FLASHPAGE_WRITE_BLOCK_ALIGNMENT and size % FLASHPAGE_WRITE_BLOCK_SIZE are possible troublemaker ...). Or am I wrong?
There was a problem hiding this comment.
yea but you don't get those through MTD - #17683 tries to fix that
There was a problem hiding this comment.
I added write alignment for the MTD backend: b705803
|
I think it would be nice to have working MTD ;-) Thus, I'm waiting for #17683. |
|
I added write alignment for this package. Once #17683 is merged, I'll add a check if the configured write alignment and MTD write alignment are compatible. |
I sneaked that in with some pre-processor magic. The package can now be compiled without |
|
Finally a happy Murdock :) |
1a612fb to
0f1a1dc
Compare
|
Rebased on latest master. Still looking fine. @fjmolinas You faced problems with alignment on MTD flashpage, right? Could you test this PR again? I've introduced aligned writes for MTD backends. |
benpicco
left a comment
There was a problem hiding this comment.
With a rebase you can now get rid of CONFIG_TINYVCDIFF_MTD_WRITE_SIZE
| size_t alignment_offset; | ||
| size_t copy_len; | ||
|
|
||
| alignment_offset = mtd->offset % CONFIG_TINYVCDIFF_MTD_WRITE_SIZE; |
There was a problem hiding this comment.
| alignment_offset = mtd->offset % CONFIG_TINYVCDIFF_MTD_WRITE_SIZE; | |
| alignment_offset = mtd->offset % mtd->write_size; |
should now be possible.
There was a problem hiding this comment.
vcdiff_mtd_t requires write_size to be known at compile time to adjust buffer sizes. But at least an assert() would be nice to have.
There was a problem hiding this comment.
Could we use mtd->work_area instead?
There was a problem hiding this comment.
This would add the dependency mtd_write_page. Currently, I'm not using any of the write page features. Adding this module would add unnecessary code just to have the (mtd_write_page-internal) buffer at hand. It feels a little bit hacky to me.
I'd say having assert()s in place that make sure the buffer is aligned and large enough would be a good thing to have in place.
The default of 4 bytes seems to be a size that fits all mtd devices available in RIOT (IIRC) and isn't wasteful in my opinion.
There was a problem hiding this comment.
For mtd_flashpage it can be larger than 4, same for SD cards (but those are usually used with a filesystem)
|
Well, I'm happy to merge this as is and the do a follow-up PR. |
|
It seems like |
|
Oh thank you for your review! |
Contribution description
This is a WIP PR that brings tiny-vcdiff into RIOT.
I mentioned this library during my talk on the last RIOT Summit
Currently this PR supports
mtdas backend. But avfswill be added, too. I guess those are the obvious interfaces for such a package.Testing procedure
I will add a test later, that will make use of all implemented backends.
Issues/PRs references