fpgafs/files.c
ben 223b5809fb include license informations
git-svn-id: svn+ssh://en.codiert.org/home/staff/ben/dev/misc.svn/projects/fpgafs@438 766a2236-cff9-0310-b0c0-a81a5f92509a
2007-10-21 10:11:55 +00:00

77 lines
2.3 KiB
C

/* *****************************************************************
* (C) Copyright 2007 Benjamin Krill <ben@codiert.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301 USA
* *****************************************************************/
#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, },
{},
};