Hello,

The fix originally applied to this bug is not sufficient. As I 
mentioned in my original report, we need the Ubuntu patch 
80-extras-vio_type.patch, I'm attaching it for reference (extracted 
from Ubuntu udev package, version 124). Without this patch the 
ENV{VIO_TYPE} triggers currently present in udev are meaningless, as 
there is nothing there to set this variable. This is confirmed by 
Michal, who recently tried installing in an LDOM on a T2000 box.

Best regards,
-- 
Jurij Smakov                                           ju...@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
diff -Naurd udev-111-orig/extras/vio_type/Makefile udev-111/extras/vio_type/Makefile
--- udev-111-orig/extras/vio_type/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ udev-111/extras/vio_type/Makefile	2007-07-04 10:22:36.000000000 +0200
@@ -0,0 +1,67 @@
+# Copyright © 2005 Canonical Ltd.
+# Author: Scott James Remnant <sc...@ubuntu.com>
+#
+# Released under the GNU General Public License, version 2.
+
+PROG = vio_type
+OBJ =
+HEADERS =
+GEN_HEADERS =
+MAN_PAGES =
+
+prefix =
+etcdir =	${prefix}/etc
+sbindir =	${prefix}/sbin
+usrbindir =	${prefix}/usr/bin
+usrsbindir =	${prefix}/usr/sbin
+libudevdir =	${prefix}/lib/udev
+mandir =	${prefix}/usr/share/man
+configdir =	${etcdir}/udev/
+
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA  = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+
+all: $(PROG) $(MAN_PAGES)
+.PHONY: all
+.DEFAULT: all
+
+%.o: %.c $(GEN_HEADERS)
+	$(E) "  CC      " $@
+	$(Q) $(CC) -c $(CFLAGS) $< -o $@
+
+$(PROG): %: $(HEADERS) %.o $(OBJS)
+	$(E) "  LD      " $@
+	$(Q) $(LD) $(LDFLAGS) $...@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
+
+# man pages
+%.8: %.xml
+	$(E) "  XMLTO   " $@
+	$(Q) xmlto man $?
+.PRECIOUS: %.8
+
+clean:
+	$(E) "  CLEAN   "
+	$(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
+.PHONY: clean
+
+install-bin: all
+	$(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG)
+.PHONY: install-bin
+
+uninstall-bin:
+	- rm $(DESTDIR)$(libudevdir)/$(PROG)
+.PHONY: uninstall-bin
+
+install-man:
+	$(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8
+.PHONY: uninstall-man
+
+uninstall-man:
+	-rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8
+.PHONY: uninstall-man
+
+install-config:
+	@echo "no config file to install"
+.PHONY: install-config
diff -Naurd udev-111-orig/extras/vio_type/vio_type.8 udev-111/extras/vio_type/vio_type.8
--- udev-111-orig/extras/vio_type/vio_type.8	1970-01-01 01:00:00.000000000 +0100
+++ udev-111/extras/vio_type/vio_type.8	2007-07-04 10:22:36.000000000 +0200
@@ -0,0 +1,29 @@
+.TH VIO_TYPE 8 "November 2005" "" "Linux Administrator's Manual"
+.SH NAME
+vio_type \- udev callout to identify type of VIO device
+.SH SYNOPSIS
+.BI vio_type
+[\fI--export\fP] \fIdevpath\fP
+.SH DESCRIPTION
+.B vio_type
+is normally called from a udev rule to identify the type of a VIO
+device.  Udev can use this information to assign appropriate permissions to
+the device or load an appropriate module.
+.SH USAGE
+.B vio_type
+takes a path under /sys, if not given it uses the value of the
+.I DEVPATH
+environment variable instead.  It then prints the information chosen by the
+options.
+.SH OPTIONS
+The following command-line switches are supported to specify what
+vio_type should print:
+.TP
+.BI --export
+print device type as VIO_TYPE environment variable for use with an
+IMPORT{program} rule.
+.RE
+.SH SEE ALSO
+.BR udev (8)
+.SH AUTHORS
+Scott James Remnant <sc...@ubuntu.com>
diff -Naurd udev-111-orig/extras/vio_type/vio_type.c udev-111/extras/vio_type/vio_type.c
--- udev-111-orig/extras/vio_type/vio_type.c	1970-01-01 01:00:00.000000000 +0100
+++ udev-111/extras/vio_type/vio_type.c	2007-07-04 10:24:09.000000000 +0200
@@ -0,0 +1,171 @@
+/*
+ * vio-type - identify type of a VIO device
+ *
+ * Copyright © 2006 Canonical Ltd.
+ * Author: Scott James Remnant <sc...@ubuntu.com>
+ *
+ *	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 version 2 of the License.
+ *
+ *	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, write to the Free Software Foundation, Inc.,
+ *	51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "../../udev.h"
+
+#ifdef USE_LOG
+void log_message(int priority, const char *format, ...)
+{
+	va_list args;
+	static int udev_log = -1;
+
+	if (udev_log == -1) {
+		const char *value;
+
+		value = getenv("UDEV_LOG");
+		if (value)
+			udev_log = log_priority(value);
+		else
+			udev_log = LOG_ERR;
+	}
+
+	if (priority > udev_log)
+		return;
+
+	va_start(args, format);
+	vsyslog(priority, format, args);
+	va_end(args);
+}
+#endif
+
+int main(int argc, char *argv[])
+{
+	struct stat buf;
+	const char *devpath = NULL;
+	char filename[PATH_SIZE], devspec[256], devtype[256];
+	int ret = 0, export = 0;
+	int i, fd, len;
+
+	logging_init("vio_type");
+	sysfs_init();
+
+	for (i = 1; i < argc; i++) {
+		if (strcmp(argv[i], "--export") == 0) {
+			export = 1;
+		} else {
+			devpath = argv[i];
+		}
+	}
+
+	if (!devpath) {
+		devpath = getenv("DEVPATH");
+		if (!devpath) {
+			err("no devpath specified and DEVPATH not set");
+			ret = 1;
+			goto exit;
+		}
+	}
+
+	strlcpy(filename, sysfs_path, sizeof(filename));
+	strlcat(filename, devpath, sizeof(filename));
+
+	if (stat(filename, &buf) != 0) {
+		err("stat of '%s' failed", filename);
+		ret = 1;
+		goto exit;
+	}
+
+	strlcat(filename, "/", sizeof(filename));
+	strlcat(filename, "devspec", sizeof(filename));
+
+	fd = open(filename, O_RDONLY);
+	if (!fd) {
+		err("unable to open '%s'", filename);
+		ret = 1;
+		goto exit;
+	}
+
+	len = read(fd, devspec, sizeof(devspec));
+	if (len <= 0) {
+#if !defined(__sparc__) && !defined(__sparc64__)
+		err("unable to read from '%s'", filename);
+#endif
+		ret = 1;
+		goto close;
+	}
+
+	devspec[len] = '\0';
+	if (devspec[len-1] == '\n')
+		devspec[len-1] = '\0';
+
+	close(fd);
+
+
+#if !defined(__sparc__) && !defined(__sparc64__)
+	/* now we look in /proc */
+
+	strlcpy(filename, "/proc/device-tree", sizeof(filename));
+	strlcat(filename, devspec, sizeof(filename));
+	strlcat(filename, "/", sizeof(filename));
+	strlcat(filename, "device_type", sizeof(filename));
+
+	/* hang around for /proc to catch up */
+	for (i = 100; i; i--) {
+		if (stat(filename, &buf) == 0)
+			break;
+
+		usleep(30000);
+	}
+
+	fd = open(filename, O_RDONLY);
+	if (!fd) {
+		err("unable to open '%s'", filename);
+		ret = 1;
+		goto exit;
+	}
+
+	len = read(fd, devtype, sizeof(devtype));
+	if (len <= 0) {
+		err("unable to read from '%s'", filename);
+		ret = 1;
+		goto close;
+	}
+
+	devtype[len] = '\0';
+	if (devtype[len-1] == '\n')
+		devtype[len-1] = '\0';
+#else
+	strncpy(devtype,devspec,strlen(devspec)+1);
+#endif
+
+	if (export) {
+		printf("VIO_TYPE=%s\n", devtype);
+	} else {
+		printf("%s\n", devtype);
+	}
+
+close:
+	close(fd);
+exit:
+	sysfs_cleanup();
+	logging_close();
+	return ret;
+}

Reply via email to