home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!not-for-mail
- From: cavers@menudo.uh.edu (Chris M. Cavers)
- Newsgroups: comp.unix.questions
- Subject: Cylinder Groups and Data Blocks
- Date: 18 Dec 1992 19:43:19 -0600
- Organization: University of Houston
- Lines: 29
- Sender: cavers@menudo.uh.edu
- Message-ID: <1gtunnINNgk0@menudo.uh.edu>
- NNTP-Posting-Host: menudo.uh.edu
-
- I am trying to obtain a 'map' or list of all of the data areas on a disk
- under sun os 4.1.2.
- Can someone tell me how to do this?
- I've been using the following code to try to do this:
-
- {
- int ctr;
- long start,end;
- struct cg group;
- for (ctr = 0;ctr < sb->fs_ncg;ctr++) /*sb is the superblock for the fs*/
- {
- long a;
- a = dbtob(fsbtodb(sb,cgtod(sb,ctr)));
- lseek(dv,a,0); /*dv is the file handle for the device*/
- read(dv,&group,sizeof(struct cg));
- start = cgdmin(sb,ctr);
- end = cgdmin(sb,ctr) + group.cg_ndblk -1;
- /*now, start is the starting data block and end is the ending data block*/
- }
-
- Assuming each block is one sector (512 bytes) the above code
- comes to about half of the number of bytes on the disk (as given by the
- df command).
-
- What is wrong?
-
- Thanks in advance
- Chris
-
-