summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2010-02-19 10:21:33 -1000
committerDavid Cantrell <dcantrell@redhat.com>2010-02-22 14:01:57 -1000
commitc8242ec21ee4727247e214defd1167dfc75fcbd1 (patch)
tree69d5e9c5bb191d27a8e37788199fbd930567a424 /isys
parentf6f1326dd20b24c4b6dcaf6c5fcc233debc566c6 (diff)
downloadanaconda-c8242ec21ee4727247e214defd1167dfc75fcbd1.tar.gz
anaconda-c8242ec21ee4727247e214defd1167dfc75fcbd1.tar.xz
anaconda-c8242ec21ee4727247e214defd1167dfc75fcbd1.zip
Remove isys/dasd.c, functions no longer needed in isys.
Remove the dasd.c file from the isys source tree. The only function that was still used was getDasdPorts() and it is only called by Python code, so we can move that functionality in to Python.
Diffstat (limited to 'isys')
-rw-r--r--isys/Makefile.am2
-rw-r--r--isys/dasd.c180
-rw-r--r--isys/isys.c27
-rw-r--r--isys/isys.h5
-rwxr-xr-xisys/isys.py9
5 files changed, 1 insertions, 222 deletions
diff --git a/isys/Makefile.am b/isys/Makefile.am
index f7c076a26..32ba64cd9 100644
--- a/isys/Makefile.am
+++ b/isys/Makefile.am
@@ -17,7 +17,7 @@
#
# Author: David Cantrell <dcantrell@redhat.com>
-ISYS_SRCS = devices.c imount.c cpio.c uncpio.c dasd.c lang.c \
+ISYS_SRCS = devices.c imount.c cpio.c uncpio.c lang.c \
isofs.c linkdetect.c vio.c ethtool.c eddsupport.c iface.c \
str.c auditd.c
diff --git a/isys/dasd.c b/isys/dasd.c
deleted file mode 100644
index 726281aca..000000000
--- a/isys/dasd.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * dasd.c
- *
- * 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/>.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <linux/fs.h>
-
-#include "isys.h"
-
-#if defined(__s390__) || defined(__s390x__)
-#define u8 __u8
-#define u16 __u16
-#define u32 __u32
-#define u64 __u64
-#include <s390utils/vtoc.h>
-#include <asm/dasd.h>
-#endif
-
-#if defined(__s390__) || defined(__s390x__)
-/* s390 stuff to detect DASDs */
-static int read_vlabel(dasd_information_t *dasd_info, int fd, int blksize,
- volume_label_t *vlabel) {
- int rc;
- unsigned long vlabel_start = dasd_info->label_block * blksize;
-
- memset(vlabel, 0, sizeof(volume_label_t));
-
- if (lseek(fd, vlabel_start, SEEK_SET) < 0) {
- return 2;
- }
-
- rc = read(fd, vlabel, sizeof(volume_label_t));
- if (rc != sizeof(volume_label_t)) {
- return 1;
- }
-
- return 0;
-}
-#endif
-
-int isUsableDasd(char *device) {
-#if !defined(__s390__) && !defined(__s390x__)
- return 0;
-#else
- char devname[16];
- char label[5], v4_hex[9];
- char l4ebcdic_hex[] = "d3d5e7f1"; /* LNX1 */
- char cms1_hex[] = "c3d4e2f1"; /* CMS1 */
- int f, ret, blksize;
- dasd_information_t dasd_info;
- volume_label_t vlabel;
-
- memset(&dasd_info, 0, sizeof(dasd_info));
- strcpy(devname, "/dev/");
- strcat(devname, device);
-
- if ((f = open(devname, O_RDONLY)) == -1)
- return 0;
-
- if (ioctl(f, BLKSSZGET, &blksize) != 0) {
- close(f);
- return 0;
- }
-
- if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
- close(f);
- return 0;
- }
-
- ret = read_vlabel(&dasd_info, f, blksize, &vlabel);
- close(f);
-
- if (ret == 2)
- return 0;
- else if (ret == 1) /* probably unformatted DASD */
- return 1;
-
- memset(label, 0, 5);
- memset(v4_hex, 0, 9);
- strncpy(label, vlabel.volkey, 4);
-
- ret = sprintf(v4_hex, "%02x%02x%02x%02x", label[0], label[1],
- label[2], label[3]);
- if (ret < 0 || ret < strlen(cms1_hex))
- return 3;
-
- if (!strncmp(v4_hex, cms1_hex, 9))
- return 0;
-
- if (!strncmp(v4_hex, l4ebcdic_hex, 9))
- return 2;
-
- return 1;
-#endif
-}
-
-int isLdlDasd(char * device) {
- return (isUsableDasd(device) == 2);
-}
-
-char *getDasdPorts() {
-#if !defined(__s390__) && !defined(__s390x__)
- return 0;
-#else
- char * line, *ports = NULL;
- char devname[7];
- char port[10];
- FILE *fd;
- int ret, sz;
-
- fd = fopen("/proc/dasd/devices", "r");
- if (!fd)
- return NULL;
-
- if ((line = (char *)malloc(100 * sizeof(char))) == NULL) {
- fclose(fd);
- return NULL;
- }
-
- while (fgets(line, 100, fd) != NULL) {
- if ((strstr(line, "unknown") != NULL))
- continue;
-
- if (strstr(line, "(FBA )") != NULL)
- ret = sscanf(line, "%[A-Za-z.0-9](FBA ) at ( %*d: %*d) is %s : %*s", port, devname);
- else
- ret = sscanf(line, "%[A-Za-z.0-9](ECKD) at ( %*d: %*d) is %s : %*s", port, devname);
-
- if (ret == 2) {
- if (!ports) {
- sz = strlen(port) + 1;
- if ((ports = (char *) malloc(sz)) == NULL) {
- fclose(fd);
- return NULL;
- }
-
- ports = strcpy(ports, port);
- } else {
- sz = strlen(ports) + strlen(port) + 2;
- if ((ports = (char *) realloc(ports, sz)) == NULL) {
- fclose(fd);
- return NULL;
- }
-
- ports = strcat(ports, ",");
- ports = strcat(ports, port);
- }
- }
- }
-
- fclose(fd);
-
- return ports;
-#endif
-}
-
-/* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/isys/isys.c b/isys/isys.c
index 6a2d18dca..75ee2b366 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -103,9 +103,6 @@ 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 * py_getDasdPorts(PyObject * s, PyObject * args);
-static PyObject * py_isUsableDasd(PyObject * s, PyObject * args);
-static PyObject * py_isLdlDasd(PyObject * s, PyObject * args);
static PyObject * doSegvHandler(PyObject *s, PyObject *args);
static PyObject * doAuditDaemon(PyObject *s);
static PyObject * doPrefixToNetmask(PyObject *s, PyObject *args);
@@ -137,9 +134,6 @@ static PyMethodDef isysModuleMethods[] = {
{ "isisoimage", (PyCFunction) doisIsoImage, METH_VARARGS, NULL},
{ "printObject", (PyCFunction) printObject, METH_VARARGS, NULL},
{ "bind_textdomain_codeset", (PyCFunction) py_bind_textdomain_codeset, METH_VARARGS, NULL},
- { "getDasdPorts", (PyCFunction) py_getDasdPorts, METH_VARARGS, NULL},
- { "isUsableDasd", (PyCFunction) py_isUsableDasd, METH_VARARGS, NULL},
- { "isLdlDasd", (PyCFunction) py_isLdlDasd, METH_VARARGS, NULL},
{ "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
{ "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
{ "prefix2netmask", (PyCFunction) doPrefixToNetmask, METH_VARARGS, NULL },
@@ -570,27 +564,6 @@ static PyObject * doisIsoImage(PyObject * s, PyObject * args) {
return Py_BuildValue("i", rc);
}
-static PyObject * py_getDasdPorts(PyObject * o, PyObject * args) {
- if (!PyArg_ParseTuple(args, "")) return NULL;
-
- return Py_BuildValue("s", getDasdPorts());
-}
-
-static PyObject * py_isUsableDasd(PyObject * o, PyObject * args) {
- char *devname;
- if (!PyArg_ParseTuple(args, "s", &devname))
- return NULL;
- return Py_BuildValue("i", isUsableDasd(devname));
-}
-
-static PyObject * py_isLdlDasd(PyObject * o, PyObject * args) {
- char *devname;
- if (!PyArg_ParseTuple(args, "s", &devname))
- return NULL;
- return Py_BuildValue("i", isLdlDasd(devname));
-}
-
-
static PyObject * printObject (PyObject * o, PyObject * args) {
PyObject * obj;
char buf[256];
diff --git a/isys/isys.h b/isys/isys.h
index 15e461edb..265dc7760 100644
--- a/isys/isys.h
+++ b/isys/isys.h
@@ -35,9 +35,4 @@ int fileIsIso(const char * file);
/* returns 1 if on an iSeries vio console, 0 otherwise */
int isVioConsole(void);
-/* dasd functions */
-char *getDasdPorts();
-int isLdlDasd(char * dev);
-int isUsableDasd(char *device);
-
#endif
diff --git a/isys/isys.py b/isys/isys.py
index 8c1e2a14d..237d3b749 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -202,15 +202,6 @@ def swapon (path):
def loadKeymap(keymap):
return _isys.loadKeymap (keymap)
-def getDasdPorts():
- return _isys.getDasdPorts()
-
-def isUsableDasd(device):
- return _isys.isUsableDasd(device)
-
-def isLdlDasd(device):
- return _isys.isLdlDasd(device)
-
# read /proc/dasd/devices and get a mapping between devs and the dasdnum
def getDasdDevPort():
ret = {}