include/uapi/xen/gntdev.h
Source file repositories/reference/linux-study-clean/include/uapi/xen/gntdev.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/xen/gntdev.h- Extension
.h- Size
- 11036 bytes
- Lines
- 316
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct ioctl_gntdev_grant_refstruct ioctl_gntdev_map_grant_refstruct ioctl_gntdev_unmap_grant_refstruct ioctl_gntdev_get_offset_for_vaddrstruct ioctl_gntdev_set_max_grantsstruct ioctl_gntdev_unmap_notifystruct gntdev_grant_copy_segmentstruct ioctl_gntdev_grant_copystruct ioctl_gntdev_dmabuf_exp_from_refsstruct ioctl_gntdev_dmabuf_exp_wait_releasedstruct ioctl_gntdev_dmabuf_imp_to_refsstruct ioctl_gntdev_dmabuf_imp_release
Annotated Snippet
struct ioctl_gntdev_grant_ref {
/* The domain ID of the grant to be mapped. */
__u32 domid;
/* The grant reference of the grant to be mapped. */
__u32 ref;
};
/*
* Inserts the grant references into the mapping table of an instance
* of gntdev. N.B. This does not perform the mapping, which is deferred
* until mmap() is called with @index as the offset. @index should be
* considered opaque to userspace, with one exception: if no grant
* references have ever been inserted into the mapping table of this
* instance, @index will be set to 0. This is necessary to use gntdev
* with userspace APIs that expect a file descriptor that can be
* mmap()'d at offset 0, such as Wayland. If @count is set to 0, this
* ioctl will fail.
*/
#define IOCTL_GNTDEV_MAP_GRANT_REF \
_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
struct ioctl_gntdev_map_grant_ref {
/* IN parameters */
/* The number of grants to be mapped. */
__u32 count;
__u32 pad;
/* OUT parameters */
/* The offset to be used on a subsequent call to mmap(). */
__u64 index;
/* Variable IN parameter. */
/* Array of grant references, of size @count. */
struct ioctl_gntdev_grant_ref refs[1];
};
/*
* Removes the grant references from the mapping table of an instance of
* gntdev. N.B. munmap() must be called on the relevant virtual address(es)
* before this ioctl is called, or an error will result.
*/
#define IOCTL_GNTDEV_UNMAP_GRANT_REF \
_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))
struct ioctl_gntdev_unmap_grant_ref {
/* IN parameters */
/* The offset was returned by the corresponding map operation. */
__u64 index;
/* The number of pages to be unmapped. */
__u32 count;
__u32 pad;
};
/*
* Returns the offset in the driver's address space that corresponds
* to @vaddr. This can be used to perform a munmap(), followed by an
* UNMAP_GRANT_REF ioctl, where no state about the offset is retained by
* the caller. The number of pages that were allocated at the same time as
* @vaddr is returned in @count.
*
* N.B. Where more than one page has been mapped into a contiguous range, the
* supplied @vaddr must correspond to the start of the range; otherwise
* an error will result. It is only possible to munmap() the entire
* contiguously-allocated range at once, and not any subrange thereof.
*/
#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \
_IOC(_IOC_NONE, 'G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr))
struct ioctl_gntdev_get_offset_for_vaddr {
/* IN parameters */
/* The virtual address of the first mapped page in a range. */
__u64 vaddr;
/* OUT parameters */
/* The offset that was used in the initial mmap() operation. */
__u64 offset;
/* The number of pages mapped in the VM area that begins at @vaddr. */
__u32 count;
__u32 pad;
};
/*
* Sets the maximum number of grants that may mapped at once by this gntdev
* instance.
*
* N.B. This must be called before any other ioctl is performed on the device.
*/
#define IOCTL_GNTDEV_SET_MAX_GRANTS \
_IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants))
struct ioctl_gntdev_set_max_grants {
/* IN parameter */
/* The maximum number of grants that may be mapped at once. */
__u32 count;
};
/*
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct ioctl_gntdev_grant_ref`, `struct ioctl_gntdev_map_grant_ref`, `struct ioctl_gntdev_unmap_grant_ref`, `struct ioctl_gntdev_get_offset_for_vaddr`, `struct ioctl_gntdev_set_max_grants`, `struct ioctl_gntdev_unmap_notify`, `struct gntdev_grant_copy_segment`, `struct ioctl_gntdev_grant_copy`, `struct ioctl_gntdev_dmabuf_exp_from_refs`, `struct ioctl_gntdev_dmabuf_exp_wait_released`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.