diff options
author | Benjamin Berg <bberg@redhat.com> | 2022-04-01 18:28:01 +0200 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2022-04-01 18:28:01 +0200 |
commit | 65f2aa5c24956e72d2d49e2ed1396e281a794948 (patch) | |
tree | f5f931252c7511ccfc5f2a4e52a010d02c59d91d /src/freebsd | |
parent | 08e693a6cf02f9195f4809952e29acc8e37e53ce (diff) | |
download | upower-65f2aa5c24956e72d2d49e2ed1396e281a794948.tar.gz |
freebsd: Remove unused swap detection code
Diffstat (limited to 'src/freebsd')
-rw-r--r-- | src/freebsd/up-backend.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/freebsd/up-backend.c b/src/freebsd/up-backend.c index 774db54..2c69b00 100644 --- a/src/freebsd/up-backend.c +++ b/src/freebsd/up-backend.c @@ -24,7 +24,6 @@ #include <math.h> #include <stdio.h> #include <string.h> -#include <kvm.h> #include <fcntl.h> #include <limits.h> #include <unistd.h> @@ -345,41 +344,6 @@ up_backend_get_config (UpBackend *backend) return backend->priv->config; } -/* Return value: a percentage value */ -gfloat -up_backend_get_used_swap (UpBackend *backend) -{ - gfloat percent; - kvm_t *kd; - gchar errbuf[_POSIX2_LINE_MAX]; - int nswdev; - struct kvm_swap kvmsw[16]; - - kd = kvm_openfiles (NULL, NULL, NULL, O_RDONLY, errbuf); - if (kd == NULL) { - g_warning ("failed to open kvm: '%s'", errbuf); - return 0.0f; - } - - nswdev = kvm_getswapinfo (kd, kvmsw, 16, 0); - if (nswdev == 0) { - percent = 100.0f; - goto out; - } - if (nswdev < 0) { - g_warning ("failed to get swap info: '%s'", kvm_geterr (kd)); - percent = 0.0f; - goto out; - } - - percent = (gfloat) ((gfloat) ((gfloat) kvmsw[nswdev].ksw_used / (gfloat) kvmsw[nswdev].ksw_total) * 100.0f); - -out: - kvm_close (kd); - - return percent; -} - /** * up_backend_class_init: * @klass: The UpBackendClass |