From 801a8f715401703ae2bc72f1136b6604159a993c Mon Sep 17 00:00:00 2001 From: Shawn Anastasio Date: Mon, 8 Feb 2021 20:15:57 -0600 Subject: [PATCH] storage/reflink: Add IOCTL definitions for ppc64le Update the hardcoded x86_64-only IOCTL constants to match the correct values for the host architecture. --- qubes/storage/reflink.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qubes/storage/reflink.py b/qubes/storage/reflink.py index 8b9bfe0d..5f68b9cf 100644 --- a/qubes/storage/reflink.py +++ b/qubes/storage/reflink.py @@ -32,16 +32,26 @@ import logging import os import subprocess import tempfile +import platform +import sys from contextlib import contextmanager, suppress import qubes.storage import qubes.utils -FICLONE = 1074041865 # defined in , assuming sizeof(int)==4 +HOST_MACHINE = platform.machine() + +if HOST_MACHINE == "x86_64": + FICLONE = 0x40049409 # defined in +elif HOST_MACHINE == "ppc64le": + FICLONE = 0x80049409 +else: + print("Missing IOCTL definitions for platform {}".format(HOST_MACHINE)) + sys.exit(1) + LOOP_SET_CAPACITY = 0x4C07 # defined in LOGGER = logging.getLogger('qubes.storage.reflink') - def _coroutinized(function): ''' Wrap a synchronous function in a coroutine that runs the function via the event loop's ThreadPool-based default