storage/reflink: document hardcoded sizeof(int) for FICLONE

One alternative would look like

    import ctypes
    sizeof_int = ctypes.sizeof(ctypes.c_int)
    FICLONE = (1073741824 % 256**sizeof_int) | 37897 | (sizeof_int << 16)

but, even if the above really(?) is a 100% correct Python port of

    $ echo FICLONE | cpp -include linux/fs.h | tail -n 1

it still seems more likely that the ctypes package is somehow buggy
somewhere than for Qubes storage to run on an exotic architecture with
non 32 bit ints (in the foreseeable future).

So just document the baked in assumption.
This commit is contained in:
Rusty Bird 2019-12-03 18:21:54 +00:00
parent 3f0286220c
commit d7478d128b
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -37,7 +37,7 @@ from contextlib import contextmanager, suppress
import qubes.storage
FICLONE = 1074041865 # defined in <linux/fs.h>
FICLONE = 1074041865 # defined in <linux/fs.h>, assuming sizeof(int)==4
LOOP_SET_CAPACITY = 0x4C07 # defined in <linux/loop.h>
LOGGER = logging.getLogger('qubes.storage.reflink')