#34 Support to specify block limits with units


Quota tools can report block limit in human friendly form using `-s' options, but they cannot understand such values on user input. Following three patches implements this feature at setquota and edquota tools.


  • Petr Písař

    Petr Písař - 2013-01-10


  • Petr Písař

    Petr Písař - 2013-01-10

    Patch 0004 corrects two error messages in previous patches. Patched 0005 and 0006 implements the unites at inode numbers.

  • Jan Kara

    Jan Kara - 2013-01-21

    Thanks. I've merged the patches with some modifications.
    a) I've folded patch 0004 into patch 0001
    b) I've fixed some whitespace damage (spaces at end of line, spaces before tabs)
    c) I've added your Signed-off-by to the patches (please acknowledge you are fine with that)
    d) I've fixed overflow checks in the conversion functions (checking for overflow with number > value doesn't really work when multiplication or shifts are used...).

  • Petr Písař

    Petr Písař - 2013-01-22

    I have no problem with Signed-off.

    Regarding overflow checks, I think they work on unsigned integers. Only conversion from signed type is undefined. Now not all constants in str2number() are marked as unsigned (only the tera multiple is unsigned). I recommend to add the `U' suffix to the literals. (GCC 4.8 will be more aggressive in this area.)

  • Jan Kara

    Jan Kara - 2013-01-29

    You had checks like:
    value = number << 10;
    if (value < number) Overflow....

    But if we use 64-bit type and number == (1 << 54) + (1 << 53), then (number << 10) == (1 << 63) . No value > number but an overflow happened.

    Regarding signed vs unsigned constants - assignment of signed constants to unsigned variables which I do is well defined by the C standard AFAIK. So I see no reason why I should change them. I used ULL for the tera multiple because there the constant doesn't fit into 'int' type so I had to put declare it as (unsigned) long long. But maybe I misunderstood you?

  • Petr Písař

    Petr Písař - 2013-01-31

    You are right. I somehow forgot on less significant bits.

    I don't know much about the constants, but what makes tera value so special from the others? How can you be sure other constants fit into `int' type? You don't have to bother answering, I will try to study the specification more.

  • Jan Kara

    Jan Kara - 2013-02-04
    • status: open --> closed-accepted
  • Jan Kara

    Jan Kara - 2013-02-04

    Ah, that's simple but you won't find it in the standard. I blindly assume int has at least 32 bits. Standard doesn't guarantee this (it actually doesn't guarantee much about type sizes) but in practice all architectures I care about have this. More portable would be to use u32 or similar types but who cares...



Cancel  Add attachments

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks