DF-0903 / offsets.c
/* Print byte offsets of every struct fs field we care about for DF-0903. */ #include <stdio.h> #include <stddef.h> #include <stdint.h> #include <sys/types.h> #include <sys/param.h> #include <vfs/ufs/ufs_types.h> #include <vfs/ufs/fs.h> int main(void){ struct fs f; printf("sizeof(struct fs) = %zu\n", sizeof(struct fs)); printf("offsetof fs_bmask = %zu\n", offsetof(struct fs, fs_bmask)); printf("offsetof fs_fmask = %zu\n", offsetof(struct fs, fs_fmask)); printf("offsetof fs_bshift = %zu\n", offsetof(struct fs, fs_bshift)); printf("offsetof fs_fshift = %zu\n", offsetof(struct fs, fs_fshift)); printf("offsetof fs_bsize = %zu\n", offsetof(struct fs, fs_bsize)); printf("offsetof fs_fsize = %zu\n", offsetof(struct fs, fs_fsize)); printf("offsetof fs_frag = %zu\n", offsetof(struct fs, fs_frag)); printf("offsetof fs_inodefmt = %zu\n", offsetof(struct fs, fs_inodefmt)); printf("offsetof fs_qbmask = %zu\n", offsetof(struct fs, fs_qbmask)); printf("offsetof fs_qfmask = %zu\n", offsetof(struct fs, fs_qfmask)); printf("offsetof fs_magic = %zu\n", offsetof(struct fs, fs_magic)); printf("offsetof fs_postblformat = %zu\n", offsetof(struct fs, fs_postblformat)); printf("offsetof fs_sbsize = %zu\n", offsetof(struct fs, fs_sbsize)); return 0; } |