include/xen/grant_table.h
Source file repositories/reference/linux-study-clean/include/xen/grant_table.h
File Facts
- System
- Linux kernel
- Corpus path
include/xen/grant_table.h- Extension
.h- Size
- 11499 bytes
- Lines
- 354
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/page.hxen/interface/xen.hxen/interface/grant_table.hasm/xen/hypervisor.hxen/features.hxen/page.hlinux/mm_types.hlinux/page-flags.hlinux/kernel.h
Detected Declarations
struct gnttab_free_callbackstruct gntab_unmap_queue_datastruct gntab_unmap_queue_datastruct grant_framesstruct gnttab_page_cachestruct gnttab_dma_alloc_argsstruct xen_page_foreignfunction gnttab_suspendfunction gnttab_resumefunction gnttab_page_grant_foreign_access_ref_onefunction gnttab_set_map_opfunction gnttab_set_unmap_opfunction gnttab_for_one_grantfunction gnttab_count_grant
Annotated Snippet
struct gnttab_free_callback {
struct gnttab_free_callback *next;
void (*fn)(void *);
void *arg;
u16 count;
};
struct gntab_unmap_queue_data;
typedef void (*gnttab_unmap_refs_done)(int result, struct gntab_unmap_queue_data *data);
struct gntab_unmap_queue_data
{
struct delayed_work gnttab_work;
void *data;
gnttab_unmap_refs_done done;
struct gnttab_unmap_grant_ref *unmap_ops;
struct gnttab_unmap_grant_ref *kunmap_ops;
struct page **pages;
unsigned int count;
unsigned int age;
};
int gnttab_init(void);
#ifdef CONFIG_HIBERNATE_CALLBACKS
int gnttab_suspend(void);
int gnttab_resume(void);
#else
static inline int gnttab_suspend(void)
{
return 0;
}
static inline int gnttab_resume(void)
{
return 0;
}
#endif
int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
int readonly);
/*
* End access through the given grant reference, iff the grant entry is no
* longer in use. Return 1 if the grant entry was freed, 0 if it is still in
* use.
*/
int gnttab_end_foreign_access_ref(grant_ref_t ref);
/*
* Eventually end access through the given grant reference, and once that
* access has been ended, free the given page too. Access will be ended
* immediately iff the grant entry is not in use, otherwise it will happen
* some time later. page may be NULL, in which case no freeing will occur.
* Note that the granted page might still be accessed (read or write) by the
* other side after gnttab_end_foreign_access() returns, so even if page was
* specified as NULL it is not allowed to just reuse the page for other
* purposes immediately. gnttab_end_foreign_access() will take an additional
* reference to the granted page in this case, which is dropped only after
* the grant is no longer in use.
* This requires that multi page allocations for areas subject to
* gnttab_end_foreign_access() are done via alloc_pages_exact() (and freeing
* via free_pages_exact()) in order to avoid high order pages.
*/
void gnttab_end_foreign_access(grant_ref_t ref, struct page *page);
/*
* End access through the given grant reference, iff the grant entry is
* no longer in use. In case of success ending foreign access, the
* grant reference is deallocated.
* Return 1 if the grant entry was freed, 0 if it is still in use.
*/
int gnttab_try_end_foreign_access(grant_ref_t ref);
/*
* operations on reserved batches of grant references
*/
int gnttab_alloc_grant_references(u16 count, grant_ref_t *pprivate_head);
int gnttab_alloc_grant_reference_seq(unsigned int count, grant_ref_t *first);
void gnttab_free_grant_reference(grant_ref_t ref);
void gnttab_free_grant_references(grant_ref_t head);
void gnttab_free_grant_reference_seq(grant_ref_t head, unsigned int count);
int gnttab_empty_grant_references(const grant_ref_t *pprivate_head);
int gnttab_claim_grant_reference(grant_ref_t *pprivate_head);
Annotation
- Immediate include surface: `asm/page.h`, `xen/interface/xen.h`, `xen/interface/grant_table.h`, `asm/xen/hypervisor.h`, `xen/features.h`, `xen/page.h`, `linux/mm_types.h`, `linux/page-flags.h`.
- Detected declarations: `struct gnttab_free_callback`, `struct gntab_unmap_queue_data`, `struct gntab_unmap_queue_data`, `struct grant_frames`, `struct gnttab_page_cache`, `struct gnttab_dma_alloc_args`, `struct xen_page_foreign`, `function gnttab_suspend`, `function gnttab_resume`, `function gnttab_page_grant_foreign_access_ref_one`.
- 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.