Annotation of /trunk/kernel26-xen/patches-2.6.25-r1/1012-2.6.25-xen-Add-proc-xen-capabilities.patch
Parent Directory | Revision Log
Revision 606 -
(hide annotations)
(download)
Thu May 22 23:13:13 2008 UTC (16 years ago) by niro
File size: 6325 byte(s)
Thu May 22 23:13:13 2008 UTC (16 years ago) by niro
File size: 6325 byte(s)
-ver bump to 2.6.25-magellan-r1: - linux-2.6.25.4 - fbcondecor-0.9.4 - squashfs-3.3 - unionfs-2.3.3 - tuxonice-3.0-rc7 - linux-phc-0.3.0 - acpi-dstd-0.9a - reiser4 - xen-3.2.0 . ipw3945-1.2.2
1 | niro | 606 | From 923fc581e06dcb104c23121133e16dc1206d5820 Mon Sep 17 00:00:00 2001 |
2 | From: Mark McLoughlin <markmc@redhat.com> | ||
3 | Date: Mon, 4 Feb 2008 09:16:51 +0000 | ||
4 | Subject: [PATCH] xen: Add /proc/xen/capabilities | ||
5 | |||
6 | /proc/xen/capabilities is used by the xend init script | ||
7 | to check whether it is running on Dom0. | ||
8 | |||
9 | Signed-off-by: Mark McLoughlin <markmc@redhat.com> | ||
10 | --- | ||
11 | drivers/xen/xenctrl/Makefile | 1 + | ||
12 | drivers/xen/xenctrl/capabilities.c | 68 ++++++++++++++++++++++++++++++++++++ | ||
13 | drivers/xen/xenctrl/main.c | 11 ++++++ | ||
14 | drivers/xen/xenctrl/xenctrl.h | 39 ++++++++++++++++++++ | ||
15 | 4 files changed, 119 insertions(+), 0 deletions(-) | ||
16 | create mode 100644 drivers/xen/xenctrl/capabilities.c | ||
17 | create mode 100644 drivers/xen/xenctrl/xenctrl.h | ||
18 | |||
19 | diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile | ||
20 | index 1f43a43..631f535 100644 | ||
21 | --- a/drivers/xen/xenctrl/Makefile | ||
22 | +++ b/drivers/xen/xenctrl/Makefile | ||
23 | @@ -2,3 +2,4 @@ obj-$(CONFIG_XENCTRL) += xenctrl.o | ||
24 | |||
25 | xenctrl-objs = | ||
26 | xenctrl-objs += main.o | ||
27 | +xenctrl-objs += capabilities.o | ||
28 | diff --git a/drivers/xen/xenctrl/capabilities.c b/drivers/xen/xenctrl/capabilities.c | ||
29 | new file mode 100644 | ||
30 | index 0000000..1ff078a | ||
31 | --- /dev/null | ||
32 | +++ b/drivers/xen/xenctrl/capabilities.c | ||
33 | @@ -0,0 +1,68 @@ | ||
34 | +/****************************************************************************** | ||
35 | + * | ||
36 | + * capabilities.c | ||
37 | + * | ||
38 | + * /proc/xen/capabilities | ||
39 | + * | ||
40 | + * Copyright (c) 2002-2004, K A Fraser, B Dragovic | ||
41 | + * | ||
42 | + * This program is free software; you can redistribute it and/or | ||
43 | + * modify it under the terms of the GNU General Public License version 2 | ||
44 | + * as published by the Free Software Foundation; or, when distributed | ||
45 | + * separately from the Linux kernel or incorporated into other | ||
46 | + * software packages, subject to the following license: | ||
47 | + * | ||
48 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
49 | + * of this source file (the "Software"), to deal in the Software without | ||
50 | + * restriction, including without limitation the rights to use, copy, modify, | ||
51 | + * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
52 | + * and to permit persons to whom the Software is furnished to do so, subject to | ||
53 | + * the following conditions: | ||
54 | + * | ||
55 | + * The above copyright notice and this permission notice shall be included in | ||
56 | + * all copies or substantial portions of the Software. | ||
57 | + * | ||
58 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
59 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
60 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
61 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
62 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
63 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
64 | + * IN THE SOFTWARE. | ||
65 | + */ | ||
66 | + | ||
67 | +#include <linux/proc_fs.h> | ||
68 | +#include <linux/module.h> | ||
69 | +#include <asm/xen/hypervisor.h> | ||
70 | + | ||
71 | +static int capabilities_read(char *page, char **start, off_t off, | ||
72 | + int count, int *eof, void *data) | ||
73 | +{ | ||
74 | + int len = 0; | ||
75 | + *page = 0; | ||
76 | + | ||
77 | + if (is_initial_xendomain()) | ||
78 | + len = sprintf(page, "control_d\n"); | ||
79 | + | ||
80 | + *eof = 1; | ||
81 | + return len; | ||
82 | +} | ||
83 | + | ||
84 | +int __init capabilities_create_proc_entry(void) | ||
85 | +{ | ||
86 | + struct proc_dir_entry *entry; | ||
87 | + | ||
88 | + entry = create_proc_entry("xen/capabilities", 0400, NULL); | ||
89 | + if (!entry) | ||
90 | + return -ENOMEM; | ||
91 | + | ||
92 | + entry->owner = THIS_MODULE; | ||
93 | + entry->read_proc = capabilities_read; | ||
94 | + | ||
95 | + return 0; | ||
96 | +} | ||
97 | + | ||
98 | +void __exit capabilities_remove_proc_entry(void) | ||
99 | +{ | ||
100 | + remove_proc_entry("xen/capabilities", NULL); | ||
101 | +} | ||
102 | diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c | ||
103 | index 2965ceb..0e42f7e 100644 | ||
104 | --- a/drivers/xen/xenctrl/main.c | ||
105 | +++ b/drivers/xen/xenctrl/main.c | ||
106 | @@ -31,6 +31,8 @@ | ||
107 | * IN THE SOFTWARE. | ||
108 | */ | ||
109 | |||
110 | +#include "xenctrl.h" | ||
111 | + | ||
112 | #include <linux/proc_fs.h> | ||
113 | #include <linux/module.h> | ||
114 | #include <asm/xen/hypervisor.h> | ||
115 | @@ -38,6 +40,7 @@ | ||
116 | static int __init xenctrl_init(void) | ||
117 | { | ||
118 | struct proc_dir_entry *dir; | ||
119 | + int ret; | ||
120 | |||
121 | if (!is_running_on_xen()) | ||
122 | return -ENODEV; | ||
123 | @@ -48,11 +51,19 @@ static int __init xenctrl_init(void) | ||
124 | |||
125 | dir->owner = THIS_MODULE; | ||
126 | |||
127 | + ret = capabilities_create_proc_entry(); | ||
128 | + if (ret) | ||
129 | + goto fail1; | ||
130 | + | ||
131 | return 0; | ||
132 | + | ||
133 | + fail1: remove_proc_entry("xen", NULL); | ||
134 | + return ret; | ||
135 | } | ||
136 | |||
137 | static void __exit xenctrl_exit(void) | ||
138 | { | ||
139 | + capabilities_remove_proc_entry(); | ||
140 | remove_proc_entry("xen", NULL); | ||
141 | } | ||
142 | |||
143 | diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h | ||
144 | new file mode 100644 | ||
145 | index 0000000..7378dde | ||
146 | --- /dev/null | ||
147 | +++ b/drivers/xen/xenctrl/xenctrl.h | ||
148 | @@ -0,0 +1,39 @@ | ||
149 | +/****************************************************************************** | ||
150 | + * xenctl.h | ||
151 | + * | ||
152 | + * Xen userspace control interfaces | ||
153 | + * | ||
154 | + * Copyright (c) 2002-2004, K A Fraser, B Dragovic | ||
155 | + * | ||
156 | + * This program is free software; you can redistribute it and/or | ||
157 | + * modify it under the terms of the GNU General Public License version 2 | ||
158 | + * as published by the Free Software Foundation; or, when distributed | ||
159 | + * separately from the Linux kernel or incorporated into other | ||
160 | + * software packages, subject to the following license: | ||
161 | + * | ||
162 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
163 | + * of this source file (the "Software"), to deal in the Software without | ||
164 | + * restriction, including without limitation the rights to use, copy, modify, | ||
165 | + * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
166 | + * and to permit persons to whom the Software is furnished to do so, subject to | ||
167 | + * the following conditions: | ||
168 | + * | ||
169 | + * The above copyright notice and this permission notice shall be included in | ||
170 | + * all copies or substantial portions of the Software. | ||
171 | + * | ||
172 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
173 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
174 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
175 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
176 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
177 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
178 | + * IN THE SOFTWARE. | ||
179 | + */ | ||
180 | + | ||
181 | +#include <linux/init.h> | ||
182 | + | ||
183 | +/* | ||
184 | + * capabilities.c | ||
185 | + */ | ||
186 | +int capabilities_create_proc_entry(void) __init; | ||
187 | +void capabilities_remove_proc_entry(void) __exit; | ||
188 | -- | ||
189 | 1.5.4.1 | ||
190 |