import mars-03.tgz

This commit is contained in:
Thomas Schoebel-Theuer 2010-06-15 19:31:06 +01:00
parent ca517f7309
commit feafb2a4c4
7 changed files with 107 additions and 107 deletions

View File

@ -21,7 +21,7 @@ config MARS_IF_DEVICE
---help---
Experimental storage System.
config MARS_DEVICE_SYNC
config MARS_DEVICE_SIO
tristate "interface to a linux file, synchronous"
depends on MARS
default m

View File

@ -5,7 +5,7 @@
obj-$(CONFIG_MARS) += mars_generic.o
obj-$(CONFIG_MARS_DUMMY) += mars_dummy.o
obj-$(CONFIG_MARS_IF_DEVICE) += mars_if_device.o
obj-$(CONFIG_MARS_DEVICE_SYNC) += mars_device_sync.o
obj-$(CONFIG_MARS_DEVICE_SIO) += mars_device_sio.o
obj-$(CONFIG_MARS_TEST) += mars_test.o

84
mars_device_sio.c Normal file
View File

@ -0,0 +1,84 @@
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include "mars.h"
///////////////////////// own type definitions ////////////////////////
#include "mars_device_sio.h"
////////////////// own brick / input / output operations //////////////////
static int device_sio_mars_io(struct device_sio_output *output, struct mars_io *mio)
{
struct bio *bio = mio->orig_bio;
mio->mars_endio(mio);
return 0;
}
///////////////////////// contructors / destructors ////////////////////////
static int device_sio_brick_construct(struct device_sio_brick *brick)
{
return 0;
}
static int device_sio_output_construct(struct device_sio_output *output)
{
return 0;
}
///////////////////////// static structs ////////////////////////
static struct device_sio_brick_ops device_sio_brick_ops = {
};
static struct device_sio_output_ops device_sio_output_ops = {
.mars_io = device_sio_mars_io,
};
static struct device_sio_output_type device_sio_output_type = {
.type_name = "device_sio_output",
.output_size = sizeof(struct device_sio_output),
.master_ops = &device_sio_output_ops,
.output_construct = &device_sio_output_construct,
};
static struct device_sio_output_type *device_sio_output_types[] = {
&device_sio_output_type,
};
struct device_sio_brick_type device_sio_brick_type = {
.type_name = "device_sio_brick",
.brick_size = sizeof(struct device_sio_brick),
.max_inputs = 0,
.max_outputs = 1,
.master_ops = &device_sio_brick_ops,
.default_output_types = device_sio_output_types,
.brick_construct = &device_sio_brick_construct,
};
EXPORT_SYMBOL_GPL(device_sio_brick_type);
////////////////// module init stuff /////////////////////////
static int __init init_device_sio(void)
{
printk(MARS_INFO "init_device_sio()\n");
return device_sio_register_brick_type();
}
static void __exit exit_device_sio(void)
{
printk(MARS_INFO "exit_device_sio()\n");
device_sio_unregister_brick_type();
}
MODULE_DESCRIPTION("MARS device_sio brick");
MODULE_AUTHOR("Thomas Schoebel-Theuer <tst@1und1.de>");
MODULE_LICENSE("GPL");
module_init(init_device_sio);
module_exit(exit_device_sio);

14
mars_device_sio.h Normal file
View File

@ -0,0 +1,14 @@
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
struct device_sio_brick {
MARS_BRICK(device_sio);
};
struct device_sio_input {
MARS_INPUT(device_sio);
};
struct device_sio_output {
MARS_OUTPUT(device_sio);
};
MARS_TYPES(device_sio);

View File

@ -1,84 +0,0 @@
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include "mars.h"
///////////////////////// own type definitions ////////////////////////
#include "mars_device_sync.h"
////////////////// own brick / input / output operations //////////////////
static int device_sync_mars_io(struct device_sync_output *output, struct mars_io *mio)
{
struct bio *bio = mio->orig_bio;
mio->mars_endio(mio);
return 0;
}
///////////////////////// contructors / destructors ////////////////////////
static int device_sync_brick_construct(struct device_sync_brick *brick)
{
return 0;
}
static int device_sync_output_construct(struct device_sync_output *output)
{
return 0;
}
///////////////////////// static structs ////////////////////////
static struct device_sync_brick_ops device_sync_brick_ops = {
};
static struct device_sync_output_ops device_sync_output_ops = {
.mars_io = device_sync_mars_io,
};
static struct device_sync_output_type device_sync_output_type = {
.type_name = "device_sync_output",
.output_size = sizeof(struct device_sync_output),
.master_ops = &device_sync_output_ops,
.output_construct = &device_sync_output_construct,
};
static struct device_sync_output_type *device_sync_output_types[] = {
&device_sync_output_type,
};
struct device_sync_brick_type device_sync_brick_type = {
.type_name = "device_sync_brick",
.brick_size = sizeof(struct device_sync_brick),
.max_inputs = 0,
.max_outputs = 1,
.master_ops = &device_sync_brick_ops,
.default_output_types = device_sync_output_types,
.brick_construct = &device_sync_brick_construct,
};
EXPORT_SYMBOL_GPL(device_sync_brick_type);
////////////////// module init stuff /////////////////////////
static int __init init_device_sync(void)
{
printk(MARS_INFO "init_device_sync()\n");
return device_sync_register_brick_type();
}
static void __exit exit_device_sync(void)
{
printk(MARS_INFO "exit_device_sync()\n");
device_sync_unregister_brick_type();
}
MODULE_DESCRIPTION("MARS device_sync brick");
MODULE_AUTHOR("Thomas Schoebel-Theuer <tst@1und1.de>");
MODULE_LICENSE("GPL");
module_init(init_device_sync);
module_exit(exit_device_sync);

View File

@ -1,14 +0,0 @@
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
struct device_sync_brick {
MARS_BRICK(device_sync);
};
struct device_sync_input {
MARS_INPUT(device_sync);
};
struct device_sync_output {
MARS_OUTPUT(device_sync);
};
MARS_TYPES(device_sync);

View File

@ -12,12 +12,12 @@
#include "mars.h"
#include "mars_if_device.h"
#include "mars_device_sync.h"
#include "mars_device_sio.h"
GENERIC_MAKE_CONNECT(if_device, device_sync);
GENERIC_MAKE_CONNECT(if_device, device_sio);
static struct if_device_brick *if_brick = NULL;
static struct device_sync_brick *device_brick = NULL;
static struct device_sio_brick *device_brick = NULL;
void make_test_instance(void)
{
@ -32,7 +32,7 @@ void make_test_instance(void)
MARS_DBG("starting....\n");
status = device_sync_brick_init_full(mem, size, &device_sync_brick_type, NULL, NULL, names);
status = device_sio_brick_init_full(mem, size, &device_sio_brick_type, NULL, NULL, names);
MARS_DBG("done (status=%d)\n", status);
if (!status)
device_brick = mem;
@ -48,7 +48,7 @@ void make_test_instance(void)
if (!status)
if_brick = mem;
status = if_device_device_sync_connect(if_brick->inputs[0], device_brick->outputs[0]);
status = if_device_device_sio_connect(if_brick->inputs[0], device_brick->outputs[0]);
MARS_DBG("connect (status=%d)\n", status);
}
@ -56,13 +56,13 @@ void make_test_instance(void)
void destroy_test_instance(void)
{
if (if_brick) {
if_device_device_sync_disconnect(if_brick->inputs[0]);
if_device_device_sio_disconnect(if_brick->inputs[0]);
if_device_brick_exit_full(if_brick);
kfree(if_brick);
if_brick = NULL;
}
if (device_brick) {
device_sync_brick_exit_full(device_brick);
device_sio_brick_exit_full(device_brick);
kfree(device_brick);
device_brick = NULL;
}