Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!sgi!jeremy@perf2.asd.sgi.com From: jeremy@perf2.asd.sgi.com (Jeremy Higdon) Newsgroups: comp.sys.sgi Subject: Re: The disk volume header... again Message-ID: <88872@sgi.sgi.com> Date: 5 Mar 91 06:05:38 GMT References: <9103012010.AA04983@koko.pdi.com> Sender: guest@sgi.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 26 In article <9103012010.AA04983@koko.pdi.com>, shoshana@pdi.UUCP (Shoshana Abrass) writes: > > Last week I posted a question and answer about how to read the volume > header into a c program. My code looks like this (extras and error > checking removed for brevity): > > struct volume_header *vh; > > fd = open("/dev/rvh", O_RDONLY); > ioctl(fd, DIOCGETVH, vh); > > The ioctl call fills "vh" with useful information, and I can then read > the volume directory and determine the length and logical-block-number > of the file I want to read. But... what now? I'd like to read this > file in off the disk. I've looked at the man pages for vh, dksc, > and the include files dvh.h and dkio.h, and nothing jumps out at me. > > I've tried doing an lseek to the logical block number, but I get either > zeros or garbage. I know zilch about how devices work at this level, so > I tried the following lseeks on both /dev/vh and /dev/rvh: > > lbn > sizeof(struct volume_header) + lbn > Try lbn*NBPSCTR (lbn*512) as the seek argument.