Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 64082
b: refs/heads/master
c: 0fdb7f9
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Aug 16, 2007
1 parent c603f28 commit 7ec6d1e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70b0e7a919b7961285c685a87928ed78c9fb07f0
refs/heads/master: 0fdb7f96d8c27e37ed2ca1ae5a763baf14b8fe0c
38 changes: 38 additions & 0 deletions trunk/arch/sparc64/kernel/mdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/miscdevice.h>

#include <asm/hypervisor.h>
#include <asm/mdesc.h>
Expand Down Expand Up @@ -836,6 +837,43 @@ void __devinit mdesc_fill_in_cpu_data(cpumask_t mask)
mdesc_release(hp);
}

static ssize_t mdesc_read(struct file *file, char __user *buf,
size_t len, loff_t *offp)
{
struct mdesc_handle *hp = mdesc_grab();
int err;

if (!hp)
return -ENODEV;

err = hp->handle_size;
if (len < hp->handle_size)
err = -EMSGSIZE;
else if (copy_to_user(buf, &hp->mdesc, hp->handle_size))
err = -EFAULT;
mdesc_release(hp);

return err;
}

static const struct file_operations mdesc_fops = {
.read = mdesc_read,
.owner = THIS_MODULE,
};

static struct miscdevice mdesc_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mdesc",
.fops = &mdesc_fops,
};

static int __init mdesc_misc_init(void)
{
return misc_register(&mdesc_misc);
}

__initcall(mdesc_misc_init);

void __init sun4v_mdesc_init(void)
{
struct mdesc_handle *hp;
Expand Down

0 comments on commit 7ec6d1e

Please sign in to comment.