storage/reflink: Add IOCTL definitions for ppc64le

Update the hardcoded x86_64-only IOCTL constants to match the correct
values for the host architecture.
This commit is contained in:
Shawn Anastasio 2021-02-08 20:15:57 -06:00
parent d3d6b9de2b
commit 801a8f7154
No known key found for this signature in database
GPG Key ID: 1FECF9CB6170B279

View File

@ -32,16 +32,26 @@ import logging
import os import os
import subprocess import subprocess
import tempfile import tempfile
import platform
import sys
from contextlib import contextmanager, suppress from contextlib import contextmanager, suppress
import qubes.storage import qubes.storage
import qubes.utils import qubes.utils
FICLONE = 1074041865 # defined in <linux/fs.h>, assuming sizeof(int)==4 HOST_MACHINE = platform.machine()
if HOST_MACHINE == "x86_64":
FICLONE = 0x40049409 # defined in <linux/fs.h>
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 <linux/loop.h> LOOP_SET_CAPACITY = 0x4C07 # defined in <linux/loop.h>
LOGGER = logging.getLogger('qubes.storage.reflink') LOGGER = logging.getLogger('qubes.storage.reflink')
def _coroutinized(function): def _coroutinized(function):
''' Wrap a synchronous function in a coroutine that runs the ''' Wrap a synchronous function in a coroutine that runs the
function via the event loop's ThreadPool-based default function via the event loop's ThreadPool-based default