Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen make read-only, and return sane values in b...



details:   https://anonhg.NetBSD.org/src/rev/c2214b9bfc06
branches:  trunk
changeset: 756190:c2214b9bfc06
user:      cherry <cherry%NetBSD.org@localhost>
date:      Thu Jul 08 14:19:53 2010 +0000

description:
make read-only, and return sane values in balloon related sysctl(7)
nodes when  'options XEN_BALLOON' is disabled.

diffstat:

 sys/arch/xen/xen/balloon.c |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 1b4b648870a8 -r c2214b9bfc06 sys/arch/xen/xen/balloon.c
--- a/sys/arch/xen/xen/balloon.c        Thu Jul 08 13:58:52 2010 +0000
+++ b/sys/arch/xen/xen/balloon.c        Thu Jul 08 14:19:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: balloon.c,v 1.1 2010/07/06 15:00:09 cherry Exp $ */
+/* $NetBSD: balloon.c,v 1.2 2010/07/08 14:19:53 cherry Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.1 2010/07/06 15:00:09 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.2 2010/07/08 14:19:53 cherry Exp $");
 
 #include <sys/inttypes.h>
 #include <sys/param.h>
@@ -782,7 +782,17 @@
                node_val = xenmem_get_currentreservation();
                node.sysctl_data = &node_val;
                return sysctl_lookup(SYSCTLFN_CALL(&node));
-
+#ifndef XEN_BALLOON /* Read only, if balloon is disabled */
+       } else if (strcmp(node.sysctl_name, "target") == 0) {
+               if (newp != NULL || newlen != 0) {
+                       return (EPERM);
+               }
+               node_val = xenmem_get_currentreservation();
+               node.sysctl_data = &node_val;
+               error = sysctl_lookup(SYSCTLFN_CALL(&node));
+               return error;
+       }
+#else
        } else if (strcmp(node.sysctl_name, "target") == 0) {
                node_val = * (int64_t *) rnode->sysctl_data;
                node.sysctl_data = &node_val;
@@ -826,6 +836,7 @@
 
                return 0;
        }
+#endif /* XEN_BALLOON */
 
        return EINVAL;
 }



Home | Main Index | Thread Index | Old Index