computing-offload/qtfs/utils/qtfs_utils.h
Yikun Jiang a68570b5d9 Add computing offloading code
1. Add computing offloading code
2. Add script.md
3. Add virsh_demo.xml

Change-Id: Id9ef883e2f0eb727eb5448b9d1c47767f46b1021
Signed-off-by: Yikun Jiang <yikunkero@gmail.com>
2023-10-23 19:29:57 +08:00

56 lines
1.8 KiB
C

/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
* qtfs licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
* Author: Liqiang
* Create: 2023-03-20
* Description:
*******************************************************************************/
#ifndef __QTFS_UTILS_H__
#define __QTFS_UTILS_H__
#define QTFS_UTILS_DEV "/dev/qtfs_utils"
// QTFS provide some remote capability
#define QTUTIL_IOCTL_CAPA_MAGIC 'U'
enum {
_QTUTIL_IOCTL_CAPA_PORT_INUSE,
};
#define QTUTIL_CAPA(CAP) _IO(QTUTIL_IOCTL_CAPA_MAGIC, CAP)
#define QTUTIL_CAPA_PORT_INUSE QTUTIL_CAPA(_QTUTIL_IOCTL_CAPA_PORT_INUSE)
// QTFS provide some remote syscalls
#define QTUTIL_IOCTL_SC_MAGIC 'S'
enum {
_QTUTIL_IOCTL_SYSCALL_KILL,
_QTUTIL_IOCTL_SYSCALL_SCHED_SETAFFINITY,
_QTUTIL_IOCTL_SYSCALL_SCHED_GETAFFINITY,
};
#define QTUTIL_SYSCALL(SC) _IO(QTUTIL_IOCTL_SC_MAGIC, SC)
#define QTUTIL_SC_KILL QTUTIL_SYSCALL(_QTUTIL_IOCTL_SYSCALL_KILL)
#define QTUTIL_SC_SCHED_SETAFFINITY QTUTIL_SYSCALL(_QTUTIL_IOCTL_SYSCALL_SCHED_SETAFFINITY)
#define QTUTIL_SC_SCHED_GETAFFINITY QTUTIL_SYSCALL(_QTUTIL_IOCTL_SYSCALL_SCHED_GETAFFINITY)
struct qtsc_kill {
int pid;
int signum;
};
// sched getaffinity and set affinity
struct qtsc_sched_affinity {
int pid;
unsigned int len;
unsigned long *user_mask_ptr;
};
#endif