From d7478d128be22cd719b03097ae8702a6b588b6e5 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Tue, 3 Dec 2019 18:21:54 +0000 Subject: [PATCH] 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. --- qubes/storage/reflink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubes/storage/reflink.py b/qubes/storage/reflink.py index d94a0ac9..84b5d790 100644 --- a/qubes/storage/reflink.py +++ b/qubes/storage/reflink.py @@ -37,7 +37,7 @@ from contextlib import contextmanager, suppress import qubes.storage -FICLONE = 1074041865 # defined in +FICLONE = 1074041865 # defined in , assuming sizeof(int)==4 LOOP_SET_CAPACITY = 0x4C07 # defined in LOGGER = logging.getLogger('qubes.storage.reflink')