[master][PATCH] Cleanup unused and overly complicated stuff in isys

Vratislav Podzimek vpodzime at redhat.com
Wed Nov 20 16:01:39 UTC 2013


We no longer need all these things.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 anaconda                    |   1 -
 pyanaconda/isys/Makefile.am |  10 +-
 pyanaconda/isys/__init__.py |  57 ++--
 pyanaconda/isys/iface.c     | 616 --------------------------------------------
 pyanaconda/isys/iface.h     | 178 -------------
 pyanaconda/isys/isys.c      | 103 --------
 pyanaconda/isys/isys.h      |   3 -
 pyanaconda/isys/log.c       | 219 ----------------
 pyanaconda/isys/log.h       |  54 ----
 pyanaconda/isys/mem.c       |  89 -------
 pyanaconda/isys/mem.h       |  32 ---
 pyanaconda/isys/vio.c       | 108 --------
 12 files changed, 36 insertions(+), 1434 deletions(-)
 delete mode 100644 pyanaconda/isys/iface.c
 delete mode 100644 pyanaconda/isys/iface.h
 delete mode 100644 pyanaconda/isys/log.c
 delete mode 100644 pyanaconda/isys/log.h
 delete mode 100644 pyanaconda/isys/mem.c
 delete mode 100644 pyanaconda/isys/mem.h
 delete mode 100644 pyanaconda/isys/vio.c

diff --git a/anaconda b/anaconda
index ca0c17e..78e8128 100755
--- a/anaconda
+++ b/anaconda
@@ -751,7 +751,6 @@ if __name__ == "__main__":
     from pyanaconda import product
 
     from pyanaconda import isys
-    isys.initLog()
 
     import signal, string
 
diff --git a/pyanaconda/isys/Makefile.am b/pyanaconda/isys/Makefile.am
index 21ac924..99b2223 100644
--- a/pyanaconda/isys/Makefile.am
+++ b/pyanaconda/isys/Makefile.am
@@ -20,17 +20,13 @@
 pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
 
 ISYS_SRCS = devices.c lang.c \
-            isofs.c linkdetect.c vio.c ethtool.c eddsupport.c iface.c \
-            auditd.c log.c mem.c
+            isofs.c linkdetect.c ethtool.c eddsupport.c
 
 dist_noinst_HEADERS = $(srcdir)/*.h
 
 ISYS_CFLAGS = -DVERSION_RELEASE='"$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)"' \
-              $(NETWORKMANAGER_CFLAGS) $(LIBNL_CFLAGS) $(LIBNM_GLIB_CFLAGS) \
-              $(SELINUX_CFLAGS)
-ISYS_LIBS   = $(RESOLV_LIBS) $(ZLIB_LIBS) \
-              $(DEVMAPPER_LIBS) $(SELINUX_LIBS) \
-              $(LIBNL_LIBS) $(LIBNM_GLIB_LIBS)
+              $(LIBNL_CFLAGS) $(GLIB_CFLAGS)
+ISYS_LIBS   = $(DEVMAPPER_LIBS) $(LIBNL_LIBS) $(GLIB_LIBS)
 
 isysdir     = $(pkgpyexecdir)/isys
 isys_PYTHON = $(srcdir)/*.py
diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index 9da3f62..2ba416a 100644
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -33,7 +33,6 @@ import os
 import os.path
 import socket
 import stat
-import posix
 import sys
 from pyanaconda import iutil
 import blivet.arch
@@ -56,22 +55,6 @@ else:
 MIN_GUI_RAM = MIN_RAM + GUI_INSTALL_EXTRA_RAM
 EARLY_SWAP_RAM = 896 * 1024
 
-## Get the amount of free space available under a directory path.
-# @param path The directory path to check.
-# @return The amount of free space available, in
-def pathSpaceAvailable(path):
-    return _isys.devSpaceFree(path)
-
-def modulesWithPaths():
-    mods = []
-    for modline in open("/proc/modules", "r"):
-        modName = modline.split(" ", 1)[0]
-        modInfo = iutil.execWithCapture("modinfo",
-                ["-F", "filename", modName]).splitlines()
-        modPaths = [ line.strip() for line in modInfo if line!="" ]
-        mods.extend(modPaths)
-    return mods
-
 def isPseudoTTY (fd):
     return _isys.isPseudoTTY (fd)
 
@@ -156,12 +139,38 @@ def set_system_date_time(year=None, month=None, day=None, hour=None, minute=None
     time_struct = time.struct_time((year, month, day, hour, minute, second, 0, 0, local))
     set_system_time(int(time.mktime(time_struct)))
 
-auditDaemon = _isys.auditdaemon
+def total_memory():
+    """Returns total system memory in kB (given to us by /proc/meminfo)"""
 
-handleSegv = _isys.handleSegv
+    with open("/proc/meminfo", "r") as fobj:
+        for line in fobj:
+            if not line.startswith("MemTotal"):
+                # we are only interested in the MemTotal: line
+                continue
+
+            fields = line.split()
+            if len(fields) != 3:
+                log.error("unknown format for MemTotal line in /proc/meminfo: %s", line.rstrip())
+                raise RuntimeError("unknown format for MemTotal line in /proc/meminfo: %s" % line.rstrip())
+
+            try:
+                memsize = int(fields[1])
+            except ValueError:
+                log.error("ivalid value of MemTotal /proc/meminfo: %s", fields[1])
+                raise RuntimeError("ivalid value of MemTotal /proc/meminfo: %s" % fields[1])
+
+            # Because /proc/meminfo only gives us the MemTotal (total physical
+            # RAM minus the kernel binary code), we need to round this
+            # up. Assuming every machine has the total RAM MB number divisible
+            # by 128.
+            memsize /= 1024;
+            memsize = (memsize / 128 + 1) * 128;
+            memsize *= 1024;
+
+            log.info("%d kB (%d MB) are available", memsize, memsize / 1024)
+            return memsize
+
+        log.error("MemTotal: line not found in /proc/meminfo")
+        raise RuntimeError("MemTotal: line not found in /proc/meminfo")
 
-printObject = _isys.printObject
-bind_textdomain_codeset = _isys.bind_textdomain_codeset
-isVioConsole = _isys.isVioConsole
-initLog = _isys.initLog
-total_memory = _isys.total_memory
+handleSegv = _isys.handleSegv
diff --git a/pyanaconda/isys/iface.c b/pyanaconda/isys/iface.c
deleted file mode 100644
index a933aec..0000000
--- a/pyanaconda/isys/iface.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * iface.c - Network interface configuration API
- *
- * Copyright (C) 2006, 2007, 2008  Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Author(s): David Cantrell <dcantrell at redhat.com>
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/utsname.h>
-#include <arpa/inet.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <signal.h>
-#include <netinet/in.h>
-
-#include <netlink/netlink.h>
-#include <netlink/socket.h>
-#include <netlink/route/rtnl.h>
-#include <netlink/route/route.h>
-#include <netlink/route/addr.h>
-#include <netlink/route/link.h>
-
-#include <glib.h>
-#include <NetworkManager.h>
-#include <nm-client.h>
-#include <nm-device.h>
-#include <nm-ip4-config.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-device-wifi.h>
-
-#include "isys.h"
-#include "iface.h"
-#include "log.h"
-
-/* Internal-only function prototypes. */
-static struct nl_handle *_iface_get_handle(void);
-static struct nl_cache *_iface_get_link_cache(struct nl_handle **);
-static int _iface_have_valid_addr(void *addr, int family, int length);
-static int _iface_redirect_io(char *device, int fd, int mode);
-
-/*
- * Return a libnl handle for NETLINK_ROUTE.
- */
-static struct nl_handle *_iface_get_handle(void) {
-    struct nl_handle *handle = NULL;
-
-    if ((handle = nl_handle_alloc()) == NULL) {
-        return NULL;
-    }
-
-    if (nl_connect(handle, NETLINK_ROUTE)) {
-        nl_handle_destroy(handle);
-        return NULL;
-    }
-
-    return handle;
-}
-
-/*
- * Return an NETLINK_ROUTE cache.
- */
-static struct nl_cache *_iface_get_link_cache(struct nl_handle **handle) {
-    struct nl_cache *cache = NULL;
-
-    if ((*handle = _iface_get_handle()) == NULL) {
-        return NULL;
-    }
-
-    if ((cache = rtnl_link_alloc_cache(*handle)) == NULL) {
-        nl_close(*handle);
-        nl_handle_destroy(*handle);
-        return NULL;
-    }
-
-    return cache;
-}
-
-/*
- * Determine if a struct in_addr or struct in6_addr contains a valid address.
- */
-static int _iface_have_valid_addr(void *addr, int family, int length) {
-    char buf[length+1];
-
-    if ((addr == NULL) || (family != AF_INET && family != AF_INET6)) {
-        return 0;
-    }
-
-    memset(buf, '\0', sizeof(buf));
-
-    if (inet_ntop(family, addr, buf, length) == NULL) {
-        return 0;
-    } else {
-        /* check for unknown addresses */
-        if (family == AF_INET) {
-            if (!strncmp(buf, "0.0.0.0", 7)) {
-                return 0;
-            }
-        } else if (family == AF_INET6) {
-            if (!strncmp(buf, "::", 2)) {
-                return 0;
-            }
-        }
-    }
-
-    return 1;
-}
-
-/*
- * Redirect I/O to another device (e.g., stdout to /dev/tty5)
- */
-int _iface_redirect_io(char *device, int fd, int mode) {
-    int io = -1;
-
-    if ((io = open(device, mode)) == -1) {
-        return 1;
-    }
-
-    if (close(fd) == -1) {
-        return 2;
-    }
-
-    if (dup2(io, fd) == -1) {
-        return 3;
-    }
-
-    if (close(io) == -1) {
-        return 4;
-    }
-
-    return 0;
-}
-
-/*
- * Given an interface name (e.g., eth0) and address family (e.g., AF_INET),
- * return the IP address in human readable format (i.e., the output from
- * inet_ntop()).  Return NULL for no match or error.
- */
-char *iface_ip2str(char *ifname, int family) {
-    int i;
-    NMClient *client = NULL;
-    NMIP4Config *ip4config = NULL;
-    NMIP4Address *ipaddr = NULL;
-    NMDevice *candidate = NULL;
-    struct in_addr tmp_addr;
-    const GPtrArray *devices;
-    const char *iface;
-    char ipstr[INET_ADDRSTRLEN+1];
-
-    if (ifname == NULL) {
-        return NULL;
-    }
-
-    /* DCFIXME: add IPv6 once NM gains support */
-    if (family != AF_INET) {
-        return NULL;
-    }
-
-    client = nm_client_new();
-    if (!client) {
-        return NULL;
-    }
-
-    if (! is_connected_state(nm_client_get_state(client))) {
-        g_object_unref(client);
-        return NULL;
-    }
-
-    devices = nm_client_get_devices(client);
-    for (i=0; i < devices->len; i++) {
-        candidate = g_ptr_array_index(devices, i);
-        iface = nm_device_get_iface(candidate);
-
-        if (nm_device_get_state(candidate) != NM_DEVICE_STATE_ACTIVATED)
-            continue;
-
-        if (!iface || strcmp(iface, ifname))
-            continue;
-
-        if (!(ip4config = nm_device_get_ip4_config(candidate)))
-            continue;
-
-        if (!(ipaddr = nm_ip4_config_get_addresses(ip4config)->data))
-            continue;
-
-        memset(&ipstr, '\0', sizeof(ipstr));
-        tmp_addr.s_addr = nm_ip4_address_get_address(ipaddr);
-
-        if (inet_ntop(AF_INET, &tmp_addr, ipstr, INET_ADDRSTRLEN) == NULL) {
-            g_object_unref(client);
-            return NULL;
-        }
-
-        g_object_unref(client);
-        return g_strdup(ipstr);
-    }
-
-    g_object_unref(client);
-    return NULL;
-}
-
-/* Given an interface's MAC address, return the name (e.g., eth0) in human
- * readable format.  Return NULL for no match
- */
-char *iface_mac2device(char *mac) {
-    struct nl_handle *handle = NULL;
-    struct nl_cache *cache = NULL;
-    struct rtnl_link *link = NULL;
-    struct nl_addr *mac_as_nl_addr = NULL;
-    char *retval = NULL;
-    int i, n;
-
-    if (mac == NULL) {
-        return NULL;
-    }
-
-    if ((mac_as_nl_addr = nl_addr_parse(mac, AF_LLC)) == NULL) {
-        return NULL;
-    }
-
-    if ((cache = _iface_get_link_cache(&handle)) == NULL) {
-        return NULL;
-    }
-
-    n = nl_cache_nitems(cache);
-    for (i = 0; i <= n; i++) {
-        struct nl_addr *addr;
-
-        if ((link = rtnl_link_get(cache, i)) == NULL) {
-            continue;
-        }
-
-        addr = rtnl_link_get_addr(link);
-
-        if (!nl_addr_cmp(mac_as_nl_addr, addr)) {
-            retval = strdup(rtnl_link_get_name(link));
-            rtnl_link_put(link);
-            break;
-        }
-
-        rtnl_link_put(link);
-    }
-
-    nl_close(handle);
-    nl_handle_destroy(handle);
-
-    return retval;
-}
-
-/*
- * Given an interface name (e.g., eth0), return the MAC address in human
- * readable format (e.g., 00:11:52:12:D9:A0).  Return NULL for no match.
- */
-char *iface_mac2str(char *ifname) {
-    int buflen = 20;
-    char *buf = NULL;
-    struct nl_handle *handle = NULL;
-    struct nl_cache *cache = NULL;
-    struct rtnl_link *link = NULL;
-    struct nl_addr *addr = NULL;
-
-    if (ifname == NULL) {
-        return NULL;
-    }
-
-    if ((cache = _iface_get_link_cache(&handle)) == NULL) {
-        return NULL;
-    }
-
-    if ((link = rtnl_link_get_by_name(cache, ifname)) == NULL) {
-        goto mac2str_error2;
-    }
-
-    if ((addr = rtnl_link_get_addr(link)) == NULL) {
-        goto mac2str_error3;
-    }
-
-    if ((buf = calloc(sizeof(char *), buflen)) == NULL) {
-        goto mac2str_error4;
-    }
-
-    if ((buf = nl_addr2str(addr, buf, buflen)) != NULL) {
-        char *oldbuf = buf;
-        buf = g_ascii_strup(buf, -1);
-        free(oldbuf);
-    }
-
-mac2str_error4:
-    nl_addr_destroy(addr);
-mac2str_error3:
-    rtnl_link_put(link);
-mac2str_error2:
-    nl_close(handle);
-    nl_handle_destroy(handle);
-
-    return buf;
-}
-
-/*
- * Convert an IPv4 CIDR prefix to a dotted-quad netmask.  Return NULL on
- * failure.
- */
-struct in_addr *iface_prefix2netmask(int prefix) {
-    int mask = 0;
-    char *buf = NULL;
-    struct in_addr *ret;
-
-    if ((buf = calloc(sizeof(char *), INET_ADDRSTRLEN + 1)) == NULL) {
-        return NULL;
-    }
-
-    mask = htonl(~((1 << (32 - prefix)) - 1));
-
-    if (inet_ntop(AF_INET, (struct in_addr *) &mask, buf,
-                  INET_ADDRSTRLEN) == NULL) {
-        return NULL;
-    }
-
-    if ((ret = calloc(sizeof(struct in_addr), 1)) == NULL) {
-        return NULL;
-    }
-
-    memcpy(ret, (struct in_addr *) &mask, sizeof(struct in_addr));
-    return ret;
-}
-
-/*
- * Initialize a new iface_t structure to default values.
- */
-void iface_init_iface_t(iface_t *iface) {
-    int i;
-
-    memset(&iface->device, '\0', sizeof(iface->device));
-    memset(&iface->ipaddr, 0, sizeof(iface->ipaddr));
-    memset(&iface->netmask, 0, sizeof(iface->netmask));
-    memset(&iface->broadcast, 0, sizeof(iface->broadcast));
-    memset(&iface->ip6addr, 0, sizeof(iface->ip6addr));
-    memset(&iface->gateway, 0, sizeof(iface->gateway));
-    memset(&iface->gateway6, 0, sizeof(iface->gateway6));
-
-    for (i = 0; i < MAXNS; i++) {
-        iface->dns[i] = NULL;
-    }
-
-    iface->macaddr = NULL;
-    iface->ip6prefix = 0;
-    iface->nextserver = NULL;
-    iface->bootfile = NULL;
-    iface->numdns = 0;
-    iface->hostname = NULL;
-    iface->domain = NULL;
-    iface->search = NULL;
-    iface->dhcptimeout = 0;
-    iface->vendorclass = NULL;
-    iface->ssid = NULL;
-    iface->wepkey = NULL;
-    iface->mtu = 0;
-    iface->subchannels = NULL;
-    iface->portname = NULL;
-    iface->peerid = NULL;
-    iface->nettype = NULL;
-    iface->ctcprot = NULL;
-    iface->options = NULL;
-    iface->flags = 0;
-    iface->ipv4method = IPV4_UNUSED_METHOD;
-    iface->ipv6method = IPV6_UNUSED_METHOD;
-    iface->defroute = 1;
-
-    return;
-}
-
-/*
- * Given a pointer to a struct in_addr, return 1 if it contains a valid
- * address, 0 otherwise.
- */
-int iface_have_in_addr(struct in_addr *addr) {
-    return _iface_have_valid_addr(addr, AF_INET, INET_ADDRSTRLEN);
-}
-
-/*
- * Given a pointer to a struct in6_addr, return 1 if it contains a valid
- * address, 0 otherwise.
- */
-int iface_have_in6_addr(struct in6_addr *addr6) {
-    return _iface_have_valid_addr(addr6, AF_INET6, INET6_ADDRSTRLEN);
-}
-
-int is_connected_state(NMState state) {
-    return (state == NM_STATE_CONNECTED_LOCAL ||
-            state == NM_STATE_CONNECTED_SITE ||
-            state == NM_STATE_CONNECTED_GLOBAL);
-}
-
-/* Check if NM has an active connection */
-gboolean is_nm_connected(void) {
-    NMState state;
-    NMClient *client = NULL;
-
-    client = nm_client_new();
-    if (!client)
-        return FALSE;
-
-    state = nm_client_get_state(client);
-    g_object_unref(client);
-
-    if (is_connected_state(state))
-        return TRUE;
-    else
-        return FALSE;
-}
-
-/* Check if NM is already running */
-gboolean is_nm_running(void) {
-    gboolean running;
-    NMClient *client = NULL;
-
-    client = nm_client_new();
-    if (!client)
-        return FALSE;
-
-    running = nm_client_get_manager_running(client);
-    g_object_unref(client);
-    return running;
-}
-
-gboolean is_iface_activated(char * ifname) {
-    int i, state;
-    NMClient *client = NULL;
-    const GPtrArray *devices;
-
-    client = nm_client_new();
-    if (!client)
-        return FALSE;
-
-    devices = nm_client_get_devices(client);
-    for (i = 0; i < devices->len; i++) {
-        NMDevice *candidate = g_ptr_array_index(devices, i);
-        const char *devname = nm_device_get_iface(candidate);
-        if (strcmp(ifname, devname))
-            continue;
-        state = nm_device_get_state(candidate);
-        g_object_unref(client);
-        if (state == NM_DEVICE_STATE_ACTIVATED)
-            return TRUE;
-        else
-            return FALSE;
-    }
-
-    g_object_unref(client);
-    return FALSE;
-}
-
-/*
- * Wait for NetworkManager to appear on the system bus
- */
-int wait_for_nm(void) {
-    int count = 0;
-
-    /* send message and block until a reply or error comes back */
-    while (count < 45) {
-        if (is_nm_running())
-            return 0;
-
-        sleep(1);
-        count++;
-    }
-
-    return 1;
-}
-
-/*
- * Start NetworkManager -- requires that you have already written out the
- * control files in /etc/sysconfig for the interface.
- */
-int iface_restart_NetworkManager(void) {
-    int child, status;
-
-    if (!(child = fork())) {
-
-        if (_iface_redirect_io("/dev/null", STDIN_FILENO, O_RDONLY) ||
-            _iface_redirect_io("/dev/tty3", STDOUT_FILENO, O_WRONLY) ||
-            _iface_redirect_io("/dev/tty3", STDERR_FILENO, O_WRONLY)) {
-            exit(253);
-        }
-
-        execl("/bin/systemctl", "/bin/systemctl", "restart", "NetworkManager.service", NULL);
-        exit(254);
-    } else if (child < 0) {
-        logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
-        return 1;
-    }
-
-    if (waitpid(child, &status, 0) == -1) {
-        logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
-        return 1;
-    }
-
-    if (!WIFEXITED(status)) {
-        logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
-        return 1;
-    }
-
-    if (WEXITSTATUS(status)) {
-        logMessage(ERROR, "failed to restart NetworkManager with status %d", WEXITSTATUS(status));
-        return 1;
-    } else {
-        return wait_for_nm();
-    }
-}
-
-/*
- * Start NetworkManager -- requires that you have already written out the
- * control files in /etc/sysconfig for the interface.
- * This is needed on s390 until we have systemd init doing it as for other archs.
- */
-int iface_start_NetworkManager(void) {
-    pid_t pid;
-
-    if (is_nm_running())
-        return 0;  /* already running */
-
-    /* Start NetworkManager */
-    pid = fork();
-    if (pid == 0) {
-        if (setpgrp() == -1) {
-            exit(1);
-        }
-
-        if (_iface_redirect_io("/dev/null", STDIN_FILENO, O_RDONLY) ||
-            _iface_redirect_io(OUTPUT_TERMINAL, STDOUT_FILENO, O_WRONLY) ||
-            _iface_redirect_io(OUTPUT_TERMINAL, STDERR_FILENO, O_WRONLY)) {
-            exit(2);
-        }
-
-        if (execl(NETWORKMANAGER, NETWORKMANAGER,
-                  "--pid-file=/var/run/NetworkManager/NetworkManager.pid",
-                  NULL) == -1) {
-            exit(3);
-        }
-    } else if (pid == -1) {
-        return 1;
-    } else {
-        return wait_for_nm();
-    }
-
-    return 0;
-}
-
-/*
- * Set the MTU on the specified device.
- */
-int iface_set_interface_mtu(char *ifname, int mtu) {
-    int ret = 0;
-    struct nl_handle *handle = NULL;
-    struct nl_cache *cache = NULL;
-    struct rtnl_link *link = NULL;
-    struct rtnl_link *request = NULL;
-
-    if (ifname == NULL) {
-        return -1;
-    }
-
-    if (mtu <= 0) {
-        return -2;
-    }
-
-    if ((cache = _iface_get_link_cache(&handle)) == NULL) {
-        return -3;
-    }
-
-    if ((link = rtnl_link_get_by_name(cache, ifname)) == NULL) {
-        ret = -4;
-        goto ifacemtu_error1;
-    }
-
-    request = rtnl_link_alloc();
-    rtnl_link_set_mtu(request, mtu);
-
-    if (rtnl_link_change(handle, link, request, 0)) {
-        ret = -5;
-        goto ifacemtu_error2;
-    }
-
-ifacemtu_error2:
-    rtnl_link_put(link);
-ifacemtu_error1:
-    nl_close(handle);
-    nl_handle_destroy(handle);
-
-    return ret;
-}
-
diff --git a/pyanaconda/isys/iface.h b/pyanaconda/isys/iface.h
deleted file mode 100644
index c4167b0..0000000
--- a/pyanaconda/isys/iface.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * iface.h - Network interface configuration API
- *
- * Copyright (C) 2006, 2007, 2008  Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Author(s): David Cantrell <dcantrell at redhat.com>
- */
-
-#ifndef ISYSIFACE_H
-#define ISYSIFACE_H
-
-#include <resolv.h>
-#include <net/if.h>
-#include <netlink/cache.h>
-#include <netlink/socket.h>
-#include <glib.h>
-#include <NetworkManager.h>
-
-/* Enumerated types used in iface.c */
-enum { IPUNUSED = -1, IPV4, IPV6 };
-
-enum { IPV4_UNUSED_METHOD, IPV4_DHCP_METHOD, IPV4_MANUAL_METHOD, IPV4_IBFT_METHOD, IPV4_IBFT_DHCP_METHOD };
-enum { IPV6_UNUSED_METHOD, IPV6_AUTO_METHOD, IPV6_DHCP_METHOD,
-       IPV6_MANUAL_METHOD };
-
-#define IPV4_FIRST_METHOD IPV4_DHCP_METHOD
-#define IPV4_LAST_METHOD  IPV4_MANUAL_METHOD
-
-#define IPV6_FIRST_METHOD IPV6_AUTO_METHOD
-#define IPV6_LAST_METHOD  IPV6_MANUAL_METHOD
-
-/* Flags for the iface_t (do we need these?) */
-#define IFACE_FLAGS_NO_WRITE_RESOLV_CONF (((uint64_t) 1) << 0)
-#define IFACE_NO_WRITE_RESOLV_CONF(a)    ((a) & IFACE_FLAGS_NO_WRITE_RESOLV_CONF)
-
-/* Macros for starting NetworkManager */
-#define NETWORKMANAGER  "/usr/sbin/NetworkManager"
-
-/* Per-interface configuration information */
-typedef struct _iface_t {
-    /* device name (e.g., eth0) */
-    char device[IF_NAMESIZE];
-
-    /* MAC address as xx:xx:xx:xx:xx:xx */
-    char *macaddr;
-
-    /* IPv4 (store addresses in in_addr format, use inet_pton() to display) */
-    struct in_addr ipaddr;
-    struct in_addr netmask;
-    struct in_addr broadcast;
-
-    /* IPv6 (store addresses in in6_addr format, prefix is just an int) */
-    struct in6_addr ip6addr;
-    int ip6prefix;
-
-    /* Gateway settings */
-    struct in_addr gateway;
-    struct in6_addr gateway6;
-    int defroute;
-
-    /* BOOTP (these can be IPv4 or IPv6, store human-readable version as str) */
-    char *nextserver;
-    char *bootfile;
-
-    /* DNS (these can be IPv4 or IPv6, store human-readable version as str) */
-    char *dns[MAXNS];
-    int numdns;
-    char *hostname;
-    char *domain;
-    char *search;
-
-    /* Misc DHCP settings */
-    int dhcptimeout;
-    char *vendorclass;
-
-    /* Wireless settings */
-    char *ssid;
-    char *wepkey;
-
-    /* s390 specifics */
-    int mtu;
-    char *subchannels;
-    char *portname;
-    char *peerid;
-    char *nettype;
-    char *ctcprot;
-    char *options;
-
-    /* flags */
-    uint64_t flags;
-    int ipv4method;
-    int ipv6method;
-} iface_t;
-
-/* Function prototypes */
-
-/*
- * Given an interface name (e.g., eth0) and address family (e.g., AF_INET),
- * return the IP address in human readable format (i.e., the output from
- * inet_ntop()).  Return NULL for no match or error.
- */
-char *iface_ip2str(char *, int);
-
-/*
- * Given an interface name (e.g., eth0), return the MAC address in human
- * readable format (e.g., 00:11:52:12:D9:A0).  Return NULL for no match.
- */
-char *iface_mac2str(char *);
-
-/* Given an interface's MAC address, return the name (e.g., eth0) in human
- * readable format.  Return NULL for no match
- */
-char *iface_mac2device(char *);
-
-/*
- * Convert an IPv4 CIDR prefix to a dotted-quad netmask.  Return NULL on
- * failure.
- */
-struct in_addr *iface_prefix2netmask(int);
-
-/*
- * Initialize a new iface_t structure to default values.
- */
-void iface_init_iface_t(iface_t *);
-
-/*
- * Given a pointer to a struct in_addr, return 1 if it contains a valid
- * address, 0 otherwise.
- */
-int iface_have_in_addr(struct in_addr *addr);
-
-/*
- * Given a pointer to a struct in6_addr, return 1 if it contains a valid
- * address, 0 otherwise.
- */
-int iface_have_in6_addr(struct in6_addr *addr6);
-
-/*
- * Checks if NetworkManager has an active connection.
- */
-gboolean is_nm_connected(void);
-
-gboolean is_iface_activated(char * ifname);
-
-/*
- * Start NetworkManager
- */
-int iface_start_NetworkManager(void);
-
-/*
- * Restart NetworkManager
- */
-int iface_restart_NetworkManager(void);
-
-/*
- * Set Maximum Transfer Unit (MTU) on specified interface
- */
-int iface_set_interface_mtu(char *ifname, int mtu);
-
-/*
- * Checks if the state means nm is connected
- */
-int is_connected_state(NMState state);
-
-#endif /* ISYSIFACE_H */
diff --git a/pyanaconda/isys/isys.c b/pyanaconda/isys/isys.c
index ce81d1f..e22a754 100644
--- a/pyanaconda/isys/isys.c
+++ b/pyanaconda/isys/isys.c
@@ -47,7 +47,6 @@
 #include <sys/utsname.h>
 #include <sys/vfs.h>
 #include <unistd.h>
-#include <resolv.h>
 #include <sys/vt.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -68,46 +67,28 @@
 #include <sys/sysmacros.h>
 #endif
 
-#include "iface.h"
 #include "isys.h"
 #include "ethtool.h"
 #include "lang.h"
 #include "eddsupport.h"
-#include "auditd.h"
-#include "log.h"
-#include "mem.h"
 
 #ifndef CDROMEJECT
 #define CDROMEJECT 0x5309
 #endif
 
-static PyObject * doDevSpaceFree(PyObject * s, PyObject * args);
 static PyObject * doisPseudoTTY(PyObject * s, PyObject * args);
-static PyObject * doisVioConsole(PyObject * s);
 static PyObject * doSync(PyObject * s, PyObject * args);
 static PyObject * doisIsoImage(PyObject * s, PyObject * args);
-static PyObject * printObject(PyObject * s, PyObject * args);
-static PyObject * py_bind_textdomain_codeset(PyObject * o, PyObject * args);
 static PyObject * doSegvHandler(PyObject *s, PyObject *args);
-static PyObject * doAuditDaemon(PyObject *s);
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args);
-static PyObject * doInitLog(PyObject * s);
-static PyObject * doTotalMemory(PyObject * s);
 static PyObject * doSetSystemTime(PyObject *s, PyObject *args);
 
 static PyMethodDef isysModuleMethods[] = {
-    { "devSpaceFree", (PyCFunction) doDevSpaceFree, METH_VARARGS, NULL },
     { "isPseudoTTY", (PyCFunction) doisPseudoTTY, METH_VARARGS, NULL},
-    { "isVioConsole", (PyCFunction) doisVioConsole, METH_NOARGS, NULL},
     { "sync", (PyCFunction) doSync, METH_VARARGS, NULL},
     { "isisoimage", (PyCFunction) doisIsoImage, METH_VARARGS, NULL},
-    { "printObject", (PyCFunction) printObject, METH_VARARGS, NULL},
-    { "bind_textdomain_codeset", (PyCFunction) py_bind_textdomain_codeset, METH_VARARGS, NULL},
     { "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
-    { "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
     { "getAnacondaVersion", (PyCFunction) doGetAnacondaVersion, METH_VARARGS, NULL },
-    { "initLog", (PyCFunction) doInitLog, METH_VARARGS, NULL },
-    { "total_memory", (PyCFunction) doTotalMemory, METH_NOARGS, NULL },
     { "set_system_time", (PyCFunction) doSetSystemTime, METH_VARARGS, NULL},
     { NULL, NULL, 0, NULL }
 } ;
@@ -119,40 +100,6 @@ void init_isys(void) {
     Py_InitModule("_isys", isysModuleMethods);
 }
 
-static int get_bits(unsigned long long v) {
-    int  b = 0;
-    
-    if ( v & 0xffffffff00000000LLU ) { b += 32; v >>= 32; }
-    if ( v & 0xffff0000LLU ) { b += 16; v >>= 16; }
-    if ( v & 0xff00LLU ) { b += 8; v >>= 8; }
-    if ( v & 0xf0LLU ) { b += 4; v >>= 4; }
-    if ( v & 0xcLLU ) { b += 2; v >>= 2; }
-    if ( v & 0x2LLU ) b++;
-    
-    return v ? b + 1 : b;
-}
-
-static PyObject * doDevSpaceFree(PyObject * s, PyObject * args) {
-    char * path;
-    struct statfs sb;
-    unsigned long long size;
-
-    if (!PyArg_ParseTuple(args, "s", &path)) return NULL;
-
-    if (statfs(path, &sb)) {
-	PyErr_SetFromErrno(PyExc_SystemError);
-	return NULL;
-    }
-
-    /* Calculate a saturated addition to prevent oveflow. */
-    if ( get_bits(sb.f_bfree) + get_bits(sb.f_bsize) <= 64 )
-        size = (unsigned long long)sb.f_bfree * sb.f_bsize;
-    else
-        size = ~0LLU;
-
-    return PyLong_FromUnsignedLongLong(size>>20);
-}
-
 static PyObject * doisPseudoTTY(PyObject * s, PyObject * args) {
     int fd;
     struct stat sb;
@@ -164,10 +111,6 @@ static PyObject * doisPseudoTTY(PyObject * s, PyObject * args) {
     return Py_BuildValue("i", ((major(sb.st_rdev) >= 136) && (major(sb.st_rdev) <= 143)));
 }
 
-static PyObject * doisVioConsole(PyObject * s) {
-    return Py_BuildValue("i", isVioConsole());
-}
-
 static PyObject * doSync(PyObject * s, PyObject * args) {
     int fd;
 
@@ -191,35 +134,6 @@ static PyObject * doisIsoImage(PyObject * s, PyObject * args) {
     return Py_BuildValue("i", rc);
 }
 
-static PyObject * printObject (PyObject * o, PyObject * args) {
-    PyObject * obj;
-    char buf[256];
-
-    if (!PyArg_ParseTuple(args, "O", &obj))
-	return NULL;
-    
-    snprintf(buf, 256, "<%s object at %lx>", obj->ob_type->tp_name,
-	     (long) obj);
-
-    return PyString_FromString(buf);
-}
-
-static PyObject *
-py_bind_textdomain_codeset(PyObject * o, PyObject * args) {
-    char *domain, *codeset, *ret;
-	
-    if (!PyArg_ParseTuple(args, "ss", &domain, &codeset))
-	return NULL;
-
-    ret = bind_textdomain_codeset(domain, codeset);
-
-    if (ret)
-	return PyString_FromString(ret);
-
-    PyErr_SetFromErrno(PyExc_SystemError);
-    return NULL;
-}
-
 static PyObject * doSegvHandler(PyObject *s, PyObject *args) {
     void *array[20];
     size_t size;
@@ -239,27 +153,10 @@ static PyObject * doSegvHandler(PyObject *s, PyObject *args) {
     exit(1);
 }
 
-static PyObject * doAuditDaemon(PyObject *s) {
-    audit_daemonize();
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args) {
     return Py_BuildValue("s", VERSION_RELEASE);
 }
 
-static PyObject * doInitLog(PyObject * s) {
-    openLog();
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-static PyObject * doTotalMemory(PyObject * s) {
-    unsigned long long tm = totalMemory();
-    return PyLong_FromUnsignedLongLong(tm);
-}
-
 static PyObject * doSetSystemTime(PyObject *s, PyObject  *args) {
     struct timeval tv;
     tv.tv_usec = 0;
diff --git a/pyanaconda/isys/isys.h b/pyanaconda/isys/isys.h
index 980a872..ad31f7b 100644
--- a/pyanaconda/isys/isys.h
+++ b/pyanaconda/isys/isys.h
@@ -28,7 +28,4 @@ int rmmod(char * modName);
 /* returns 0 for true, !0 for false */
 int fileIsIso(const char * file);
 
-/* returns 1 if on an iSeries vio console, 0 otherwise */
-int isVioConsole(void);
-
 #endif
diff --git a/pyanaconda/isys/log.c b/pyanaconda/isys/log.c
deleted file mode 100644
index a796ea5..0000000
--- a/pyanaconda/isys/log.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * log.c - logging functionality
- *
- * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Author(s): Erik Troan <ewt at redhat.com>
- *            Matt Wilson <msw at redhat.com>
- *            Michael Fulbright <msf at redhat.com>
- *            Jeremy Katz <katzj at redhat.com>
- */
-
-#include "config.h"
-
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <syslog.h>
-
-#include "log.h"
-
-static FILE * main_log_tty = NULL;
-static FILE * main_log_file = NULL;
-static FILE * program_log_file = NULL;
-static loglevel_t minLevel = INFO;
-static const char * main_tag = "anaconda";
-static const char * program_tag = "program";
-static const int syslog_facility = LOG_LOCAL1;
-
-/* maps our loglevel to syslog loglevel */
-static int mapLogLevel(loglevel_t level)
-{
-    switch (level) {
-    case DEBUGLVL:
-        return LOG_DEBUG;
-    case INFO:
-        return LOG_INFO;
-    case WARNING:
-        return LOG_WARNING;
-    case CRITICAL:
-        return LOG_CRIT;
-    case ERROR:
-    default:
-        /* if someone called us with an invalid level value, log it as an error
-           too. */
-        return LOG_ERR;
-    }
-}
-
-const char *log_level_to_str[] = {
-    [DEBUGLVL] = "DEBUG",
-    [INFO] = "INFO",
-    [WARNING] = "WARN",
-    [ERROR] = "ERR",
-    [CRITICAL] = "CRIT"
-};
-
-static void printLogHeader(loglevel_t level, const char *tag, FILE *outfile) {
-    struct timeval current_time;
-    struct tm *t;
-    int msecs;
-    const char *level_name;
-
-    gettimeofday(&current_time, NULL);
-    t = gmtime(&current_time.tv_sec);
-    msecs = current_time.tv_usec / 1000;
-    level_name = log_level_to_str[level];
-    fprintf(outfile, "%02d:%02d:%02d,%03d %s %s: ", t->tm_hour,
-            t->tm_min, t->tm_sec, msecs, level_name, tag);
-}
-
-static void printLogMessage(loglevel_t level, const char *tag, FILE *outfile, const char *s, va_list ap)
-{
-    printLogHeader(level, tag, outfile);
-
-    va_list apc;
-    va_copy(apc, ap);
-    vfprintf(outfile, s, apc);
-    va_end(apc);
-
-    fprintf(outfile, "\n");
-    fflush(outfile);
-}
-
-static void retagSyslog(const char* new_tag)
-{
-    closelog();
-    openlog(new_tag, 0, syslog_facility);
-}
-
-void logMessageV(enum logger_t logger, loglevel_t level, const char * s, va_list ap) {
-    FILE *log_tty = main_log_tty;
-    FILE *log_file = main_log_file;
-    const char *tag = main_tag;
-    if (logger == PROGRAM_LOG) {
-        /* tty output is done directly for programs */
-        log_tty = NULL;
-        log_file = program_log_file;
-        tag = program_tag;
-        /* close and reopen syslog so we get the tagging right */
-        retagSyslog(tag);
-    }
-
-    va_list apc;
-    /* Log everything into syslog */
-    va_copy(apc, ap);
-    vsyslog(mapLogLevel(level), s, apc);
-    va_end(apc);
-
-    /* Only log to the screen things that are above the minimum level. */
-    if (main_log_tty && level >= minLevel && log_tty) {
-        printLogMessage(level, tag, log_tty, s, ap);
-    }
-
-    /* But log everything to the file. */
-    if (main_log_file) {
-        printLogMessage(level, tag, log_file, s, ap);
-    }
-
-    /* change the syslog tag back to the default again */
-    if (logger == PROGRAM_LOG)
-        retagSyslog(main_tag);
-}
-
-void logMessage(loglevel_t level, const char * s, ...) {
-    va_list args;
-
-    va_start(args, s);
-    logMessageV(MAIN_LOG, level, s, args);
-    va_end(args);
-}
-
-void logProgramMessage(loglevel_t level, const char * s, ...) {
-    va_list args;
-
-    va_start(args, s);
-    logMessageV(PROGRAM_LOG, level, s, args);
-    va_end(args);
-}
-
-int tty_logfd = -1;
-int file_logfd = -1;
-
-void openLog() {
-    /* init syslog logging (so log messages can also be forwarded to a remote
-       syslog daemon */
-    openlog(main_tag, 0, syslog_facility);
-
-    int flags;
-    main_log_tty = fopen("/dev/tty3", "a");
-    main_log_file = fopen("/tmp/anaconda.log", "a");
-    program_log_file = fopen("/tmp/program.log", "a");
-
-    if (main_log_tty) {
-        tty_logfd = fileno(main_log_tty);
-        flags = fcntl(tty_logfd, F_GETFD, 0) | FD_CLOEXEC;
-        fcntl(tty_logfd, F_SETFD, flags);
-    }
-
-    if (main_log_file) {
-        file_logfd = fileno(main_log_file);
-        flags = fcntl(file_logfd, F_GETFD, 0) | FD_CLOEXEC;
-        fcntl(file_logfd, F_SETFD, flags);
-    }
-    
-    if (program_log_file) {
-        int fd;
-        fd = fileno(program_log_file);
-        flags = fcntl(fd, F_GETFD, 0) | FD_CLOEXEC;
-        fcntl(file_logfd, F_SETFD, flags);
-    }
-}
-
-void closeLog(void) {
-    if (main_log_tty)
-        fclose(main_log_tty);
-    if (main_log_file)
-        fclose(main_log_file);
-    if (program_log_file)
-        fclose(program_log_file);
-    main_log_tty = main_log_file = program_log_file = NULL;
-    
-    /* close syslog logger */
-    closelog();
-}
-
-/* set the level.  higher means you see more verbosity */
-void setLogLevel(loglevel_t level) {
-    minLevel = level;
-}
-
-loglevel_t getLogLevel(void) {
-    return minLevel;
-}
-
-/* returns non-null if logging has been initialized */
-int loggingReady(void)
-{
-    return main_log_tty != NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/pyanaconda/isys/log.h b/pyanaconda/isys/log.h
deleted file mode 100644
index 2ff0d53..0000000
--- a/pyanaconda/isys/log.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * log.h
- *
- * Copyright (C) 2007  Red Hat, Inc.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _LOG_H_
-#define _LOG_H_
-
-#include <stdio.h>
-#include <stdarg.h>
-
-typedef enum {
-    DEBUGLVL,
-    INFO,
-    WARNING,
-    ERROR,
-    CRITICAL
-} loglevel_t;
-
-enum logger_t {
-    MAIN_LOG = 1,
-    PROGRAM_LOG = 2
-};
-
-void logMessageV(enum logger_t logger, loglevel_t level, const char * s, va_list ap)
-    __attribute__ ((format (printf, 3, 0)));
-void logMessage(loglevel_t level, const char * s, ...)
-    __attribute__ ((format (printf, 2, 3)));
-void logProgramMessage(loglevel_t level, const char * s, ...)
-    __attribute__ ((format (printf, 2, 3)));
-void openLog();
-void closeLog(void);
-void setLogLevel(loglevel_t minLevel);
-loglevel_t getLogLevel(void);
-int loggingReady(void);
-
-extern int tty_logfd;
-extern int file_logfd;
-
-#endif /* _LOG_H_ */
diff --git a/pyanaconda/isys/mem.c b/pyanaconda/isys/mem.c
deleted file mode 100644
index eb2bc14..0000000
--- a/pyanaconda/isys/mem.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * mem.c - memory checking
- *
- * Copyright (C) 2010-2011  Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Red Hat Author(s): Ales Kozumplik <akozumpl at redhat.com>
- *                    David Cantrell <dcantrell at redhat.com>
- */
-
-#include "config.h"
-
-#include <errno.h>
-#include <glib.h>
-#include <stdlib.h>
-
-#include "mem.h"
-#include "log.h"
-
-/* report total system memory in kB (given to us by /proc/meminfo) */
-guint64 totalMemory(void) {
-    int i = 0, len = 0;
-    guint64 total = 0;
-    unsigned long long int dtotal = 0;
-    gchar *contents = NULL;
-    gchar **lines = NULL, **fields = NULL;
-    GError *fileErr = NULL;
-
-    if (!g_file_get_contents(MEMINFO, &contents, NULL, &fileErr)) {
-        logMessage(ERROR, "error reading %s: %s", MEMINFO, fileErr->message);
-        g_error_free(fileErr);
-        return total;
-    }
-
-    lines = g_strsplit(contents, "\n", 0);
-    g_free(contents);
-
-    for (i = 0; i < g_strv_length(lines); i++) {
-        if (g_str_has_prefix(lines[i], "MemTotal:")) {
-            fields = g_strsplit(lines[i], " ", 0);
-            len = g_strv_length(fields);
-
-            if (len < 3) {
-                logMessage(ERROR, "unknown format for MemTotal line in %s", MEMINFO);
-                g_strfreev(fields);
-                g_strfreev(lines);
-                return total;
-            }
-
-            errno = 0;
-            total = g_ascii_strtoull(fields[len - 2], NULL, 10);
-
-            if ((errno == ERANGE && total == G_MAXUINT64) ||
-                (errno == EINVAL && total == 0)) {
-                logMessage(ERROR, "%s: %d: %m", __func__, __LINE__);
-                abort();
-            }
-
-            g_strfreev(fields);
-            break;
-        }
-    }
-
-    /* Because /proc/meminfo only gives us the MemTotal (total physical RAM
-     * minus the kernel binary code), we need to round this up. Assuming
-     * every machine has the total RAM MB number divisible by 128. */
-    total /= 1024;
-    total = (total / 128 + 1) * 128;
-    total *= 1024;
-
-    dtotal = total;
-    logMessage(INFO, "%lld kB (%lld MB) are available", dtotal, dtotal / 1024);
-
-    return total;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/pyanaconda/isys/mem.h b/pyanaconda/isys/mem.h
deleted file mode 100644
index 9a5eaa3..0000000
--- a/pyanaconda/isys/mem.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * mem.h
- *
- * Copyright (C) 2010-2011  Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Red Hat Author(s): Ales Kozumplik <akozumpl at redhat.com>
- *                    David Cantrell <dcantrell at redhat.com>
- */
-
-#ifndef _MEM_H_
-#define _MEM_H_
-
-#include <glib.h>
-
-#define MEMINFO "/proc/meminfo"
-
-guint64 totalMemory(void);
-
-#endif /* _MEM_H_ */
diff --git a/pyanaconda/isys/vio.c b/pyanaconda/isys/vio.c
deleted file mode 100644
index c6e72a6..0000000
--- a/pyanaconda/isys/vio.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * vio.c - probing for vio devices on the iSeries (viocd and viodasd)
- *
- * Copyright (C) 2003  Red Hat, Inc.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Author(s): Jeremy Katz <katzj at redhat.com>
- */
-
-#include "config.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if defined(__powerpc__)
-static int readFD (int fd, char **buf)
-{
-    char *p;
-    size_t size = 4096;
-    int s, filesize;
-
-    *buf = malloc (size);
-    if (*buf == 0)
-	return -1;
-
-    filesize = 0;
-    do {
-	p = &(*buf) [filesize];
-	s = read (fd, p, 4096);
-	if (s < 0)
-	    break;
-	filesize += s;
-	if (s == 0)
-	    break;
-	size += 4096;
-	*buf = realloc (*buf, size);
-    } while (1);
-
-    if (filesize == 0 && s < 0) {
-	free (*buf);
-	*buf = NULL;
-	return -1;
-    }
-
-    return filesize;
-}
-#endif
-
-int isVioConsole(void) {
-#if !defined(__powerpc__)
-    return 0;
-#else
-    int fd, i;
-    char *buf, *start;
-    char driver[50], device[50];
-    static int isviocons = -1;
-
-    if (isviocons != -1)
-	return isviocons;
-    
-    fd = open("/proc/tty/drivers", O_RDONLY);
-    if (fd < 0) {
-	fprintf(stderr, "failed to open /proc/tty/drivers!\n");
-	return 0;
-    }
-    i = readFD(fd, &buf);
-    if (i < 1) {
-        close(fd);
-	fprintf(stderr, "error reading /proc/tty/drivers!\n");
-        return 0;
-    }
-    close(fd);
-    buf[i] = '\0';
-
-    isviocons = 0;
-    start = buf;
-    while (start && *start) {
-	if (sscanf(start, "%s %s", (char *) &driver, (char *) &device) == 2) {
-	    if (!strcmp(driver, "vioconsole") && !strcmp(device, "/dev/tty")) {
-		isviocons = 1;
-		break;
-	    }
-	}		
-        start = strchr(start, '\n');
-        if (start)
-	    start++;
-    }
-    free(buf);
-    return isviocons;
-#endif
-}
-- 
1.8.4.2



More information about the anaconda-patches mailing list