aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/sys-hypervisor.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-03-10 20:17:41 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-03-30 12:27:07 -0400
commita649b720614d5675dc402bef75a92576143fede7 (patch)
tree149d7daf4b6fc8ce4433b9a76bd0ef6ad09a4ba2 /drivers/xen/sys-hypervisor.c
parentcff7e81b3dd7c25cd2248cd7a04c5764552d5d55 (diff)
xen/sys/hypervisor: change writable_pt to features
/sys/hypervisor/properties/writable_pt was misnamed. Rename to features, expressed as a bit array in hex. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/sys-hypervisor.c')
-rw-r--r--drivers/xen/sys-hypervisor.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index cb29d1ccf0d9..1267d6fcc0c7 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -293,37 +293,48 @@ static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer)
293 293
294HYPERVISOR_ATTR_RO(pagesize); 294HYPERVISOR_ATTR_RO(pagesize);
295 295
296/* eventually there will be several more features to export */
297static ssize_t xen_feature_show(int index, char *buffer) 296static ssize_t xen_feature_show(int index, char *buffer)
298{ 297{
299 int ret = -ENOMEM; 298 ssize_t ret;
300 struct xen_feature_info *info; 299 struct xen_feature_info info;
301 300
302 info = kmalloc(sizeof(struct xen_feature_info), GFP_KERNEL); 301 info.submap_idx = index;
303 if (info) { 302 ret = HYPERVISOR_xen_version(XENVER_get_features, &info);
304 info->submap_idx = index; 303 if (!ret)
305 ret = HYPERVISOR_xen_version(XENVER_get_features, info); 304 ret = sprintf(buffer, "%08x", info.submap);
306 if (!ret)
307 ret = sprintf(buffer, "%d\n", info->submap);
308 kfree(info);
309 }
310 305
311 return ret; 306 return ret;
312} 307}
313 308
314static ssize_t writable_pt_show(struct hyp_sysfs_attr *attr, char *buffer) 309static ssize_t features_show(struct hyp_sysfs_attr *attr, char *buffer)
315{ 310{
316 return xen_feature_show(XENFEAT_writable_page_tables, buffer); 311 ssize_t len;
312 int i;
313
314 len = 0;
315 for (i = XENFEAT_NR_SUBMAPS-1; i >= 0; i--) {
316 int ret = xen_feature_show(i, buffer + len);
317 if (ret < 0) {
318 if (len == 0)
319 len = ret;
320 break;
321 }
322 len += ret;
323 }
324 if (len > 0)
325 buffer[len++] = '\n';
326
327 return len;
317} 328}
318 329
319HYPERVISOR_ATTR_RO(writable_pt); 330HYPERVISOR_ATTR_RO(features);
320 331
321static struct attribute *xen_properties_attrs[] = { 332static struct attribute *xen_properties_attrs[] = {
322 &capabilities_attr.attr, 333 &capabilities_attr.attr,
323 &changeset_attr.attr, 334 &changeset_attr.attr,
324 &virtual_start_attr.attr, 335 &virtual_start_attr.attr,
325 &pagesize_attr.attr, 336 &pagesize_attr.attr,
326 &writable_pt_attr.attr, 337 &features_attr.attr,
327 NULL 338 NULL
328}; 339};
329 340