Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1902
b: refs/heads/master
c: 3df5952
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Jun 8, 2005
1 parent a20b0f3 commit 5eb7a61
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a38133298fc678335a0229e97b6161a7ac6fec84
refs/heads/master: 3df59529ad1045da61698bb5dd8ebaa547aeb46f
6 changes: 6 additions & 0 deletions trunk/arch/um/Kconfig_char
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,11 @@ config UML_RANDOM
http://sourceforge.net/projects/gkernel/). rngd periodically reads
/dev/hwrng and injects the entropy into /dev/random.

config MMAPPER
tristate "iomem emulation driver"
help
This driver allows a host file to be used as emulated IO memory inside
UML.

endmenu

24 changes: 20 additions & 4 deletions trunk/arch/um/drivers/mmapper_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
Expand Down Expand Up @@ -117,24 +118,39 @@ static struct file_operations mmapper_fops = {
.release = mmapper_release,
};

static struct miscdevice mmapper_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mmapper",
.fops = &mmapper_fops
};

static int __init mmapper_init(void)
{
int err;

printk(KERN_INFO "Mapper v0.1\n");

v_buf = (char *) find_iomem("mmapper", &mmapper_size);
if(mmapper_size == 0){
printk(KERN_ERR "mmapper_init - find_iomem failed\n");
return(0);
goto out;
}

p_buf = __pa(v_buf);
err = misc_register(&mmapper_dev);
if(err){
printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
err);
goto out;
}

devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUGO|S_IWUGO, "mmapper");
return(0);
p_buf = __pa(v_buf);
out:
return 0;
}

static void mmapper_exit(void)
{
misc_deregister(&mmapper_dev);
}

module_init(mmapper_init);
Expand Down

0 comments on commit 5eb7a61

Please sign in to comment.