dumpsfs

dumpsfs -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #include <sys/types.h> #include <string.h> #include <stdio.h> #include <assert.h> #include <limits.h> #include <err.h> #include "support.h" #include "kern/sfs.h" #ifdef HOST #include <netinet/in.h> // for arpa/inet.h #include <arpa/inet.h> // for ntohl #include "hostcompat.h" #define SWAPL(x) ntohl(x) #define SWAPS(x) ntohs(x) #else #define SWAPL(x) (x) #define SWAPS(x) (x) #endif #include "disk.h" static u_int32_t dumpsb(void) { struct sfs_super sp; diskread(&sp, SFS_SB_LOCATION); if (SWAPL(sp.sp_magic) != SFS_MAGIC) { errx(1, "Not an sfs filesystem"); } sp.sp_volname[sizeof(sp.sp_volname)-1] = 0; printf("Volume name: %-40s %u blocks\n", sp.sp_volname, SWAPL(sp.sp_nblocks)); return SWAPL(sp.sp_nblocks); } static void dodirblock(u_int32_t block) { struct sfs_dir sds[SFS_BLOCKSIZE/sizeof(struct sfs_dir)]; int nsds = SFS_BLOCKSIZE/sizeof(struct sfs_dir); int i; diskread(&sds, block); printf(" [block %u]\n", block); for (i=0; i<nsds; i++) { u_int32_t ino = SWAPL(sds[i].sfd_ino); if (ino==SFS_NOINO) { printf(" [free entry]\n"); }...
View Full Document

{[ snackBarMessage ]}

Page1 / 3

dumpsfs -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online