Lines Matching defs:df
25 * df -- free disk block report
29 "[-?\n@(#)$Id: df (AT&T Research) 2010-08-11 $\n]"
31 "[+NAME?df - summarize disk free space]"
108 typedef struct /* df entry */
393 register Df_t* df = (Df_t*)handle;
424 else if (!df)
467 s = (df->total || df->ttotal) ? scale(df->fraction, df->avail, df->tavail) : "-";
470 s = (df->total || df->ttotal) ? scale(df->fraction, df->total, df->ttotal) : "-";
473 s = (df->total || df->ttotal) ? (sfsprintf(state.buf, sizeof(state.buf), "%3d%%", df->percent), state.buf) : "-";
480 if (!(s = df->mnt->fs))
484 if (df->total || df->ttotal)
485 n = df->iavail;
490 s = (df->total || df->ttotal) ? (sfsprintf(state.buf, sizeof(state.buf), "%3d%%", df->ipercent), state.buf) : "-";
493 if (df->total || df->ttotal)
494 n = df->itotal;
499 if (df->total || df->ttotal)
500 n = df->iused;
505 if (!(s = df->mnt->dir))
509 if ((n = F_FRSIZE(&df->vfs)) >= 1024)
516 if (!(s = df->mnt->options))
520 if (!(s = df->mnt->type))
524 s = (df->total || df->ttotal) ? scale(df->fraction, df->used, df->tused) : "-";
589 entry(Df_t* df, const char* format)
594 if ((!state.type || strmatch(df->mnt->type, state.type)) && (!state.local || !(df->mnt->flags & MNT_REMOTE)))
596 if (REALITY(df->vfs.f_blocks) == 0)
598 df->total = df->avail = df->used = 0;
599 df->percent = 0;
609 df->total = df->vfs.f_blocks;
610 df->used = ((long)df->vfs.f_blocks <= (long)df->vfs.f_bfree) ? 0 : (df->vfs.f_blocks - df->vfs.f_bfree);
611 df->avail = ((long)df->vfs.f_bavail < 0) ? 0 : df->vfs.f_bavail;
612 df->percent = (df->ttotal = df->avail + df->used) ? (unsigned long)(((double)df->used / (double)df->ttotal + 0.005) * 100.0) : 0;
614 df->fraction = 0;
615 df->ttotal = df->tavail = df->tused = 0;
617 state.block = F_FRSIZE(&df->vfs);
620 b = F_FRSIZE(&df->vfs);
624 df->total *= s;
625 df->avail *= s;
626 df->used *= s;
631 if (df->fraction = s / 10)
633 df->ttotal = (df->total / df->fraction) % 10;
634 df->tavail = (df->avail / df->fraction) % 10;
635 df->tused = (df->used / df->fraction) % 10;
637 df->total /= s;
638 df->avail /= s;
639 df->used /= s;
642 df->itotal = REALITY(df->vfs.f_files);
643 df->iavail = REALITY(df->vfs.f_ffree);
644 if (df->itotal < df->iavail)
645 df->iused = 0;
647 df->iused = df->itotal - df->iavail;
648 df->iavail = REALITY(df->vfs.f_favail);
649 df->ipercent = (s = df->iused + df->iavail) ? (unsigned long)(((double)df->iused / (double)s + 0.005) * 100.0) : 0;
650 sfkeyprintf(sfstdout, df, format, key, NiL);
675 Df_t df;
677 error_info.id = "df";
866 df.mnt = &mnt;
871 if (!status(mnt.fs, &df.vfs))
872 entry(&df, format);
907 while (df.mnt = mntread(mp))
910 if (argv[n] && (i = strlen(df.mnt->dir)) > 1 && i > match[n] && strneq(argv[n], df.mnt->dir, i) && (argv[n][i] == '/' || !argv[n][i]))
915 while (rem && (df.mnt = mntread(mp)))
917 if (match[n] && (i = strlen(df.mnt->dir)) == match[n] && strneq(argv[n], df.mnt->dir, i) && (argv[n][i] == '/' || !argv[n][i]))
920 if (!status(argv[n], &df.vfs))
922 entry(&df, format);
937 while ((!argc || rem) && (df.mnt = mntread(mp)))
939 if (stat(df.mnt->dir, &st))
942 error(state.verbose, "%s: cannot stat", df.mnt->dir);
946 mntdev = (!rem || *df.mnt->fs != '/' || stat(df.mnt->fs, &st)) ? dirdev : st.st_dev;
959 if (!status(df.mnt->dir, &df.vfs) || !status(df.mnt->fs, &df.vfs))
960 entry(&df, format);
976 df.mnt = &mnt;
980 entry(&df, format);