blob: bc3b85e8bff7cea77cda52bbd644a4615bde6e33 [file] [log] [blame]
Daniel De Graafdd314052011-02-07 17:23:05 -05001/******************************************************************************
2 * gntalloc.h
3 *
4 * Interface to /dev/xen/gntalloc.
5 *
6 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
7 *
8 * This file is in the public domain.
9 */
10
11#ifndef __LINUX_PUBLIC_GNTALLOC_H__
12#define __LINUX_PUBLIC_GNTALLOC_H__
13
14/*
15 * Allocates a new page and creates a new grant reference.
16 */
17#define IOCTL_GNTALLOC_ALLOC_GREF \
18_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
19struct ioctl_gntalloc_alloc_gref {
20 /* IN parameters */
21 /* The ID of the domain to be given access to the grants. */
22 uint16_t domid;
23 /* Flags for this mapping */
24 uint16_t flags;
25 /* Number of pages to map */
26 uint32_t count;
27 /* OUT parameters */
28 /* The offset to be used on a subsequent call to mmap(). */
29 uint64_t index;
30 /* The grant references of the newly created grant, one per page */
31 /* Variable size, depending on count */
32 uint32_t gref_ids[1];
33};
34
35#define GNTALLOC_FLAG_WRITABLE 1
36
37/*
38 * Deallocates the grant reference, allowing the associated page to be freed if
39 * no other domains are using it.
40 */
41#define IOCTL_GNTALLOC_DEALLOC_GREF \
42_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
43struct ioctl_gntalloc_dealloc_gref {
44 /* IN parameters */
45 /* The offset returned in the map operation */
46 uint64_t index;
47 /* Number of references to unmap */
48 uint32_t count;
49};
50#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */