mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
- Add root LICENSE (MIT License, Copyright (c) 2026 QuixiAI / Eric Hartford).
- Set license = "MIT" in workspace Cargo.toml and member crates (zero non-MIT dependencies).
- Update all kernel-open/ and tests/vm/ SPDX headers to MIT and EXPORT_SYMBOL_GPL -> EXPORT_SYMBOL.
- Use MODULE_LICENSE("Dual MIT/GPL") in Linux .ko modules so Linux modpost permits linking against the kernel's own EXPORT_SYMBOL_GPL symbols while keeping the repository source 100% MIT.
Closes #12.
47 lines
1.6 KiB
C
47 lines
1.6 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
#ifndef NV_RS_IOCTL_POLICY_H
|
|
#define NV_RS_IOCTL_POLICY_H
|
|
#ifdef __KERNEL__
|
|
#include <linux/types.h>
|
|
#include <linux/ioctl.h>
|
|
typedef u32 nv_rs_u32;
|
|
typedef u64 nv_rs_u64;
|
|
#else
|
|
#include <stdint.h>
|
|
#include <sys/ioctl.h>
|
|
typedef uint32_t nv_rs_u32;
|
|
typedef uint64_t nv_rs_u64;
|
|
#endif
|
|
#define NV_RS_OUTER_MAX 16384U
|
|
#define NV_RS_XFER_CMD 211U
|
|
struct nv_rs_xfer { nv_rs_u32 command; nv_rs_u32 size; nv_rs_u64 pointer; };
|
|
struct nv_rs_request { nv_rs_u32 command; nv_rs_u32 size; nv_rs_u64 pointer; };
|
|
/* Native x86_64 only. A single XFER envelope; no recursive transport nesting. */
|
|
static inline int nv_rs_plan(unsigned int ioctl_command, nv_rs_u64 user_pointer,
|
|
const struct nv_rs_xfer *xfer,
|
|
struct nv_rs_request *request)
|
|
{
|
|
if (_IOC_TYPE(ioctl_command) != 'F')
|
|
return -25; /* ENOTTY */
|
|
if (_IOC_DIR(ioctl_command) != (_IOC_READ | _IOC_WRITE))
|
|
return -22;
|
|
request->command = _IOC_NR(ioctl_command);
|
|
request->size = _IOC_SIZE(ioctl_command);
|
|
request->pointer = user_pointer;
|
|
if (request->command == NV_RS_XFER_CMD) {
|
|
if (request->size != sizeof(struct nv_rs_xfer))
|
|
return -22;
|
|
if (!xfer)
|
|
return 1; /* caller must copy exactly one 16-byte header */
|
|
request->command = xfer->command;
|
|
request->size = xfer->size;
|
|
request->pointer = xfer->pointer;
|
|
if (request->command == NV_RS_XFER_CMD || request->command > 255)
|
|
return -22;
|
|
}
|
|
if (request->size > NV_RS_OUTER_MAX)
|
|
return -22;
|
|
return 0;
|
|
}
|
|
#endif
|