rpms/xen/devel xen-dev-create-cleanup.patch, NONE, 1.1 xen.spec, 1.254, 1.255

myoung myoung at fedoraproject.org
Sun Jun 20 12:50:28 UTC 2010


Author: myoung

Update of /cvs/pkgs/rpms/xen/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv24406

Modified Files:
	xen.spec 
Added Files:
	xen-dev-create-cleanup.patch 
Log Message:
remove some old device creation code that doesn't work with the latest pvops kernels


xen-dev-create-cleanup.patch:
 blktap/drivers/blktapctrl_linux.c |   24 --------
 libxc/xc_linux.c                  |  114 +-------------------------------------
 libxc/xc_minios.c                 |    6 --
 libxc/xenctrl.h                   |   10 ---
 4 files changed, 5 insertions(+), 149 deletions(-)

--- NEW FILE xen-dev-create-cleanup.patch ---

# HG changeset patch
# User Keir Fraser <keir.fraser at citrix.com>
# Date 1275644846 -3600
# Node ID 0e1521f654f2ab616b37da7359a45a8979356083
# Parent 15b4430dab466d4375a691cb68ef8ac37c46a115
libxc: Remove obsolete xc_find_device_number() declaration.

Signed-off-by: Keir Fraser <keir.fraser at citrix.com>
xen-unstable changeset:   21528:d4a91417a023
xen-unstable date:        Fri Jun 04 10:46:32 2010 +0100


tools: assume that special Xen devices have been created by the platform

Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.

tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.

Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
xen-unstable changeset:   21507:a3bdee5a20da
xen-unstable date:        Wed Jun 02 10:54:32 2010 +0100

--- a/tools/blktap/drivers/blktapctrl_linux.c	Fri Jun 04 10:42:30 2010 +0100
+++ b/tools/blktap/drivers/blktapctrl_linux.c	Fri Jun 04 10:47:26 2010 +0100
@@ -79,31 +79,11 @@ int blktap_interface_create(int ctlfd, i
 
 int blktap_interface_open(void)
 {
-	char *devname;
-	int ret;
 	int ctlfd;
 
-	/* Attach to blktap0 */
-	if (asprintf(&devname,"%s/%s0", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME) == -1)
-		goto open_failed;
-
-	ret = xc_find_device_number("blktap0");
-	if (ret < 0) {
-		DPRINTF("couldn't find device number for 'blktap0'\n");
-		goto open_failed;
-	}
-
-	blktap_major = major(ret);
-	make_blktap_dev(devname,blktap_major, 0);
-
-	ctlfd = open(devname, O_RDWR);
-	if (ctlfd == -1) {
+	ctlfd = open(BLKTAP_DEV_DIR "/" BLKTAP_DEV_NAME "0", O_RDWR);
+	if (ctlfd == -1)
 		DPRINTF("blktap0 open failed\n");
-		goto open_failed;
-	}
 
 	return ctlfd;
-
-open_failed:
-	return -1;
 }
--- a/tools/libxc/xc_linux.c	Fri Jun 04 10:42:30 2010 +0100
+++ b/tools/libxc/xc_linux.c	Fri Jun 04 10:47:26 2010 +0100
@@ -316,96 +316,11 @@ int do_xen_hypercall(int xc_handle, priv
                       (unsigned long)hypercall);
 }
 
-#define MTAB "/proc/mounts"
-#define MAX_PATH 255
-#define _STR(x) #x
-#define STR(x) _STR(x)
-
-static int find_sysfsdir(char *sysfsdir)
-{
-    FILE *fp;
-    char type[MAX_PATH + 1];
-
-    if ( (fp = fopen(MTAB, "r")) == NULL )
-        return -1;
-
-    while ( fscanf(fp, "%*s %"STR(MAX_PATH)"s %"STR(MAX_PATH)"s %*s %*d %*d\n",
-                   sysfsdir, type) == 2 )
-        if ( strncmp(type, "sysfs", 5) == 0 )
-            break;
-
-    fclose(fp);
-
-    return ((strncmp(type, "sysfs", 5) == 0) ? 0 : -1);
-}
-
-int xc_find_device_number(const char *name)
-{
-    FILE *fp;
-    int i, major, minor;
-    char sysfsdir[MAX_PATH + 1];
-    static char *classlist[] = { "xen", "misc" };
-
-    for ( i = 0; i < (sizeof(classlist) / sizeof(classlist[0])); i++ )
-    {
-        if ( find_sysfsdir(sysfsdir) < 0 )
-            goto not_found;
-
-        /* <base>/class/<classname>/<devname>/dev */
-        strncat(sysfsdir, "/class/", MAX_PATH);
-        strncat(sysfsdir, classlist[i], MAX_PATH);
-        strncat(sysfsdir, "/", MAX_PATH);
-        strncat(sysfsdir, name, MAX_PATH);
-        strncat(sysfsdir, "/dev", MAX_PATH);
-
-        if ( (fp = fopen(sysfsdir, "r")) != NULL )
-            goto found;
-    }
-
- not_found:
-    errno = -ENOENT;
-    return -1;
-
- found:
-    if ( fscanf(fp, "%d:%d", &major, &minor) != 2 )
-    {
-        fclose(fp);
-        goto not_found;
-    }
-
-    fclose(fp);
-
-    return makedev(major, minor);
-}
-
-#define EVTCHN_DEV_NAME  "/dev/xen/evtchn"
+#define DEVXEN "/dev/xen/"
 
 int xc_evtchn_open(void)
 {
-    struct stat st;
-    int fd;
-    int devnum;
-
-    devnum = xc_find_device_number("evtchn");
-
-    /* Make sure any existing device file links to correct device. */
-    if ( (lstat(EVTCHN_DEV_NAME, &st) != 0) || !S_ISCHR(st.st_mode) ||
-         (st.st_rdev != devnum) )
-        (void)unlink(EVTCHN_DEV_NAME);
-
- reopen:
-    if ( (fd = open(EVTCHN_DEV_NAME, O_RDWR)) == -1 )
-    {
-        if ( (errno == ENOENT) &&
-             ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) &&
-             (mknod(EVTCHN_DEV_NAME, S_IFCHR|0600, devnum) == 0) )
-            goto reopen;
-
-        PERROR("Could not open event channel interface");
-        return -1;
-    }
-
-    return fd;
+    return open(DEVXEN "evtchn", O_RDWR);
 }
 
 int xc_evtchn_close(int xce_handle)
@@ -523,30 +438,7 @@ void discard_file_cache(int fd, int flus
 
 int xc_gnttab_open(void)
 {
-    struct stat st;
-    int fd;
-    int devnum;
-
-    devnum = xc_find_device_number("gntdev");
-
-    /* Make sure any existing device file links to correct device. */
-    if ( (lstat(GNTTAB_DEV_NAME, &st) != 0) || !S_ISCHR(st.st_mode) ||
-         (st.st_rdev != devnum) )
-        (void)unlink(GNTTAB_DEV_NAME);
-
-reopen:
-    if ( (fd = open(GNTTAB_DEV_NAME, O_RDWR)) == -1 )
-    {
-        if ( (errno == ENOENT) &&
-             ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) &&
-             (mknod(GNTTAB_DEV_NAME, S_IFCHR|0600, devnum) == 0) )
-            goto reopen;
-
-        PERROR("Could not open grant table interface");
-        return -1;
-    }
-
-    return fd;
+    return open(DEVXEN "gntdev", O_RDWR);
 }
 
 int xc_gnttab_close(int xcg_handle)
--- a/tools/libxc/xc_minios.c	Fri Jun 04 10:42:30 2010 +0100
+++ b/tools/libxc/xc_minios.c	Fri Jun 04 10:47:26 2010 +0100
@@ -150,12 +150,6 @@ int do_xen_hypercall(int xc_handle, priv
         return -1;
     }
     return call.result;
-}
-
-int xc_find_device_number(const char *name)
-{
-    printf("xc_find_device_number(%s)\n", name);
-    do_exit();
 }
 
 int xc_evtchn_open(void)
--- a/tools/libxc/xenctrl.h	Fri Jun 04 10:42:30 2010 +0100
+++ b/tools/libxc/xenctrl.h	Fri Jun 04 10:47:26 2010 +0100
@@ -99,16 +99,6 @@ int xc_interface_open(void);
  * @return 0 on success, -1 otherwise.
  */
 int xc_interface_close(int xc_handle);
-
-/*
- * KERNEL INTERFACES
- */
-
-/*
- * Resolve a kernel device name (e.g., "evtchn", "blktap0") into a kernel
- * device number. Returns -1 on error (and sets errno).
- */
-int xc_find_device_number(const char *name);
 
 /*
  * DOMAIN DEBUGGING FUNCTIONS



Index: xen.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xen/devel/xen.spec,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -p -r1.254 -r1.255
--- xen.spec	7 Jun 2010 22:28:18 -0000	1.254
+++ xen.spec	20 Jun 2010 12:50:28 -0000	1.255
@@ -6,7 +6,7 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 4.0.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 Group:   Development/Libraries
 License: GPLv2+ and LGPLv2+ and BSD
 URL:     http://xen.org/
@@ -37,6 +37,8 @@ Patch5: xen-net-disable-iptables-on-brid
 
 Patch10: xen-no-werror.patch
 
+Patch15: xen-dev-create-cleanup.patch
+
 Patch100: xen-configure-xend.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -145,6 +147,8 @@ which manage Xen virtual machines.
 
 %patch10 -p1
 
+%patch15 -p1
+
 %patch100 -p1
 
 # stubdom sources
@@ -475,6 +479,10 @@ rm -rf %{buildroot}
 %{_libdir}/*.so
 
 %changelog
+* Sun Jun 20 2010 Michael Young <m.a.young at durham.ac.uk> - 4.0.0-2
+- add patch to remove some old device creation code that doesn't
+  work with the latest pvops kernels
+
 * Tue Jun 7 2010 Michael Young <m.a.young at durham.ac.uk> - 4.0.0-1
 - update to 4.0.0 release
 - rebase xen-initscript.patch and xen-dumpdir.patch patches



More information about the scm-commits mailing list