2007-06-28 22:43:40 +02:00
|
|
|
/*********************************************
|
|
|
|
* Benjamin Krill <ben@codiert.org>
|
|
|
|
*********************************************/
|
2007-06-28 18:20:34 +02:00
|
|
|
#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 */
|
2007-07-01 11:55:49 +02:00
|
|
|
static int fpgafs_open(struct inode *inode, struct file *file)
|
2007-06-28 18:20:34 +02:00
|
|
|
{
|
2007-07-10 17:07:35 +02:00
|
|
|
struct fpgafs_inode_info *i = FPGAFS_I(inode);
|
|
|
|
file->private_data = i->i_ctx;
|
2007-06-28 18:20:34 +02:00
|
|
|
|
2007-07-10 17:07:35 +02:00
|
|
|
return nonseekable_open(inode, file);
|
2007-06-28 18:20:34 +02:00
|
|
|
}
|
|
|
|
|
2007-09-10 09:45:12 +02:00
|
|
|
static const struct file_operations fpgafs_stat_fops = {
|
|
|
|
.open = fpgafs_open,
|
2007-09-23 14:31:38 +02:00
|
|
|
.read = fpgafs_read_stat,
|
2007-09-10 09:45:12 +02:00
|
|
|
};
|
|
|
|
|
2007-07-01 11:55:49 +02:00
|
|
|
static const struct file_operations fpgafs_cmd_fops = {
|
|
|
|
.open = fpgafs_open,
|
2007-09-23 14:31:38 +02:00
|
|
|
.write = fpgafs_write_cmd,
|
2007-06-28 18:20:34 +02:00
|
|
|
};
|
|
|
|
|
2007-07-09 15:12:16 +02:00
|
|
|
static const struct file_operations fpgafs_load_fops = {
|
|
|
|
.open = fpgafs_open,
|
2007-07-10 16:18:07 +02:00
|
|
|
.write = fpgafs_write_load,
|
|
|
|
.read = fpgafs_read_load,
|
2007-07-09 15:12:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2007-09-10 09:45:12 +02:00
|
|
|
static const struct file_operations fpgafs_lldrv_fops = {
|
|
|
|
.open = fpgafs_open,
|
|
|
|
.write = fpgafs_write_lldrv,
|
|
|
|
.read = fpgafs_read_lldrv,
|
|
|
|
};
|
|
|
|
|
2007-06-28 18:20:34 +02:00
|
|
|
struct tree_descr fpgafs_dir_contents[] = {
|
2007-07-01 11:55:49 +02:00
|
|
|
{ "din", &fpgafs_din_fops, 0222, },
|
|
|
|
{ "dout", &fpgafs_dout_fops, 0444, },
|
|
|
|
{ "load", &fpgafs_load_fops, 0666, },
|
|
|
|
{ "cmd", &fpgafs_cmd_fops, 0222, },
|
2007-06-28 18:20:34 +02:00
|
|
|
{ "stat", &fpgafs_stat_fops, 0444, },
|
2007-09-10 09:45:12 +02:00
|
|
|
{ "lldrv", &fpgafs_lldrv_fops, 0444, },
|
2007-06-28 18:20:34 +02:00
|
|
|
{},
|
|
|
|
};
|