#include <stdio.h>
#include <types.h>
#include <filesys.h>

char buf[512];

_main(argc, argv)
int argc;
char *argv[];
{
    int fd;

    sync();
    fd = open(argv[1], 0);
    if (fd == -1)
    {
	perror("df");
	exit(1);
    }
    read(fd, buf, 512);
    read(fd, buf, 512);
    describe((struct filesys *)buf);
    
    exit(0);
}

describe(fs)
struct filesys *fs;
{
    int j;

    printf("isize %u fsize %u  nfree %d ninode %d tfree %u tinode %u\n",
	fs->s_isize, fs->s_fsize, fs->s_nfree, fs->s_ninode,
	fs->s_tfree, fs->s_tinode);

    for (j=0; j<50; ++j)
    {
	printf("%-6d ",fs->s_free[j]);
	if (j%10 == 9)
 	    printf("\n");
    }

    printf("\n\n");

    for (j=0; j<50; ++j)
    {
	printf("%-6d ",fs->s_inode[j]);
	if (j%10 == 9)
 	    printf("\n");
    }
}

      
