About the volume header: one solution

Dave Olson olson at anchor.esd.sgi.com
Fri Feb 22 15:20:38 AEST 1991


In <9102212115.AA20052 at koko.pdi.com> shoshana at pdi.UUCP (Shoshana Abrass) writes:


| Dave Olsen (olson at anchor.esd.sgi.com) writes:
| >> You could simply get the file out with 'dvhtool -v g vhfile file'
| >> if you are doing a shell script.  Otherwise look at sys/dkio.h
| >> and sys/dvh.h.  
| 
|   I am *not* writing a shell script. I must have sounded *really* stupid.
|   Why would I write a shell script to replace hinv?  Anyway, I will

People do all kinds of things for various reasons.  It isn't necessarily
stupid to use a shell script.  Often it is the appropriate answer.  Sorry,
I didn't mean to sound patronizing; I guess I've spent a bit too much
time on the phone lately with people with people who had a different
base understanding of the situation than I had...

| read_partition_table(char* file)               <=== "file" is a disk path
| {                                                   e.g., /dev/rdsk/dks0d1vh
|    
|     int      fd;
|     struct   volume_header  *buf;
| 
|     buf = (struct volume_header *)malloc(512);<===  Seems like there should be
|                                                     some explanation of how
|                                                     this number was calculated

What is wrong with 
	buf = (struct volume_header *)malloc(sizeof *buf);

Seems pretty self documenting to me.  Why would one
ever hard code a constant for something like this!?!

Of course, the fact that I copied some old comments and
stupidly embedded the constant 512 in the dksc.7 man page
couldn't have anything to do with it, could it? :)

I'll fix the man page.
--

	Dave Olson

Life would be so much easier if we could just look at the source code.



More information about the Comp.sys.sgi mailing list