Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gntalloc.h
Go to the documentation of this file.
1 /******************************************************************************
2  * gntalloc.h
3  *
4  * Interface to /dev/xen/gntalloc.
5  *
6  * Author: Daniel De Graaf <[email protected]>
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))
20  /* IN parameters */
21  /* The ID of the domain to be given access to the grants. */
23  /* Flags for this mapping */
25  /* Number of pages to map */
27  /* OUT parameters */
28  /* The offset to be used on a subsequent call to mmap(). */
30  /* The grant references of the newly created grant, one per page */
31  /* Variable size, depending on count */
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))
44  /* IN parameters */
45  /* The offset returned in the map operation */
47  /* Number of references to unmap */
49 };
50 
51 /*
52  * Sets up an unmap notification within the page, so that the other side can do
53  * cleanup if this side crashes. Required to implement cross-domain robust
54  * mutexes or close notification on communication channels.
55  *
56  * Each mapped page only supports one notification; multiple calls referring to
57  * the same page overwrite the previous notification. You must clear the
58  * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
59  * to occur.
60  */
61 #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
62 _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
64  /* IN parameters */
65  /* Offset in the file descriptor for a byte within the page (same as
66  * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
67  * be cleared. Otherwise, it can be any byte in the page whose
68  * notification we are adjusting.
69  */
71  /* Action(s) to take on unmap */
73  /* Event channel to notify */
75 };
76 
77 /* Clear (set to zero) the byte specified by index */
78 #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
79 /* Send an interrupt on the indicated event channel */
80 #define UNMAP_NOTIFY_SEND_EVENT 0x2
81 
82 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */