This source file includes following definitions.
- do_spu_run
- do_spu_create
1
2 #include <linux/file.h>
3 #include <linux/fs.h>
4 #include <linux/export.h>
5 #include <linux/mount.h>
6 #include <linux/namei.h>
7 #include <linux/slab.h>
8
9 #include <linux/uaccess.h>
10
11 #include "spufs.h"
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 static long do_spu_run(struct file *filp,
35 __u32 __user *unpc,
36 __u32 __user *ustatus)
37 {
38 long ret;
39 struct spufs_inode_info *i;
40 u32 npc, status;
41
42 ret = -EFAULT;
43 if (get_user(npc, unpc))
44 goto out;
45
46
47 ret = -EINVAL;
48 if (filp->f_op != &spufs_context_fops)
49 goto out;
50
51 i = SPUFS_I(file_inode(filp));
52 ret = spufs_run_spu(i->i_ctx, &npc, &status);
53
54 if (put_user(npc, unpc))
55 ret = -EFAULT;
56
57 if (ustatus && put_user(status, ustatus))
58 ret = -EFAULT;
59 out:
60 return ret;
61 }
62
63 static long do_spu_create(const char __user *pathname, unsigned int flags,
64 umode_t mode, struct file *neighbor)
65 {
66 struct path path;
67 struct dentry *dentry;
68 int ret;
69
70 dentry = user_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
71 ret = PTR_ERR(dentry);
72 if (!IS_ERR(dentry)) {
73 ret = spufs_create(&path, dentry, flags, mode, neighbor);
74 done_path_create(&path, dentry);
75 }
76
77 return ret;
78 }
79
80 struct spufs_calls spufs_calls = {
81 .create_thread = do_spu_create,
82 .spu_run = do_spu_run,
83 .notify_spus_active = do_notify_spus_active,
84 .owner = THIS_MODULE,
85 #ifdef CONFIG_COREDUMP
86 .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
87 .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
88 #endif
89 };