home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / question / 14821 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.1 KB  |  41 lines

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!not-for-mail
  2. From: cavers@menudo.uh.edu (Chris M. Cavers)
  3. Newsgroups: comp.unix.questions
  4. Subject: Cylinder Groups and Data Blocks
  5. Date: 18 Dec 1992 19:43:19 -0600
  6. Organization: University of Houston
  7. Lines: 29
  8. Sender: cavers@menudo.uh.edu
  9. Message-ID: <1gtunnINNgk0@menudo.uh.edu>
  10. NNTP-Posting-Host: menudo.uh.edu
  11.  
  12. I am trying to obtain a 'map' or list of all of the data areas on a disk
  13. under sun os 4.1.2.
  14. Can someone tell me how to do this?
  15. I've been using the following code to try to do this:
  16.  
  17. {
  18. int ctr;
  19. long start,end;
  20. struct cg group;
  21. for (ctr = 0;ctr < sb->fs_ncg;ctr++)   /*sb is the superblock for the fs*/
  22.     {
  23.     long a;
  24.     a = dbtob(fsbtodb(sb,cgtod(sb,ctr)));
  25.     lseek(dv,a,0);    /*dv is the file handle for the device*/
  26.     read(dv,&group,sizeof(struct cg));
  27.     start = cgdmin(sb,ctr);
  28.     end = cgdmin(sb,ctr) + group.cg_ndblk -1;
  29.     /*now, start is the starting data block and end is the ending data block*/
  30.     }
  31.  
  32. Assuming each block is one sector (512 bytes) the above code 
  33. comes to about half of the number of bytes on the disk (as given by the
  34. df command).
  35.  
  36. What is wrong?
  37.  
  38. Thanks in advance
  39. Chris
  40.  
  41.