Summary: | RFE: Support for Debian's offset= in /etc/crypttab | ||
---|---|---|---|
Product: | systemd | Reporter: | vecu.bosseur |
Component: | general | Assignee: | systemd-bugs |
Status: | RESOLVED FIXED | QA Contact: | systemd-bugs |
Severity: | normal | ||
Priority: | medium | CC: | martin.pitt |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
cryptsetup: Implement offset and skip options
reproducer/test script cryptsetup: Implement offset and skip options cryptsetup: Implement offset and skip options |
Description
vecu.bosseur
2014-12-25 20:58:35 UTC
It's a long-standing well-known limitation: /* Options Debian's crypttab knows we don't: offset= skip= precheck= check= checkargs= noearly= loud= keyscript= */ Some of those will probably never be implemented (noearly, keyscript, loud, ...), but offset certainly should. Created attachment 115118 [details] [review] cryptsetup: Implement offset and skip options Simple patch. Created attachment 115119 [details]
reproducer/test script
This is the reproducer and test script which I used.
I think a failure to parse those parameters should be fatal. It's just to dangerous to continue. Also "meatadata" in description :) Created attachment 115126 [details] [review] cryptsetup: Implement offset and skip options Indeed! Fixed both. I tested with "offset=x8" and it now correctly aborts and doesn't touch the device. offset=1024 and no offset still continue to work. Thanks for the review! Hmm, please use parse_bytes() for parsing byte values. (In reply to Lennart Poettering from comment #6) > Hmm, please use parse_bytes() for parsing byte values. Sorry, I meant parse_size() of course. Also, please add the initialization of .offset and .skip into the declaration of the params variable, as initializer. i.e.: struct crypt_params_plain params = { .offset = arg_offset, .skip = arg_skip, }; Also, please document the new switches in crypttab(5). Created attachment 115162 [details] [review] cryptsetup: Implement offset and skip options parse_size() is not appropriate here, as the offset=/skip= argument is a plain natural number, and the unit is always "512 byte blocks". So allowing things like "3.3K" there would be confusing, wrong, imprecise, and incompatible with the cryptsetup project. I added documentation, the initializer, and also incorporated warning that Zbigniew suggested on the ML. OK, if this is not a bytes value, parse_size() is probably not a good idea. (that said, I think it's a pretty poor choice to expose this as 512byte block value...) Anyway, looks good. Please push! http://cgit.freedesktop.org/systemd/systemd/commit/?id=4eac277367 Thanks for the review and suggestions! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.