add the next directory entries

git-svn-id: svn+ssh://en.codiert.org/home/staff/ben/dev/misc.svn/projects/fpgafs@356 766a2236-cff9-0310-b0c0-a81a5f92509a
This commit is contained in:
ben 2007-07-09 13:12:16 +00:00
parent 5fb7a317c3
commit 30be5238b2
6 changed files with 65 additions and 4 deletions

30
files.c
View File

@ -76,12 +76,38 @@ static const struct file_operations fpgafs_cmd_fops = {
.write = fpgafs_cmd_write, .write = fpgafs_cmd_write,
}; };
static ssize_t fpgafs_load_read(struct file *file, char __user *buf,
size_t len, loff_t *pos)
{
return 0;
}
static ssize_t fpgafs_load_write(struct file *file, const char __user *buf,
size_t len, loff_t *pos)
{
return 0;
}
static const struct file_operations fpgafs_load_fops = {
.open = fpgafs_open,
.write = fpgafs_load_write,
.read = fpgafs_load_read,
};
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,
};
struct tree_descr fpgafs_dir_contents[] = { struct tree_descr fpgafs_dir_contents[] = {
#if 0
{ "din", &fpgafs_din_fops, 0222, }, { "din", &fpgafs_din_fops, 0222, },
{ "dout", &fpgafs_dout_fops, 0444, }, { "dout", &fpgafs_dout_fops, 0444, },
{ "load", &fpgafs_load_fops, 0666, }, { "load", &fpgafs_load_fops, 0666, },
#endif
{ "cmd", &fpgafs_cmd_fops, 0222, }, { "cmd", &fpgafs_cmd_fops, 0222, },
{ "stat", &fpgafs_stat_fops, 0444, }, { "stat", &fpgafs_stat_fops, 0444, },
{}, {},

View File

@ -42,6 +42,9 @@ struct fpgafs_lldrv {
int (*send) (unsigned char *buf, int len); int (*send) (unsigned char *buf, int len);
int (*recv) (unsigned char *buf, int len); int (*recv) (unsigned char *buf, int len);
int (*read_load) (unsigned char *buf, int len);
int (*write_load) (unsigned char *buf, int len);
}; };
int fpgafs_register_lldrv(struct fpgafs_lldrv *drv); int fpgafs_register_lldrv(struct fpgafs_lldrv *drv);
@ -50,4 +53,7 @@ int fpgafs_unregister_lldrv(struct fpgafs_lldrv *drv);
int fpgafs_send_data(char *buf, int len); int fpgafs_send_data(char *buf, int len);
int fpgafs_recv_data(char *buf, int len); int fpgafs_recv_data(char *buf, int len);
int fpgafs_read_load(char *buf, int len);
int fpgafs_write_load(char *buf, int len);
#endif /* FPGAFS_H */ #endif /* FPGAFS_H */

View File

@ -23,7 +23,9 @@ static struct fpgafs_lldrv fpgafs_lldrv_cham = {
.init = NULL, .init = NULL,
.exit = NULL, .exit = NULL,
.send = &fpgafs_send_data_cham, .send = &fpgafs_send_data_cham,
.recv = &fpgafs_recv_data_cham .recv = &fpgafs_recv_data_cham,
.read_load = NULL,
.write_load = NULL,
}; };
/* init exit functions ... */ /* init exit functions ... */

View File

@ -18,12 +18,24 @@ static int fpgafs_recv_data_dbg(unsigned char *buf, int len)
return 4; return 4;
} }
static int fpgafs_read_load_dbg(unsigned char *buf, int len)
{
return 0;
}
static int fpgafs_write_load_dbg(unsigned char *buf, int len)
{
return 0;
}
static struct fpgafs_lldrv fpgafs_lldrv_dbg = { static struct fpgafs_lldrv fpgafs_lldrv_dbg = {
.name = "dbg", .name = "dbg",
.init = NULL, .init = NULL,
.exit = NULL, .exit = NULL,
.send = &fpgafs_send_data_dbg, .send = &fpgafs_send_data_dbg,
.recv = &fpgafs_recv_data_dbg .recv = &fpgafs_recv_data_dbg,
.read_load = &fpgafs_read_load_dbg,
.write_load = &fpgafs_write_load_dbg,
}; };
/* init exit functions ... */ /* init exit functions ... */

View File

@ -296,6 +296,8 @@ int __init fpgafs_init(void)
return -ENOMEM; return -ENOMEM;
register_filesystem(&fpgafs_type); register_filesystem(&fpgafs_type);
printk("fpgafs: Benjamin Krill <ben@codiert.org");
printk("fpgafs: successfull loaded ...");
return 0; return 0;
} }

View File

@ -25,6 +25,19 @@ int fpgafs_recv_data(char *buf, int len)
} }
EXPORT_SYMBOL_GPL(fpgafs_recv_data); EXPORT_SYMBOL_GPL(fpgafs_recv_data);
int fpgafs_write_load(char *buf, int len)
{
return (lldrv_cur) ? lldrv_cur->write_load(buf, len) : -EBUSY;
}
EXPORT_SYMBOL_GPL(fpgafs_write_load);
int fpgafs_read_load(char *buf, int len)
{
return (lldrv_cur) ? lldrv_cur->read_load(buf, len) : -EBUSY;
}
EXPORT_SYMBOL_GPL(fpgafs_read_load);
/* low level un-/register functions */
int fpgafs_register_lldrv(struct fpgafs_lldrv *drv) int fpgafs_register_lldrv(struct fpgafs_lldrv *drv)
{ {
unsigned long flags; unsigned long flags;