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

Re: e2fsprogs patch for review (new)



On Thu, 2011-10-06 at 04:27 +0200, Guillem Jover wrote:
> On Wed, 2011-10-05 at 15:34:53 +0200, Svante Signell wrote:

> > Ready to submit as a Debian bug?
> 
> It seems the maintainer just uploaded a fixed package today, so some
> or most of your changes might not be needed anymore or might just not
> apply.

The new version have checks for both sys/quota.h and quotactl.

> The value returned is a bool equivalent, so when no quota support, it
> should be 0.

Fixed by the upstream version. And the PATH_MAX stuff is gone. Anyway,
good C-code exercise for me :)

The only remaining patch needed is inlined below. I think it fixes the
build problem for both Hurd and kFreeBSD. The QIF_* stuff is only used
for quota_v2 and kfree seems to have version quota_v1, since their
ufs/quota.h does not have these defined either. Anyway, looking in the
code it seems like the COMMIT_ALL flag is not used:

lib/quota/mkquota.c:qh->qh_ops->commit_dquot(dq, COMMIT_ALL)
lib/quota/quotaio.h:int (*commit_dquot) (struct dquot *dquot, int flag);

lib/quota/quotaio_v2.c:
struct quotafile_ops quotafile_ops_2 = {
        .check_file     = v2_check_file,
        .init_io        = v2_init_io,
        .new_io         = v2_new_io,
        .write_info     = v2_write_info,
        .read_dquot     = v2_read_dquot,
        .commit_dquot   = v2_commit_dquot,
        .scan_dquots    = v2_scan_dquots,
        .report         = v2_report,
};
static int v2_commit_dquot(struct dquot *dquot, int flags)
{
        struct util_dqblk *b = &dquot->dq_dqb;

        if (!b->dqb_curspace && !b->dqb_curinodes && !b->dqb_bsoftlimit
&&
            !b->dqb_isoftlimit && !b->dqb_bhardlimit && !
b->dqb_ihardlimit)
                qtree_delete_dquot(dquot);
        else
                qtree_write_dquot(dquot);
        return 0;
}

Proposed patch
==============
diff -ur e2fsprogs-1.42~WIP-2011-10-05/lib/quota/quotaio.h
e2fsprogs-1.42~WIP-2011-10-05.modified/lib/quota/quotaio.h
--- e2fsprogs-1.42~WIP-2011-10-05/lib/quota/quotaio.h   2011-10-05
01:18:15.000000000 +0200
+++ e2fsprogs-1.42~WIP-2011-10-05.modified/lib/quota/quotaio.h
2011-10-06 09:45:45.000000000 +0200
@@ -14,6 +14,7 @@
 #include "ext2fs/ext2fs.h"
 #include "quota.h"
 #include "dqblk_v2.h"
+#include "config.h"
 
 /*
  * Definitions for disk quotas imposed on the average user
@@ -103,10 +104,14 @@
 
 /* Flags for commit function (have effect only when quota in kernel is
  * turned on) */
+#ifdef HAVE_SYS_QUOTA_H
 #define COMMIT_USAGE QIF_USAGE
 #define COMMIT_LIMITS QIF_LIMITS
 #define COMMIT_TIMES QIF_TIMES
 #define COMMIT_ALL (COMMIT_USAGE | COMMIT_LIMITS | COMMIT_TIMES)
+#else
+#define COMMIT_ALL 0
+#endif
 
 /* Structure of quotafile operations */
 struct quotafile_ops {




Reply to: