/alps/bar_resolve

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/bar_resolve
1 by Suren A. Chilingaryan
Test application for resolving user-space BAR addresses
1
#include <linux/init.h>
2
#include <linux/module.h>
3
#include <linux/device.h>
4
#include <linux/types.h>
5
#include <linux/cdev.h>
6
#include <linux/fs.h>
7
#include <linux/slab.h>
8
9
#include "mod.h"
10
#include "dev.h"
11
#include "debug.h"
12
13
#define sysfs_attr(name) do { \
14
	if (device_create_file(dev->dev, &dev_attr_##name) != 0) \
15
				goto probe_device_create_fail; \
16
    } while (0)
17
18
19
int test_device_open(struct inode *inode, struct file *filp)
20
{
21
    test_dev_t *test;
22
23
    test = container_of( inode->i_cdev, test_dev_t, cdev);
24
    filp->private_data = test;
25
    
26
    mod_info("open\n");
27
28
    
29
    return 0;
30
}
31
32
int test_device_release(struct inode *inode, struct file *filp)
33
{
34
    test_dev_t *test = (test_dev_t*)filp->private_data;
35
36
    mod_info("close\n");
37
38
    return 0;
39
}
40
41
42
static struct file_operations test_fops = {
43
    .owner = THIS_MODULE,
44
//	.unlocked_ioctl = pcidriver_ioctl,
45
//	.mmap = pcidriver_mmap,
46
    .open = test_device_open,
47
    .release = test_device_release,
48
};
49
50
const struct file_operations *test_get_fops(void)
51
{
52
    return &test_fops;
53
}