fpgafs/files.c

62 lines
1.5 KiB
C

/*********************************************
* Benjamin Krill <ben@codiert.org>
*********************************************/
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
#include "fpgafs.h"
/* generic open function for all pipe-like files */
static int fpgafs_open(struct inode *inode, struct file *file)
{
struct fpgafs_inode_info *i = FPGAFS_I(inode);
file->private_data = i->i_ctx;
return nonseekable_open(inode, file);
}
static const struct file_operations fpgafs_stat_fops = {
.open = fpgafs_open,
.read = fpgafs_read_stat,
};
static const struct file_operations fpgafs_cmd_fops = {
.open = fpgafs_open,
.write = fpgafs_write_cmd,
};
static const struct file_operations fpgafs_load_fops = {
.open = fpgafs_open,
.write = fpgafs_write_load,
.read = fpgafs_read_load,
};
static const struct file_operations fpgafs_din_fops = {
.open = fpgafs_open,
.read = fpgafs_recv_data,
};
static const struct file_operations fpgafs_dout_fops = {
.open = fpgafs_open,
.write = fpgafs_send_data,
};
static const struct file_operations fpgafs_lldrv_fops = {
.open = fpgafs_open,
.write = fpgafs_write_lldrv,
.read = fpgafs_read_lldrv,
};
struct tree_descr fpgafs_dir_contents[] = {
{ "din", &fpgafs_din_fops, 0222, },
{ "dout", &fpgafs_dout_fops, 0444, },
{ "load", &fpgafs_load_fops, 0666, },
{ "cmd", &fpgafs_cmd_fops, 0222, },
{ "stat", &fpgafs_stat_fops, 0444, },
{ "lldrv", &fpgafs_lldrv_fops, 0444, },
{},
};