/*******************************************************************/
/* sectorprint.c: */
/* */
/* This program displays the sector ids for all combinations of */
/* values for cylinder number (c), track number (t) = platter */
/* number, and sector number (s) for an imaginary, very small disk.*/
/*******************************************************************/
# include <stdio.h>
# define MAXC 5
# define MAXT 10
# define MAXS 4
int main(void)
{
int c, t, s;
printf(" c t s SectorId n");
for (c = 0; c < MAXC; c++)
{
for (t = 0; t < MAXT; t++)
{
for (s = 0; s < MAXS; s++)
{
printf("%2d %2d %2d %6d n", c, t, s,
((c * MAXT) + t) * MAXS + s);
}
}
}
return 0;
}
OUTPUT
c t s SectorId
0 0 0
0 0 1
0 0 2
0 0 3
0 1 0
0 1 1
0 1 2
0 1 3
0 2 0
0 2 1
0 2 2
0 2 3
0 3 0
0 3 1
0 3 2
0 3 3
...
0 9 0
0 9 1
0 9 2
0 9 3
1 0 0
1 0 1
1 0 2
1 0 3
1 1 0
1 1 1
1 1 2
1 1 3
1 2 0
1 2 1
1 2 2
1 2 3
...
4 7 0
4 7 1
4 7 2
4 7 3
4 8 0
4 8 1
4 8 2
4 8 3
4 9 0
4 9 1
4 9 2
4 9 3
For example, data are read from the top and then the bottom of the first track of a platter. Then data are read from the same track on the top of the next platter, and so on. Once the first track of each platter has been read, the heads are moved to the next track, and reading starts at the top again.
Example: /dev/rdsk/dks1d5vh (Available only to root! (Mercury))
fujitsu 2322 type = winchester ns#32 = number of sectors per track nt#10 = number of tracks per cylinder nc#823 = number of cylinders (concentric circles) 1024 bytes = number of bytes per sector
Two approaches to rotation: