Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vfio.h
Go to the documentation of this file.
1 /*
2  * VFIO API definition
3  *
4  * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
5  * Author: Alex Williamson <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 #ifndef VFIO_H
12 #define VFIO_H
13 
14 
15 #include <linux/iommu.h>
16 #include <linux/mm.h>
17 #include <uapi/linux/vfio.h>
18 
31  char *name;
32  int (*open)(void *device_data);
33  void (*release)(void *device_data);
34  ssize_t (*read)(void *device_data, char __user *buf,
35  size_t count, loff_t *ppos);
36  ssize_t (*write)(void *device_data, const char __user *buf,
37  size_t count, loff_t *size);
38  long (*ioctl)(void *device_data, unsigned int cmd,
39  unsigned long arg);
40  int (*mmap)(void *device_data, struct vm_area_struct *vma);
41 };
42 
43 extern int vfio_add_group_dev(struct device *dev,
44  const struct vfio_device_ops *ops,
45  void *device_data);
46 
47 extern void *vfio_del_group_dev(struct device *dev);
48 
53  char *name;
54  struct module *owner;
55  void *(*open)(unsigned long arg);
56  void (*release)(void *iommu_data);
57  ssize_t (*read)(void *iommu_data, char __user *buf,
58  size_t count, loff_t *ppos);
59  ssize_t (*write)(void *iommu_data, const char __user *buf,
60  size_t count, loff_t *size);
61  long (*ioctl)(void *iommu_data, unsigned int cmd,
62  unsigned long arg);
63  int (*mmap)(void *iommu_data, struct vm_area_struct *vma);
64  int (*attach_group)(void *iommu_data,
65  struct iommu_group *group);
67  struct iommu_group *group);
68 
69 };
70 
71 extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
72 
74  const struct vfio_iommu_driver_ops *ops);
75 
86 #define offsetofend(TYPE, MEMBER) ({ \
87  TYPE tmp; \
88  offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
89 
90 #endif /* VFIO_H */