>Number:         6373
>Category:       user
>Synopsis:       Patch for opendisk() in /sbin/pdisk
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Thu May 06 17:10:01 GMT 2010
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
        System      : OpenBSD 4.7
        Details     : OpenBSD 4.7-current (GENERIC.MP) #360: Tue Apr 27 
13:11:43 MDT 2010
                         
[email protected]:/usr/src/sys/arch/macppc/compile/GENERIC.MP

        Architecture: OpenBSD.macppc
        Machine     : macppc
>Description:
        pdisk does not use opendisk(), and typing full disk pathnames is 
annoying.
>How-To-Repeat:
        
>Fix:
        This trivial patch was lightly tested with listing and editing
        a couple maps on macppc. I didn't search through the program
        to see if anything else depends on a full device pathname,
        however the device handling code seems to be quite well
        abstracted.

Index: Makefile
===================================================================
RCS file: /ruby/cvs/openbsd/src/sbin/pdisk/Makefile,v
retrieving revision 1.8
diff -u Makefile
--- Makefile    11 May 2006 17:20:40 -0000      1.8
+++ Makefile    6 May 2010 16:17:24 -0000
@@ -9,6 +9,9 @@
        file_media.c hfs_misc.c io.c media.c partition_map.c pathname.c \
        pdisk.c util.c validate.c
 
+LDADD=  -lutil
+DPADD=  ${LIBUTIL}
+
 .else
 NOPROG=yes
 .endif
Index: file_media.c
===================================================================
RCS file: /ruby/cvs/openbsd/src/sbin/pdisk/file_media.c,v
retrieving revision 1.9
diff -u file_media.c
--- file_media.c        11 May 2006 17:20:40 -0000      1.9
+++ file_media.c        6 May 2010 16:21:55 -0000
@@ -41,6 +41,8 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 
+#include <util.h>
+
 #include "file_media.h"
 #include "errors.h"
 
@@ -193,7 +195,7 @@
     }
 
     a = 0;
-    fd = open(file, oflag);
+    fd = opendev(file, oflag, OPENDEV_PART, NULL);
     if (fd >= 0) {
        a = new_file_media();
        if (a != 0) {



dmesg:
OpenBSD 4.7-current (GENERIC.MP) #360: Tue Apr 27 13:11:43 MDT 2010
    [email protected]:/usr/src/sys/arch/macppc/compile/GENERIC.MP
real mem = 1073741824 (1024MB)
avail mem = 1032908800 (985MB)
mainbus0 at root: model PowerMac3,1
cpu0 at mainbus0: 7400 (Revision 0x209): 500 MHz: 1MB backside cache
cpu1 at mainbus0: 7400 (Revision 0x209): 500 MHz: 1MB backside cache
mem0 at mainbus0
spdmem0 at mem0: 256MB SDRAM non-parity PC100CL2
spdmem1 at mem0: 256MB SDRAM non-parity PC100CL3
spdmem2 at mem0: 256MB SDRAM non-parity PC100CL2
spdmem3 at mem0: 256MB SDRAM non-parity PC133CL2
memc0 at mainbus0: uni-n
kiic0 at memc0 offset 0xf8001000
iic0 at kiic0
mpcpcibr0 at mainbus0 pci: uni-north, Revision 0xff
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 "Apple Uni-N AGP" rev 0x00
vgafb0 at pci0 dev 16 function 0 "ATI Rage Fury" rev 0x00, mmio
wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation)
mpcpcibr1 at mainbus0 pci: uni-north, Revision 0xff
pci1 at mpcpcibr1 bus 0
pchb1 at pci1 dev 11 function 0 "Apple Uni-N" rev 0x00
ppb0 at pci1 dev 13 function 0 "DEC 21154 PCI-PCI" rev 0x05
pci2 at ppb0 bus 1
pciide0 at pci2 dev 3 function 0 "CMD Technology SiI3112 SATA" rev 0x02: DMA
pciide0: using irq 53 for native-PCI interrupt
pciide0: port 1: device present, speed: 1.5Gb/s
wd0 at pciide0 channel 1 drive 0: <SAMSUNG SP1614C>
wd0: 16-sector PIO, LBA48, 152627MB, 312581808 sectors
wd0(pciide0:1:0): using BIOS timings, Ultra-DMA mode 7
em0 at pci2 dev 4 function 0 "Intel PRO/1000MT (82540EM)" rev 0x02: irq 54, 
address 00:0e:0c:69:aa:e8
macobio0 at pci2 dev 7 function 0 "Apple Keylargo" rev 0x02
openpic0 at macobio0 offset 0x40000: version 0x4614 little endian
macgpio0 at macobio0 offset 0x50
macgpio1 at macgpio0 irq 47
pgs0 at macgpio0: irq 55
"escc-legacy" at macobio0 offset 0x12000 not configured
zsc0 at macobio0 offset 0x13000: irq 22,50
zstty0 at zsc0 channel 0
zstty1 at zsc0 channel 1
awacs0 at macobio0 offset 0x14000: irq 24,9,10 headphones
audio0 at awacs0
"timer" at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000 irq 25: via-pmu, 0 targets
apm0 at adb0: battery flags 0x9, 0% charged
kiic1 at macobio0 offset 0x18000
iic1 at kiic1
wdc0 at macobio0 offset 0x1f000 irq 19: DMA
wd1 at wdc0 channel 0 drive 0: <WDC WD1200JB-00REA0>
wd1: 16-sector PIO, LBA48, 114473MB, 234441648 sectors
wd2 at wdc0 channel 0 drive 1: <Maxtor 6Y060P0>
wd2: 16-sector PIO, LBA, 58644MB, 120103200 sectors
wd1(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4
wd2(wdc0:0:1): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4
wdc1 at macobio0 offset 0x20000 irq 20: DMA
atapiscsi0 at wdc1 channel 0 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <MATSHITA, DVD-ROM SR-8585, 1A30> ATAPI 5/cdrom 
removable
cd0(wdc1:0:0): using BIOS timings, DMA mode 2
wdc2 at macobio0 offset 0x21000 irq 21: DMA
ohci0 at pci2 dev 8 function 0 "Apple USB" rev 0x00: irq 27, version 1.0
ohci1 at pci2 dev 9 function 0 "Apple USB" rev 0x00: irq 28, version 1.0
"TI TSB12LV23 FireWire" rev 0x00 at pci2 dev 10 function 0 not configured
usb0 at ohci0: USB revision 1.0
uhub0 at usb0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
usb1 at ohci1: USB revision 1.0
uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1
mpcpcibr2 at mainbus0 pci: uni-north, Revision 0x16
pci3 at mpcpcibr2 bus 0
pchb2 at pci3 dev 11 function 0 "Apple Uni-N Eth" rev 0x00
gem0 at pci3 dev 15 function 0 "Apple Uni-N GMAC" rev 0x01: irq 41, address 
00:30:65:83:8f:ee
bmtphy0 at gem0 phy 0: BCM5201 10/100 PHY, rev. 2
uhub2 at uhub1 port 1 "ALCOR STRONG MAN KBD HUB" rev 1.10/1.01 addr 2
uhidev0 at uhub2 port 1 configuration 1 interface 0 "ALCOR STRONG MAN KBD HUB" 
rev 1.00/1.01 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhidev1 at uhub2 port 3 configuration 1 interface 0 "Logitech USB-PS/2 Optical 
Mouse" rev 2.00/20.00 addr 4
uhidev1: iclass 3/1
ums0 at uhidev1: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
bootpath: /p...@f2000000/@d/seri-tek...@3/s...@2:/bsd
string [/seri-tek...@3/s...@2:/bsd] not found
Warning: bootpath unrecognized: /p...@f2000000/@d/seri-tek...@3/s...@2:/bsd
root device: wd0a
swap device (default wd0b): 
root on wd0a swap on wd0b dump on wd0b
wd0(pciide0:1:0): timeout
        type: ata
        c_bcount: 8192
        c_skip: 0
wd0a: device timeout reading fsbn 128 of 128-143 (wd0 bn 41151; cn 40 tn 13 sn 
12), retrying
wd0: soft error (corrected)

usbdevs:
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, OHCI root hub(0x0000), 
Apple(0x106b), rev 1.00
 port 1 powered
 port 2 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, OHCI root hub(0x0000), 
Apple(0x106b), rev 1.00
 port 1 addr 2: full speed, power 100 mA, config 1, STRONG MAN KBD HUB(0x9213), 
ALCOR(0x058f), rev 1.01, iSerialNumber 1234
  port 1 addr 3: full speed, power 50 mA, config 1, STRONG MAN KBD HUB(0x9410), 
ALCOR(0x058f), rev 1.01, iSerialNumber 1234
  port 2 powered
  port 3 addr 4: low speed, power 98 mA, config 1, USB-PS/2 Optical 
Mouse(0xc03e), Logitech(0x046d), rev 20.00
 port 2 powered


>Release-Note:
>Audit-Trail:
>Unformatted:

Reply via email to