]> xenbits.xen.org Git - xenclient/ioemu-pq.git/commitdiff
don't carp about a missing battery so much that /var/log fills up and xenstored dies.
authorJames Mckenzie <jamesmck@taoand.cam.xci-test.com>
Fri, 27 Nov 2009 22:32:45 +0000 (22:32 +0000)
committerJames Mckenzie <jamesmck@taoand.cam.xci-test.com>
Fri, 27 Nov 2009 22:32:45 +0000 (22:32 +0000)
master/dont-carp-about-a-missing-battery [new file with mode: 0644]
master/series

diff --git a/master/dont-carp-about-a-missing-battery b/master/dont-carp-about-a-missing-battery
new file mode 100644 (file)
index 0000000..cbc4f2c
--- /dev/null
@@ -0,0 +1,56 @@
+diff --git a/hw/xen_platform.c b/hw/xen_platform.c
+index 36610a4..8318192 100644
+--- a/hw/xen_platform.c
++++ b/hw/xen_platform.c
+@@ -36,7 +36,7 @@
+ static int drivers_blacklisted;
+ static uint16_t driver_product_version;
+-static int throttling_disabled;
++static int throttling_disabled = 1;
+ extern FILE *logfile;
+ static char log_buffer[4096];
+ static int log_buffer_off;
+diff --git a/xenstore.c b/xenstore.c
+index a298f40..85d1f0a 100644
+--- a/xenstore.c
++++ b/xenstore.c
+@@ -1384,7 +1384,7 @@ char *xenstore_device_model_read(int domid, const char *key, unsigned int *len)
+     return value;
+ }
+-static char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *len)
++static char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *len, int carp)
+ {
+     char *path = NULL, *value = NULL;
+     
+@@ -1392,7 +1392,7 @@ static char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *le
+         return NULL;
+     value = xs_read(xsh, XBT_NULL, path, len);
+-    if (value == NULL)
++    if (value == NULL && carp)
+         fprintf(logfile, "xs_read(%s): read error\n", path);
+     free(path);
+@@ -1404,7 +1404,7 @@ int xenstore_extended_power_mgmt_read_int(const char *key, int default_value)
+     int value = default_value;
+     char *buffer;
+-    buffer = xenstore_extended_power_mgmt_read(key, NULL);
++    buffer = xenstore_extended_power_mgmt_read(key, NULL, 1);
+     if ( buffer == NULL )
+         return value;
+@@ -1449,9 +1449,9 @@ xenstore_extended_power_mgmt_event_trigger(const char *key, const char *value)
+ char *xenstore_read_battery_data(int battery_status)
+ {
+     if ( battery_status == 1 )
+-        return xenstore_extended_power_mgmt_read("bst", NULL);
++        return xenstore_extended_power_mgmt_read("bst", NULL, 1);
+     else
+-        return xenstore_extended_power_mgmt_read("bif", NULL);
++        return xenstore_extended_power_mgmt_read("bif", NULL, 0);
+ }
+ /*
index 7a680eadcfaca3b376ea244f17c1dc568f5765b6..c865ac58f26dd9ba7272697d91aff62ef8ab8b14 100644 (file)
@@ -26,3 +26,4 @@ intel
 fix-imobile-mouse
 atapi-pass-through
 pv_driver_throttling_disabled
+dont-carp-about-a-missing-battery