#include <fcntl.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <time.h>#include <dirent.h>#include <minix/config.h>#include <minix/com.h>#include "/usr/src/servers/fs/const.h"#include "/usr/src/servers/fs/type.h"#include <errno.h>#include <curses.h>/* Super block table. The root file system and every mounted file system * has an entry here. The entry holds information about the sizes of the bit * maps and inodes. The s_ninodes field gives the number of inodes available * for files and directories, including the root directory. Inode 0 is * on the disk, but not used. Thus s_ninodes = 4 means that 5 bits will be * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4 * for files and directories. The disk layout is: * * Item # blocks * boot block 1 * super block 1 * inode map s_imap_blocks * zone map s_zmap_blocks * inodes (s_ninodes + 'inodes per block' - 1)/'inodes per block' * unused whatever is needed to fill out the current zone * data zones (s_zones - s_firstdatazone) << s_log_zone_size * * A super_block slot is free if s_dev == NO_DEV. */struct super_block { short s_ninodes; /* # usable inodes on the minor device */ short s_nzones; /* total device size, including bit maps etc */ short s_imap_blocks; /* # of blocks used by inode bit map */ short s_zmap_blocks; /* # of blocks used by zone bit map */ short s_firstdatazone; /* number of first data zone */ short s_log_zone_size; /* log2 of blocks/zone */ unsigned long s_max_size; /* maximum file size on this device */ short s_magic; /* magic number to recognize super-blocks */ short s_pad; /* try to avoid compiler-dependent padding */ unsigned long s_zones; /* number of zones (replaces s_nzones in V2) */};#define NIL_SUPER (struct super_block *) 0#define IMAP 0 /* operating on the inode bit map */#define ZMAP 1 /* operating on the zone bit map */int main (int argc, char *argv[]){ int disquete; struct super_block sb; disquete = open("/dev/fd0/",O_RDONLY); /* me paro en el offset 1024 que es donde esta el comienzo del superbloque */ lseek(disquete,1024,SEEK_SET); read(disquete,&sb,sizeof(sb)); /* # usable inodes on the minor device */ close(disquete); printf("usable inodes on the minor device: %d\n",sb.s_ninodes); printf("total device size, including bit maps etc: %d\n",sb.s_nzones); printf("of blocks used by inode bit map %d\n",sb.s_imap_blocks); printf("of blocks used by zone bit map: %d\n",sb.s_zmap_blocks); printf("number of first data zone: %d\n",sb.s_firstdatazone); printf("log2 of blocks/zone: %d\n",sb.s_log_zone_size); printf("maximum file size on this devic: %d\n",sb.s_max_size); printf("magic number to recognize super-blocks: %d\n",sb.s_magic); printf("try to avoid compiler-dependent padding: %d\n",sb.s_pad); printf("number of zones (replaces s_nzones in V2): %d\n",sb.s_zones); exit(0);}