bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] df: new option: --total (-c) to produce grand total (in the


From: Jim Meyering
Subject: Re: [PATCH] df: new option: --total (-c) to produce grand total (in the same way as du)
Date: Tue, 02 Sep 2008 11:52:57 +0200

Kamil Dudka <address@hidden> wrote:
...
> New patch in attachment.

Hi Kamil,

Thanks for working on this!

You'll want to print totals with --inodes (-i), too.
Please adjust formatting to use spaces before each open parenthesis
and drop the short-named "-c" option.  There is a strong disincentive
to adding new short-named options: they can conflict with other-vendor
versions of df.

It'd be nice to add a test to exercise the code
(with and without -i) and at least check for a final line
matching /^total.../.

> +#define LOG_EQ(a,b) (((a)&&(b))||(!(a)&&!(b)))

This can be written more simply as !((a) ^ (b))

> +/* Add integral value while using uintmax_t for value part and separate
> +   negation flag. It adds value of SRC and SRC_NEG to DEST and DEST_NEG.
> +   The result will be in DEST and DEST_NEG.  See df_readable() to understand
> +   how is the negation flag used. */
> +static void
> +add_uint_with_neg_flag(uintmax_t *dest, bool *dest_neg, uintmax_t src, bool 
> src_neg)

Please split long lines so as not to exceed max length of 80.

...
>  static void
>  show_dev (char const *disk, char const *mount_point,
>         char const *stat_file, char const *fstype,
> -       bool me_dummy, bool me_remote)
> +       bool me_dummy, bool me_remote,
> +       const struct fs_usage *force_fsu)
>  {
>    struct fs_usage fsu;
>    char buf[3][LONGEST_HUMAN_READABLE + 2];
> @@ -296,7 +338,9 @@ show_dev (char const *disk, char const *mount_point,
>    if (!stat_file)
>      stat_file = mount_point ? mount_point : disk;
>
> -  if (get_fs_usage (stat_file, disk, &fsu))
> +  if (force_fsu)
> +    fsu = *force_fsu

Whoops.  missing semicolon above.

> +  else if (get_fs_usage (stat_file, disk, &fsu))
...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]