Gentoo Archives: gentoo-commits

From: "Joseph Jezak (josejx)" <josejx@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/yaboot-static/files: sysfs-ofpath.patch
Date: Mon, 31 May 2010 23:53:41
Message-Id: 20100531235337.41CE62CAD8@corvid.gentoo.org
1 josejx 10/05/31 23:53:37
2
3 Added: sysfs-ofpath.patch
4 Log:
5 Add patch for sysfs paths in ofpath from bug #253614.
6 (Portage version: 2.1.8.3/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 sys-boot/yaboot-static/files/sysfs-ofpath.patch
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/yaboot-static/files/sysfs-ofpath.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/yaboot-static/files/sysfs-ofpath.patch?rev=1.1&content-type=text/plain
13
14 Index: sysfs-ofpath.patch
15 ===================================================================
16 --- usr/sbin/ofpath 2008-08-03 04:00:35.000000000 -0400
17 +++ usr/sbin/ofpath 2009-01-09 13:46:12.000000000 -0500
18 @@ -337,15 +337,18 @@
19
20 ide_ofpath()
21 {
22 - if [ ! -L "/proc/ide/$DEVNODE" ] ; then
23 + if [ ! -L "/proc/ide/$DEVNODE" ] && [ ! -e "/sys/block/$DEVNODE" ] ; then
24 echo 1>&2 "$PRG: /dev/$DEVNODE: Device not configured"
25 return 1
26 fi
27
28 - local IDEBUS="$(v=`readlink /proc/ide/$DEVNODE` ; echo ${v%%/*} )"
29 - if [ -z "$IDEBUS" ] ; then
30 - echo 1>&2 "$PRG: BUG: IDEBUS == NULL"
31 - return 1
32 + if [ -L "/proc/ide/$DEVNODE" ] ; then
33 + local USE_OLD_PROC=1
34 + local IDEBUS="$(v=`readlink /proc/ide/$DEVNODE` ; echo ${v%%/*} )"
35 + if [ -z "$IDEBUS" ] ; then
36 + echo 1>&2 "$PRG: BUG: IDEBUS == NULL"
37 + return 1
38 + fi
39 fi
40
41 case "$(uname -r)" in
42 @@ -363,7 +366,8 @@
43 echo 1>&2 "$PRG: Unable to determine sysfs mountpoint"
44 return 1
45 fi
46 - local OF1275IDE="${SYS}/block/${DEVNODE}/device/../../devspec"
47 + local OF1275IDE=$(cd -P "${SYS}/block/${DEVNODE}/device" && pwd)
48 + OF1275IDE="${OF1275IDE}/../../devspec"
49 ;;
50 *)
51 local OF1275IDE="/proc/ide/$IDEBUS/devspec"
52 @@ -402,34 +406,41 @@
53 return 1
54 fi
55
56 - if [ ! -f "/proc/ide/${IDEBUS}/channel" ] ; then
57 - echo 1>&2 "$PRG: KERNEL BUG: /proc/ide/${IDEBUS}/channel does not exist"
58 - return 1
59 - fi
60 -
61 - case "$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)" in
62 - ide|ata)
63 - local MASTER="/disk@0"
64 - local SLAVE="/disk@1"
65 - ;;
66 - pci-ide|pci-ata)
67 - local MASTER="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@0"
68 - local SLAVE="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@1"
69 - ;;
70 - scsi) ## some lame controllers pretend they are scsi, hopefully all kludges are created equal.
71 - local MASTER="/@$(($(cat /proc/ide/${IDEBUS}/channel) * 2 + 0))"
72 - local SLAVE="/@$(($(cat /proc/ide/${IDEBUS}/channel) * 2 + 1))"
73 - ;;
74 - spi)
75 - local MASTER="/disk@$(cat /proc/ide/${IDEBUS}/channel),0"
76 - local SLAVE="/disk@$(cat /proc/ide/${IDEBUS}/channel),1"
77 - ;;
78 - *)
79 - echo 1>&2 "$PRG: Unsupported IDE device type: \"$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)\""
80 - return 1
81 - ;;
82 - esac
83 +
84 + if [ "${USE_OLD_PROC}" = "1" ] ; then
85 + if [ ! -f "/proc/ide/${IDEBUS}/channel" ] ; then
86 + echo 1>&2 "$PRG: KERNEL BUG: /proc/ide/${IDEBUS}/channel does not exist"
87 + return 1
88 + fi
89
90 + case "$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)" in
91 + ide|ata)
92 + local MASTER="/disk@0"
93 + local SLAVE="/disk@1"
94 + ;;
95 + pci-ide|pci-ata)
96 + local MASTER="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@0"
97 + local SLAVE="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@1"
98 + ;;
99 + scsi) ## some lame controllers pretend they are scsi, hopefully all kludges are created equal.
100 + local MASTER="/@$(($(cat /proc/ide/${IDEBUS}/channel) * 2 + 0))"
101 + local SLAVE="/@$(($(cat /proc/ide/${IDEBUS}/channel) * 2 + 1))"
102 + ;;
103 + spi)
104 + local MASTER="/disk@$(cat /proc/ide/${IDEBUS}/channel),0"
105 + local SLAVE="/disk@$(cat /proc/ide/${IDEBUS}/channel),1"
106 + ;;
107 + *)
108 + echo 1>&2 "$PRG: Unsupported IDE device type: \"$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)\""
109 + return 1
110 + ;;
111 + esac
112 + else
113 + ### I don't know what other disks would look like... FIXME
114 + local MASTER="/disk@0"
115 + local SLAVE="/disk@1"
116 + fi
117 +
118 case "$DEVNODE" in
119 hda|hdc|hde|hdg|hdi|hdk|hdm|hdo)
120 echo "${DEVSPEC}${MASTER}:$PARTITION"