Skip to content

Instantly share code, notes, and snippets.

@moschlar
Created January 30, 2012 13:55
Show Gist options
  • Save moschlar/1704514 to your computer and use it in GitHub Desktop.
Save moschlar/1704514 to your computer and use it in GitHub Desktop.
struct statvfs print function
#include <stdio.h>
#include <sys/statvfs.h>
void pstatvfs(struct statvfs *stat) {
printf("struct statvfs {\n");
printf("\tf_bsize = %lu\n", stat->f_bsize);
printf("\tf_frsize = %lu\n", stat->f_frsize);
printf("\tf_blocks = %d\n", (int) stat->f_blocks);
printf("\tf_bfree = %d\n", (int) stat->f_bfree);
printf("\tf_bavail = %d\n", (int) stat->f_bavail);
printf("\tf_files = %d\n", (int) stat->f_files);
printf("\tf_ffree = %d\n", (int) stat->f_ffree);
printf("\tf_favail = %d\n", (int) stat->f_favail);
printf("\tf_fsid = %lu\n", stat->f_fsid);
printf("\tf_flag = %lu\n", stat->f_flag);
printf("\tf_namemax = %lu\n", stat->f_namemax);
printf("}\n");
}
#ifndef __PSTATVFS_H__
#define __PSTATVFS_H__
void pstatvfs(struct statvfs *stat);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment