diff --git a/debian/rules b/debian/rules index 2f722aa6..7e8d01db 100755 --- a/debian/rules +++ b/debian/rules @@ -425,10 +425,6 @@ ifneq ($(BUILD_E2FSCK_STATIC),no) cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8 endif - # remove static quota library for now - rm ${tmpdir}/usr/include/quota/mkquota.h - find ${tmpdir} -name quota.pc -o -name libquota.a | xargs rm - ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf endif diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in index 5097749a..0f235959 100644 --- a/debugfs/Makefile.in +++ b/debugfs/Makefile.in @@ -18,26 +18,28 @@ MK_CMDS= _SS_DIR_OVERRIDE=../lib/ss ../lib/ss/mk_cmds DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \ lsdel.o dump.o set_fields.o logdump.o htree.o unused.o e2freefrag.o \ - filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o xattrs.o + filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o \ + quota.o xattrs.o RO_DEBUG_OBJS= ro_debug_cmds.o ro_debugfs.o util.o ncheck.o icheck.o ls.o \ lsdel.o logdump.o htree.o e2freefrag.o filefrag.o extent_cmds.o \ - extent_inode.o xattrs.o + extent_inode.o quota.o xattrs.o SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \ $(srcdir)/ncheck.c $(srcdir)/icheck.c $(srcdir)/lsdel.c \ $(srcdir)/dump.c $(srcdir)/set_fields.c ${srcdir}/logdump.c \ $(srcdir)/htree.c $(srcdir)/unused.c ${srcdir}/../misc/e2freefrag.c \ $(srcdir)/filefrag.c $(srcdir)/extent_inode.c $(srcdir)/zap.c \ - $(srcdir)/../misc/create_inode.c $(srcdir)/xattrs.c + $(srcdir)/../misc/create_inode.c $(srcdir)/xattrs.c $(srcdir)/quota.c -LIBS= $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \ +LIBS= $(LIBQUOTA) $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \ $(LIBUUID) $(SYSLIBS) -DEPLIBS= $(LIBEXT2FS) $(LIBE2P) $(DEPLIBSS) $(DEPLIBCOM_ERR) \ +DEPLIBS= $(DEPLIBQUOTA) $(LIBEXT2FS) $(LIBE2P) $(DEPLIBSS) $(DEPLIBCOM_ERR) \ $(DEPLIBBLKID) $(DEPLIBUUID) -STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBSS) $(STATIC_LIBCOM_ERR) \ - $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(STATIC_LIBE2P) $(SYSLIBS) +STATIC_LIBS= $(STATIC_LIBQUOTA) $(STATIC_LIBEXT2FS) $(STATIC_LIBSS) \ + $(STATIC_LIBCOM_ERR) $(STATIC_LIBBLKID) $(STATIC_LIBUUID) \ + $(STATIC_LIBE2P) $(SYSLIBS) STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBSS) \ $(DEPSTATIC_LIBCOM_ERR) $(DEPSTATIC_LIBUUID) \ $(DEPSTATIC_LIBE2P) @@ -147,8 +149,11 @@ debugfs.o: $(srcdir)/debugfs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h $(top_srcdir)/version.h $(srcdir)/jfs_user.h \ + $(srcdir)/../misc/create_inode.h \ + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/version.h $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ $(top_srcdir)/lib/ext2fs/kernel-list.h util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ @@ -160,7 +165,9 @@ util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h ls.o: $(srcdir)/ls.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -169,7 +176,9 @@ ls.o: $(srcdir)/ls.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h ncheck.o: $(srcdir)/ncheck.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -178,7 +187,9 @@ ncheck.o: $(srcdir)/ncheck.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h icheck.o: $(srcdir)/icheck.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -187,7 +198,9 @@ icheck.o: $(srcdir)/icheck.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h lsdel.o: $(srcdir)/lsdel.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -196,7 +209,9 @@ lsdel.o: $(srcdir)/lsdel.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h dump.o: $(srcdir)/dump.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -205,7 +220,9 @@ dump.o: $(srcdir)/dump.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h set_fields.o: $(srcdir)/set_fields.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -214,7 +231,10 @@ set_fields.o: $(srcdir)/set_fields.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ - $(srcdir)/../misc/nls-enable.h + $(srcdir)/../misc/nls-enable.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(top_srcdir)/lib/e2p/e2p.h logdump.o: $(srcdir)/logdump.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -225,7 +245,11 @@ logdump.o: $(srcdir)/logdump.c $(top_builddir)/lib/config.h \ $(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ $(srcdir)/../misc/nls-enable.h $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h + $(top_srcdir)/lib/ext2fs/kernel-list.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(srcdir)/jfs_user.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ + $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h htree.o: $(srcdir)/htree.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ @@ -293,4 +317,60 @@ xattrs.o: $(srcdir)/xattrs.c $(srcdir)/debugfs.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/jfs_user.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ - $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h + $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(top_srcdir)/lib/e2p/e2p.h +unused.o: $(srcdir)/unused.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ + $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h +e2freefrag.o: $(srcdir)/../misc/e2freefrag.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ + $(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ + $(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(srcdir)/../misc/e2freefrag.h +filefrag.o: $(srcdir)/filefrag.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ + $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h +extent_inode.o: $(srcdir)/extent_inode.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ + $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h +zap.o: $(srcdir)/zap.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ + $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h +quota.o: $(srcdir)/quota.c $(top_builddir)/lib/config.h \ + $(top_builddir)/lib/dirpaths.h $(srcdir)/debugfs.h $(top_srcdir)/lib/ss/ss.h \ + $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ + $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h diff --git a/debugfs/debug_cmds.ct b/debugfs/debug_cmds.ct index 666032bf..814fd529 100644 --- a/debugfs/debug_cmds.ct +++ b/debugfs/debug_cmds.ct @@ -202,5 +202,11 @@ request do_set_xattr, "Set an extended attribute of an inode", request do_rm_xattr, "Remove an extended attribute of an inode", ea_rm; +request do_list_quota, "List quota", + list_quota, lq; + +request do_get_quota, "Get quota", + get_quota, gq; + end; diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 72ab0406..23a7ca39 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -43,8 +43,9 @@ ss_request_table *extra_cmds; const char *debug_prog_name; int sci_idx; -ext2_filsys current_fs; -ext2_ino_t root, cwd; +ext2_filsys current_fs; +quota_ctx_t current_qctx; +ext2_ino_t root, cwd; static void open_filesystem(char *device, int open_flags, blk64_t superblock, blk64_t blocksize, int catastrophic, @@ -226,6 +227,8 @@ static void close_filesystem(NOARGS) if (retval) com_err("ext2fs_write_block_bitmap", retval, 0); } + if (current_qctx) + quota_release_context(¤t_qctx); retval = ext2fs_close(current_fs); if (retval) com_err("ext2fs_close", retval, 0); diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h index 0164ca5d..df51aa06 100644 --- a/debugfs/debugfs.h +++ b/debugfs/debugfs.h @@ -6,6 +6,7 @@ #include "ext2fs/ext2_fs.h" #include "ext2fs/ext2fs.h" #include "../misc/create_inode.h" +#include "quota/quotaio.h" #ifdef __STDC__ #define NOARGS void @@ -22,6 +23,7 @@ #define CHECK_FS_NOTOPEN 0x0004 extern ext2_filsys current_fs; +extern quota_ctx_t current_qctx; extern ext2_ino_t root, cwd; extern int sci_idx; extern ss_request_table debug_cmds, extent_cmds; @@ -172,6 +174,10 @@ extern void do_set_mmp_value(int argc, char **argv); extern void do_freefrag(int argc, char **argv); extern void do_filefrag(int argc, char *argv[]); +/* quota.c */ +extern void do_list_quota(int argc, char *argv[]); +extern void do_get_quota(int argc, char *argv[]); + /* util.c */ extern time_t string_to_time(const char *arg); diff --git a/debugfs/quota.c b/debugfs/quota.c new file mode 100644 index 00000000..95d064b2 --- /dev/null +++ b/debugfs/quota.c @@ -0,0 +1,171 @@ +/* + * quota.c --- debugfs quota commands + * + * Copyright (C) 2014 Theodore Ts'o. This file may be redistributed + * under the terms of the GNU Public License. + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#else +extern int optind; +extern char *optarg; +#endif + +#include "debugfs.h" + +const char *quota_type[] = { "user", "group", NULL }; + +static int load_quota_ctx(char *progname) +{ + errcode_t retval; + + if (check_fs_open(progname)) + return 1; + + if (!EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super, + EXT4_FEATURE_RO_COMPAT_QUOTA)) { + com_err(progname, 0, "quota feature not eanbled"); + return 1; + } + + if (current_qctx) + return 0; + + retval = quota_init_context(¤t_qctx, current_fs, -1); + if (retval) { + com_err(current_fs->device_name, retval, + "while trying to load quota information"); + return 1; + } + return 0; +} + +static int parse_quota_type(const char *cmdname, const char *str) +{ + errcode_t retval; + char *t; + int flags = 0; + int i; + + for (i = 0; i < MAXQUOTAS; i++) { + if (strcasecmp(str, quota_type[i]) == 0) + break; + } + if (i >= MAXQUOTAS) { + i = strtol(str, &t, 0); + if (*t) + i = -1; + } + if (i < 0 || i >= MAXQUOTAS) { + com_err(0, 0, "Invalid quota type: %s", str); + printf("Valid quota types are: "); + for (i = 0; i < MAXQUOTAS; i++) + printf("%s ", quota_type[i]); + printf("\n"); + return -1; + } + + if (current_fs->flags & EXT2_FLAG_RW) + flags |= EXT2_FILE_WRITE; + + retval = quota_file_open(current_qctx, NULL, 0, i, -1, flags); + if (retval) { + com_err(cmdname, retval, + "while opening quota inode (type %d)", i); + return -1; + } + return i; +} + + +static int list_quota_callback(struct dquot *dq, void *cb_data) +{ + printf("%8u %8lld %8lld %8lld %8lld %8lld %8lld\n", + dq->dq_id, dq->dq_dqb.dqb_curspace, + dq->dq_dqb.dqb_bsoftlimit, dq->dq_dqb.dqb_bhardlimit, + dq->dq_dqb.dqb_curinodes, + dq->dq_dqb.dqb_isoftlimit, dq->dq_dqb.dqb_ihardlimit); + return 0; +} + +void do_list_quota(int argc, char *argv[]) +{ + errcode_t retval; + int i, type; + int flags = 0; + struct quota_handle *qh; + + if (load_quota_ctx(argv[0])) + return; + + if (argc != 2) { + com_err(0, 0, "Usage: list_quota \n"); + return; + } + + type = parse_quota_type(argv[0], argv[1]); + if (type < 0) + return; + + printf("%8s %8s %8s %8s %8s %8s %8s\n", + (type == 0) ? "user id" : "group id", + "blocks", "quota", "limit", "inodes", "quota", "limit"); + qh = current_qctx->quota_file[type]; + retval = qh->qh_ops->scan_dquots(qh, list_quota_callback, NULL); + if (retval) { + com_err(argv[0], retval, "while scanning dquots"); + return; + } +} + +void do_get_quota(int argc, char *argv[]) +{ + errcode_t retval; + int i, err, type; + int flags = 0; + struct quota_handle *qh; + struct dquot *dq; + qid_t id; + + if (load_quota_ctx(argv[0])) + return; + + if (argc != 3) { + com_err(0, 0, "Usage: get_quota \n"); + return; + } + + type = parse_quota_type(argv[0], argv[1]); + if (type < 0) + return; + + id = parse_ulong(argv[2], argv[0], "id", &err); + if (err) + return; + + printf("%8s %8s %8s %8s %8s %8s %8s\n", + (type == 0) ? "user id" : "group id", + "blocks", "quota", "limit", "inodes", "quota", "limit"); + + qh = current_qctx->quota_file[type]; + + dq = qh->qh_ops->read_dquot(qh, id); + if (dq) { + list_quota_callback(dq, NULL); + ext2fs_free_mem(&dq); + } else + com_err(argv[0], 0, "couldn't read quota record"); + +} diff --git a/debugfs/ro_debug_cmds.ct b/debugfs/ro_debug_cmds.ct index 8226d1ad..736ade6a 100644 --- a/debugfs/ro_debug_cmds.ct +++ b/debugfs/ro_debug_cmds.ct @@ -90,5 +90,10 @@ request do_dump_mmp, "Dump MMP information", request do_extent_open, "Open inode for extent manipulation", extent_open, eo; -end; +request do_list_quota, "List quota", + lost_quota, lq; +request do_get_quota, "Get quota", + get_quota, gq; + +end; diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in index 5a6883a6..91349579 100644 --- a/e2fsck/Makefile.in +++ b/e2fsck/Makefile.in @@ -281,7 +281,7 @@ e2fsck.o: $(srcdir)/e2fsck.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ + $(srcdir)/profile.h prof_err.h \ $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ $(srcdir)/problem.h @@ -294,10 +294,9 @@ super.o: $(srcdir)/super.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h pass1.o: $(srcdir)/pass1.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -305,10 +304,9 @@ pass1.o: $(srcdir)/pass1.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h pass1b.o: $(srcdir)/pass1b.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ @@ -316,10 +314,9 @@ pass1b.o: $(srcdir)/pass1b.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h $(srcdir)/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h $(srcdir)/dict.h pass2.o: $(srcdir)/pass2.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -327,10 +324,9 @@ pass2.o: $(srcdir)/pass2.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h $(srcdir)/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h $(srcdir)/dict.h pass3.o: $(srcdir)/pass3.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -338,10 +334,9 @@ pass3.o: $(srcdir)/pass3.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h pass4.o: $(srcdir)/pass4.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -349,10 +344,9 @@ pass4.o: $(srcdir)/pass4.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h pass5.o: $(srcdir)/pass5.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -360,10 +354,9 @@ pass5.o: $(srcdir)/pass5.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h journal.o: $(srcdir)/journal.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -371,11 +364,11 @@ journal.o: $(srcdir)/journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ + $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \ + $(srcdir)/problem.h recovery.o: $(srcdir)/recovery.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -383,11 +376,10 @@ recovery.o: $(srcdir)/recovery.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ + $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h revoke.o: $(srcdir)/revoke.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/jfs_user.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -395,11 +387,10 @@ revoke.o: $(srcdir)/revoke.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ - $(top_srcdir)/lib/ext2fs/kernel-list.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \ + $(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ @@ -407,9 +398,9 @@ badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -417,9 +408,9 @@ util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h unix.o: $(srcdir)/unix.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/e2p/e2p.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -427,10 +418,10 @@ unix.o: $(srcdir)/unix.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h $(top_srcdir)/version.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h \ + $(top_srcdir)/version.h dirinfo.o: $(srcdir)/dirinfo.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -438,10 +429,9 @@ dirinfo.o: $(srcdir)/dirinfo.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(top_srcdir)/lib/ext2fs/tdb.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/lib/ext2fs/tdb.h dx_dirinfo.o: $(srcdir)/dx_dirinfo.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -449,9 +439,9 @@ dx_dirinfo.o: $(srcdir)/dx_dirinfo.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h ehandler.o: $(srcdir)/ehandler.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -459,9 +449,9 @@ ehandler.o: $(srcdir)/ehandler.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h problem.o: $(srcdir)/problem.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -469,10 +459,9 @@ problem.o: $(srcdir)/problem.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h $(srcdir)/problemP.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h $(srcdir)/problemP.h message.o: $(srcdir)/message.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -480,10 +469,9 @@ message.o: $(srcdir)/message.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h ea_refcount.o: $(srcdir)/ea_refcount.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -491,9 +479,9 @@ ea_refcount.o: $(srcdir)/ea_refcount.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h rehash.o: $(srcdir)/rehash.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -501,10 +489,9 @@ rehash.o: $(srcdir)/rehash.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h region.o: $(srcdir)/region.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -512,9 +499,9 @@ region.o: $(srcdir)/region.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h profile.o: $(srcdir)/profile.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/profile.h prof_err.h @@ -525,9 +512,9 @@ sigcatcher.o: $(srcdir)/sigcatcher.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h logfile.o: $(srcdir)/logfile.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ @@ -535,18 +522,7 @@ logfile.o: $(srcdir)/logfile.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h + $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \ + $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h prof_err.o: prof_err.c -quota.o: $(srcdir)/quota.c $(top_builddir)/lib/config.h \ - $(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \ - $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \ - $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ - $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ - $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/mkquota.h \ - $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ - $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ - $(srcdir)/problem.h $(top_srcdir)/lib/quota/quotaio.h diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 7c7a6dd3..331306f1 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -67,7 +67,7 @@ #define E2FSCK_ATTR(x) #endif -#include "quota/mkquota.h" +#include "quota/quotaio.h" /* * Exit codes used by fsck-type programs diff --git a/e2fsck/quota.c b/e2fsck/quota.c index 42569bb9..c6bbb9af 100644 --- a/e2fsck/quota.c +++ b/e2fsck/quota.c @@ -15,7 +15,6 @@ #include "e2fsck.h" #include "problem.h" -#include "quota/mkquota.h" #include "quota/quotaio.h" static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index 97fd066b..ba2b2c4e 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -667,7 +667,7 @@ expanddir.o: $(srcdir)/expanddir.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h + $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h ext_attr.o: $(srcdir)/ext_attr.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2_ext_attr.h \ @@ -834,7 +834,7 @@ mkdir.o: $(srcdir)/mkdir.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h + $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h mkjournal.o: $(srcdir)/mkjournal.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/e2p/e2p.h \ @@ -884,7 +884,7 @@ punch.o: $(srcdir)/punch.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ - $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h + $(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(srcdir)/ext2fsP.h qcow2.o: $(srcdir)/qcow2.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2_fs.h \ diff --git a/lib/quota/Makefile.in b/lib/quota/Makefile.in index 6c3318c8..87fa08f8 100644 --- a/lib/quota/Makefile.in +++ b/lib/quota/Makefile.in @@ -12,9 +12,6 @@ INSTALL = @INSTALL@ all:: -SMANPAGES= - - OBJS= mkquota.o quotaio.o quotaio_v2.o quotaio_tree.o dict.o SRCS= $(srcdir)/mkquota.c \ @@ -54,12 +51,6 @@ LIBDIR= quota #ELF_CMT# $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< #BSDLIB_CMT# $(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $< -all:: $(SMANPAGES) quota.pc - -quota.pc: $(srcdir)/quota.pc.in $(top_builddir)/config.status - $(E) " CONFIG.STATUS $@" - $(Q) cd $(top_builddir); CONFIG_FILES=lib/quota/quota.pc ./config.status - dict.o: $(E) " CC $<" $(Q) $(CC) -c $(ALL_CFLAGS) $(top_srcdir)/e2fsck/dict.c -o $@ @@ -73,32 +64,10 @@ dict.o: #BSDLIB_CMT# $(top_srcdir)/e2fsck/dict.c installdirs:: - $(E) " MKINSTALLDIRS $(libdir) $(includedir)/quota $(man3dir)" - $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ - $(DESTDIR)$(includedir)/quota $(DESTDIR)$(man3dir) \ - $(DESTDIR)$(pkgconfigdir) -install:: all installdirs - $(E) " INSTALL_DATA $(libdir)/libquota.a" - $(Q) $(INSTALL_DATA) libquota.a $(DESTDIR)$(libdir)/libquota.a - -$(Q) $(RANLIB) $(DESTDIR)$(libdir)/libquota.a - $(Q) $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libquota.a - $(E) " INSTALL_DATA $(includedir)/quota/mkquota.h" - $(Q) $(INSTALL_DATA) $(srcdir)/mkquota.h $(DESTDIR)$(includedir)/quota/mkquota.h - $(Q) for i in $(SMANPAGES); do \ - $(RM) -f $(DESTDIR)$(man3dir)/$$i.gz; \ - echo " INSTALL_DATA $(man3dir)/$$i"; \ - $(INSTALL_DATA) $$i $(DESTDIR)$(man3dir)/$$i; \ - done - $(E) " INSTALL_DATA $(pkgconfigdir)/quota.pc" - $(Q) $(INSTALL_DATA) quota.pc $(DESTDIR)$(pkgconfigdir)/quota.pc +install:: all uninstall:: - $(RM) -f $(DESTDIR)$(libdir)/libquota.a \ - $(DESTDIR)$(pkgconfigdir)/quota.pc - for i in $(SMANPAGES); do \ - $(RM) -f $(DESTDIR)$(man3dir)/$$i; \ - done clean:: $(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/* @@ -109,7 +78,7 @@ clean:: mostlyclean:: clean distclean:: clean - $(RM) -f .depend Makefile quota.pc \ + $(RM) -f .depend Makefile \ $(srcdir)/TAGS $(srcdir)/Makefile.in.old # @@ -133,33 +102,35 @@ mkquota.o: $(srcdir)/mkquota.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/quotaio.h $(srcdir)/dqblk_v2.h \ - $(srcdir)/quotaio_tree.h $(srcdir)/quotaio_v2.h $(srcdir)/mkquota.h \ - $(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/common.h + $(srcdir)/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(srcdir)/quotaio_v2.h $(srcdir)/common.h quotaio.o: $(srcdir)/quotaio.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio.h \ - $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ + $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ $(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h + $(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h quotaio_tree.o: $(srcdir)/quotaio_tree.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio_tree.h \ - $(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ - $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/dqblk_v2.h + $(srcdir)/dqblk_v2.h $(top_srcdir)/lib/../e2fsck/dict.h quotaio_v2.o: $(srcdir)/quotaio_v2.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/common.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/quotaio_v2.h \ - $(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ - $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ + $(srcdir)/quotaio.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext3_extents.h \ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2_io.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ - $(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h + $(srcdir)/dqblk_v2.h $(srcdir)/quotaio_tree.h \ + $(top_srcdir)/lib/../e2fsck/dict.h dict.o: $(srcdir)/../../e2fsck/dict.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(srcdir)/../../e2fsck/dict.h diff --git a/lib/quota/common.h b/lib/quota/common.h index 7d324bfc..f1ad79f2 100644 --- a/lib/quota/common.h +++ b/lib/quota/common.h @@ -13,6 +13,7 @@ #include #endif /* EXT2_FLAT_INCLUDES */ +/* #define DEBUG_QUOTA 1 */ #ifndef __attribute__ # if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c index ba8c2da6..58803d04 100644 --- a/lib/quota/mkquota.c +++ b/lib/quota/mkquota.c @@ -18,7 +18,6 @@ #include "quotaio.h" #include "quotaio_v2.h" #include "quotaio_tree.h" -#include "mkquota.h" #include "common.h" /* Needed for architectures where sizeof(int) != sizeof(void *) */ @@ -45,6 +44,21 @@ static void print_inode(struct ext2_inode *inode) return; } + +static void print_dquot(const char *desc, struct dquot *dq) +{ + if (desc) + fprintf(stderr, "%s: ", desc); + fprintf(stderr, "%u %lld:%lld:%lld %lld:%lld:%lld\n", + dq->dq_id, dq->dq_dqb.dqb_curspace, + dq->dq_dqb.dqb_bsoftlimit, dq->dq_dqb.dqb_bhardlimit, + dq->dq_dqb.dqb_curinodes, + dq->dq_dqb.dqb_isoftlimit, dq->dq_dqb.dqb_ihardlimit); +} +#else +static void print_dquot(const char *desc, struct dquot *dq) +{ +} #endif /* @@ -121,6 +135,7 @@ static void write_dquots(dict_t *dict, struct quota_handle *qh) for (n = dict_first(dict); n; n = dict_next(dict, n)) { dq = dnode_get(n); if (dq) { + print_dquot("write", dq); dq->dq_h = qh; update_grace_times(dq); qh->qh_ops->commit_dquot(dq); @@ -168,7 +183,7 @@ errcode_t quota_write_inode(quota_ctx_t qctx, int qtype) } write_dquots(dict, h); - retval = quota_file_close(h); + retval = quota_file_close(qctx, h); if (retval < 0) { log_err("Cannot finish IO on new quotafile: %s", strerror(errno)); @@ -236,9 +251,10 @@ static void quota_dnode_free(dnode_t *node, */ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype) { - int i, err = 0; + errcode_t err; dict_t *dict; quota_ctx_t ctx; + int i; err = ext2fs_get_mem(sizeof(struct quota_ctx), &ctx); if (err) { @@ -248,6 +264,7 @@ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype) memset(ctx, 0, sizeof(struct quota_ctx)); for (i = 0; i < MAXQUOTAS; i++) { + ctx->quota_file[i] = NULL; if ((qtype != -1) && (i != qtype)) continue; err = ext2fs_get_mem(sizeof(dict_t), &dict); @@ -268,6 +285,7 @@ errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype) void quota_release_context(quota_ctx_t *qctx) { + errcode_t err; dict_t *dict; int i; quota_ctx_t ctx; @@ -283,6 +301,14 @@ void quota_release_context(quota_ctx_t *qctx) dict_free_nodes(dict); free(dict); } + if (ctx->quota_file[i]) { + err = quota_file_close(ctx, ctx->quota_file[i]); + if (err) { + log_err("Cannot close quotafile: %s", + strerror(errno)); + ext2fs_free_mem(&ctx->quota_file[i]); + } + } } *qctx = NULL; free(ctx); @@ -442,7 +468,10 @@ static int scan_dquots_callback(struct dquot *dquot, void *cb_data) dq = get_dq(quota_dict, dquot->dq_id); dq->dq_id = dquot->dq_id; - dq->dq_dqb.u.v2_mdqb.dqb_off = dquot->dq_dqb.u.v2_mdqb.dqb_off; + dq->dq_flags |= DQF_SEEN; + + print_dquot("mem", dq); + print_dquot("dsk", dquot); /* Check if there is inconsistancy. */ if (dq->dq_dqb.dqb_curspace != dquot->dq_dqb.dqb_curspace || @@ -523,7 +552,7 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino, int type) return err; } - err = quota_file_open(qh, qctx->fs, qf_ino, type, -1, 0); + err = quota_file_open(qctx, qh, qf_ino, type, -1, 0); if (err) { log_err("Open quota file failed"); goto out; @@ -531,7 +560,7 @@ errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino, int type) quota_read_all_dquots(qh, qctx, 1); - err = quota_file_close(qh); + err = quota_file_close(qctx, qh); if (err) { log_err("Cannot finish IO on new quotafile: %s", strerror(errno)); @@ -554,15 +583,15 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype, ext2_filsys fs = qctx->fs; struct quota_handle qh; struct scan_dquots_data scan_data; - ext2_ino_t qf_ino; + struct dquot *dq; + dnode_t *n; + dict_t *dict = qctx->quota_dict[qtype]; errcode_t err = 0; - if (!qctx->quota_dict[qtype]) + if (!dict) goto out; - qf_ino = qtype == USRQUOTA ? fs->super->s_usr_quota_inum : - fs->super->s_grp_quota_inum; - err = quota_file_open(&qh, fs, qf_ino, qtype, -1, 0); + err = quota_file_open(qctx, &qh, 0, qtype, -1, 0); if (err) { log_err("Open quota file failed"); goto out; @@ -575,10 +604,28 @@ errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype, err = qh.qh_ops->scan_dquots(&qh, scan_dquots_callback, &scan_data); if (err) { log_err("Error scanning dquots"); - goto out; + goto out_close_qh; + } + + for (n = dict_first(dict); n; n = dict_next(dict, n)) { + dq = dnode_get(n); + if (!dq) + continue; + if ((dq->dq_flags & DQF_SEEN) == 0) { + fprintf(stderr, "[QUOTA WARNING] " + "Missing quota entry ID %d\n", dq->dq_id); + scan_data.usage_is_inconsistent = 1; + } } *usage_inconsistent = scan_data.usage_is_inconsistent; +out_close_qh: + err = quota_file_close(qctx, &qh); + if (err) { + log_err("Cannot close quotafile: %s", error_message(errno)); + if (qh.qh_qf.e2_file) + ext2fs_file_close(qh.qh_qf.e2_file); + } out: return err; } diff --git a/lib/quota/mkquota.h b/lib/quota/mkquota.h deleted file mode 100644 index ee150719..00000000 --- a/lib/quota/mkquota.h +++ /dev/null @@ -1,64 +0,0 @@ -/** mkquota.h - * - * Interface to the quota library. - * - * The quota library provides interface for creating and updating the quota - * files and the ext4 superblock fields. It supports the new VFS_V1 quota - * format. The quota library also provides support for keeping track of quotas - * in memory. - * The typical way to use the quota library is as follows: - * { - * quota_ctx_t qctx; - * - * quota_init_context(&qctx, fs, -1); - * { - * quota_compute_usage(qctx, -1); - * AND/OR - * quota_data_add/quota_data_sub/quota_data_inodes(); - * } - * quota_write_inode(qctx, USRQUOTA); - * quota_write_inode(qctx, GRPQUOTA); - * quota_release_context(&qctx); - * } - * - * This initial version does not support reading the quota files. This support - * will be added in near future. - * - * Aditya Kali - */ - -#ifndef __QUOTA_QUOTAIO_H__ -#define __QUOTA_QUOTAIO_H__ - -#include "ext2fs/ext2_fs.h" -#include "ext2fs/ext2fs.h" -#include "quotaio.h" -#include "../e2fsck/dict.h" - -typedef struct quota_ctx *quota_ctx_t; - -struct quota_ctx { - ext2_filsys fs; - dict_t *quota_dict[MAXQUOTAS]; -}; - -/* In mkquota.c */ -errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype); -void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, - int adjust); -void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, - qsize_t space); -void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, - qsize_t space); -errcode_t quota_write_inode(quota_ctx_t qctx, int qtype); -errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino, int type); -errcode_t quota_compute_usage(quota_ctx_t qctx); -void quota_release_context(quota_ctx_t *qctx); - -errcode_t quota_remove_inode(ext2_filsys fs, int qtype); -int quota_file_exists(ext2_filsys fs, int qtype, int fmt); -void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype); -errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype, - int *usage_inconsistent); - -#endif /* __QUOTA_QUOTAIO_H__ */ diff --git a/lib/quota/quota.pc.in b/lib/quota/quota.pc.in deleted file mode 100644 index 1e4b8874..00000000 --- a/lib/quota/quota.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: quota -Description: Quota management library -Version: @E2FSPROGS_VERSION@ -Requires: -Cflags: -I${includedir}/quota -I${includedir} -Libs: -L${libdir} -lquota diff --git a/lib/quota/quotaio.c b/lib/quota/quotaio.c index 7e98ed75..65fccaa9 100644 --- a/lib/quota/quotaio.c +++ b/lib/quota/quotaio.c @@ -197,11 +197,16 @@ static unsigned int quota_read_nomount(struct quota_file *qf, /* * Detect quota format and initialize quota IO */ -errcode_t quota_file_open(struct quota_handle *h, ext2_filsys fs, +errcode_t quota_file_open(quota_ctx_t qctx, struct quota_handle *h, ext2_ino_t qf_ino, int type, int fmt, int flags) { + ext2_filsys fs = qctx->fs; ext2_file_t e2_file; errcode_t err; + int allocated_handle = 0; + + if (type >= MAXQUOTAS) + return EINVAL; if (fmt == -1) fmt = QFMT_VFS_V1; @@ -210,18 +215,42 @@ errcode_t quota_file_open(struct quota_handle *h, ext2_filsys fs, if (err) return err; + if (qf_ino == 0) { + if (type == USRQUOTA) + qf_ino = fs->super->s_usr_quota_inum; + else + qf_ino = fs->super->s_grp_quota_inum; + } + log_debug("Opening quota ino=%lu, type=%d", qf_ino, type); err = ext2fs_file_open(fs, qf_ino, flags, &e2_file); if (err) { log_err("ext2fs_file_open failed: %s", error_message(err)); return err; } - h->qh_qf.e2_file = e2_file; + if (!h) { + if (qctx->quota_file[type]) { + h = qctx->quota_file[type]; + if (((flags & EXT2_FILE_WRITE) == 0) || + (h->qh_file_flags & EXT2_FILE_WRITE)) + return 0; + (void) quota_file_close(qctx, h); + } + err = ext2fs_get_mem(sizeof(struct quota_handle), &h); + if (err) { + log_err("Unable to allocate quota handle"); + return err; + } + allocated_handle = 1; + } + + h->qh_qf.e2_file = e2_file; h->qh_qf.fs = fs; h->qh_qf.ino = qf_ino; h->e2fs_write = quota_write_nomount; h->e2fs_read = quota_read_nomount; + h->qh_file_flags = flags; h->qh_io_flags = 0; h->qh_type = type; h->qh_fmt = fmt; @@ -231,17 +260,22 @@ errcode_t quota_file_open(struct quota_handle *h, ext2_filsys fs, if (h->qh_ops->check_file && (h->qh_ops->check_file(h, type, fmt) == 0)) { log_err("qh_ops->check_file failed"); - ext2fs_file_close(e2_file); - return -1; + goto errout; } if (h->qh_ops->init_io && (h->qh_ops->init_io(h) < 0)) { log_err("qh_ops->init_io failed"); - ext2fs_file_close(e2_file); - return -1; + goto errout; } + if (allocated_handle) + qctx->quota_file[type] = h; return 0; +errout: + ext2fs_file_close(e2_file); + if (allocated_handle) + ext2fs_free_mem(&h); + return -1; } static errcode_t quota_inode_init_new(ext2_filsys fs, ext2_ino_t ino) @@ -307,12 +341,12 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs, int type, in goto out_err; } h->qh_qf.ino = qf_inum; + h->qh_file_flags = EXT2_FILE_WRITE | EXT2_FILE_CREATE; h->e2fs_write = quota_write_nomount; h->e2fs_read = quota_read_nomount; log_debug("Creating quota ino=%lu, type=%d", qf_inum, type); - err = ext2fs_file_open(fs, qf_inum, - EXT2_FILE_WRITE | EXT2_FILE_CREATE, &e2_file); + err = ext2fs_file_open(fs, qf_inum, h->qh_file_flags, &e2_file); if (err) { log_err("ext2fs_file_open failed: %d", err); goto out_err; @@ -345,7 +379,7 @@ out_err: /* * Close quotafile and release handle */ -errcode_t quota_file_close(struct quota_handle *h) +errcode_t quota_file_close(quota_ctx_t qctx, struct quota_handle *h) { if (h->qh_io_flags & IOFL_INFODIRTY) { if (h->qh_ops->write_info && h->qh_ops->write_info(h) < 0) @@ -356,12 +390,18 @@ errcode_t quota_file_close(struct quota_handle *h) if (h->qh_ops->end_io && h->qh_ops->end_io(h) < 0) return -1; if (h->qh_qf.e2_file) { + __u64 new_size, size; + + new_size = compute_inode_size(h->qh_qf.fs, h->qh_qf.ino); ext2fs_file_flush(h->qh_qf.e2_file); - ext2fs_file_set_size2(h->qh_qf.e2_file, - compute_inode_size(h->qh_qf.fs, h->qh_qf.ino)); + if (ext2fs_file_get_lsize(h->qh_qf.e2_file, &size)) + new_size = 0; + if (size != new_size) + ext2fs_file_set_size2(h->qh_qf.e2_file, new_size); ext2fs_file_close(h->qh_qf.e2_file); } - + if (qctx->quota_file[h->qh_type] == h) + ext2fs_free_mem(&qctx->quota_file[h->qh_type]); return 0; } diff --git a/lib/quota/quotaio.h b/lib/quota/quotaio.h index 1c062f10..7ca7830e 100644 --- a/lib/quota/quotaio.h +++ b/lib/quota/quotaio.h @@ -1,6 +1,32 @@ /** quotaio.h * + * Interface to the quota library. + * + * The quota library provides interface for creating and updating the quota + * files and the ext4 superblock fields. It supports the new VFS_V1 quota + * format. The quota library also provides support for keeping track of quotas + * in memory. + * The typical way to use the quota library is as follows: + * { + * quota_ctx_t qctx; + * + * quota_init_context(&qctx, fs, -1); + * { + * quota_compute_usage(qctx, -1); + * AND/OR + * quota_data_add/quota_data_sub/quota_data_inodes(); + * } + * quota_write_inode(qctx, USRQUOTA); + * quota_write_inode(qctx, GRPQUOTA); + * quota_release_context(&qctx); + * } + * + * This initial version does not support reading the quota files. This support + * will be added in near future. + * + * Aditya Kali * Header of IO operations for quota utilities + * * Jan Kara */ @@ -11,8 +37,10 @@ #include #include +#include "ext2fs/ext2_fs.h" #include "ext2fs/ext2fs.h" #include "dqblk_v2.h" +#include "../e2fsck/dict.h" typedef int64_t qsize_t; /* Type in which we store size limitations */ @@ -20,6 +48,14 @@ typedef int64_t qsize_t; /* Type in which we store size limitations */ #define USRQUOTA 0 #define GRPQUOTA 1 +typedef struct quota_ctx *quota_ctx_t; + +struct quota_ctx { + ext2_filsys fs; + dict_t *quota_dict[MAXQUOTAS]; + struct quota_handle *quota_file[MAXQUOTAS]; +}; + /* * Definitions of magics and versions of current quota files */ @@ -70,6 +106,7 @@ struct quota_file { struct quota_handle { int qh_type; /* Type of quotafile */ int qh_fmt; /* Quotafile format */ + int qh_file_flags; int qh_io_flags; /* IO flags for file */ struct quota_file qh_qf; unsigned int (*e2fs_read)(struct quota_file *qf, ext2_loff_t offset, @@ -104,6 +141,8 @@ struct dquot { struct util_dqblk dq_dqb; /* Parsed data of dquot */ }; +#define DQF_SEEN 0x0001 + /* Structure of quotafile operations */ struct quotafile_ops { /* Check whether quotafile is in our format */ @@ -134,7 +173,7 @@ extern struct quotafile_ops quotafile_ops_meta; /* Open existing quotafile of given type (and verify its format) on given * filesystem. */ -errcode_t quota_file_open(struct quota_handle *h, ext2_filsys fs, +errcode_t quota_file_open(quota_ctx_t qctx, struct quota_handle *h, ext2_ino_t qf_ino, int type, int fmt, int flags); @@ -143,7 +182,7 @@ errcode_t quota_file_create(struct quota_handle *h, ext2_filsys fs, int type, int fmt); /* Close quotafile */ -errcode_t quota_file_close(struct quota_handle *h); +errcode_t quota_file_close(quota_ctx_t qctx, struct quota_handle *h); /* Get empty quota structure */ struct dquot *get_empty_dquot(void); @@ -162,4 +201,25 @@ const char *quota_get_qf_name(int type, int fmt, char *buf); const char *quota_get_qf_path(const char *mntpt, int qtype, int fmt, char *path_buf, size_t path_buf_size); +/* In mkquota.c */ +errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype); +void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, + int adjust); +void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, + qsize_t space); +void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino, + qsize_t space); +errcode_t quota_write_inode(quota_ctx_t qctx, int qtype); +errcode_t quota_update_limits(quota_ctx_t qctx, ext2_ino_t qf_ino, int type); +errcode_t quota_compute_usage(quota_ctx_t qctx); +void quota_release_context(quota_ctx_t *qctx); + +errcode_t quota_remove_inode(ext2_filsys fs, int qtype); +int quota_file_exists(ext2_filsys fs, int qtype, int fmt); +void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype); +errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype, + int *usage_inconsistent); + + + #endif /* GUARD_QUOTAIO_H */ diff --git a/misc/Makefile.in b/misc/Makefile.in index 7bd9b5f3..94fac226 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -631,10 +631,9 @@ tune2fs.o: $(srcdir)/tune2fs.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/e2p/e2p.h $(srcdir)/jfs_user.h \ $(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \ $(top_srcdir)/lib/ext2fs/kernel-list.h $(srcdir)/util.h \ - $(top_srcdir)/lib/quota/mkquota.h $(top_srcdir)/lib/quota/quotaio.h \ - $(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \ - $(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/version.h \ - $(srcdir)/nls-enable.h + $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ + $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ + $(top_srcdir)/version.h $(srcdir)/nls-enable.h mklost+found.o: $(srcdir)/mklost+found.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \ $(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/version.h \ @@ -647,7 +646,7 @@ mke2fs.o: $(srcdir)/mke2fs.c $(top_builddir)/lib/config.h \ $(top_builddir)/lib/ext2fs/ext2_err.h \ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \ $(srcdir)/util.h profile.h prof_err.h $(top_srcdir)/version.h \ - $(top_srcdir)/lib/quota/mkquota.h $(top_srcdir)/lib/ext2fs/ext2fs.h \ + $(top_srcdir)/lib/ext2fs/ext2fs.h \ $(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \ $(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \ $(srcdir)/mke2fs.h $(srcdir)/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \ diff --git a/misc/ext4.5.in b/misc/ext4.5.in index a8ebf678..f08210e2 100644 --- a/misc/ext4.5.in +++ b/misc/ext4.5.in @@ -213,13 +213,6 @@ shared storage environments. @QUOTA_MAN_COMMENT@Causes the quota files (i.e., user.quota and @QUOTA_MAN_COMMENT@group.quota which existed @QUOTA_MAN_COMMENT@in the older quota design) to be hidden inodes. -@QUOTA_MAN_COMMENT@.IP -@QUOTA_MAN_COMMENT@.B Warning: -@QUOTA_MAN_COMMENT@The quota feature is still under development, -@QUOTA_MAN_COMMENT@and may not be fully supported with your kernel -@QUOTA_MAN_COMMENT@or may have various bugs. Please -@QUOTA_MAN_COMMENT@see https://ext4.wiki.kernel.org/index.php/Quota -@QUOTA_MAN_COMMENT@for more details. .TP .B resize_inode .br diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 565389db..522df1ba 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -55,7 +55,7 @@ extern int optind; #include "profile.h" #include "prof_err.h" #include "../version.h" -#include "quota/mkquota.h" +#include "quota/quotaio.h" #include "mke2fs.h" #include "create_inode.h" @@ -384,6 +384,7 @@ static errcode_t packed_allocate_tables(ext2_filsys fs) ext2fs_block_alloc_stats_range(fs, goal, fs->inode_blocks_per_group, +1); ext2fs_inode_table_loc_set(fs, i, goal); + ext2fs_group_desc_csum_set(fs, i); } return 0; } @@ -2239,13 +2240,6 @@ profile_error: "See https://ext4.wiki.kernel.org/" "index.php/Bigalloc for more information\n\n")); - if (!quiet && - (fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_QUOTA)) - fprintf(stderr, "%s", _("\nWarning: the quota feature is " - "still under development\n" - "See https://ext4.wiki.kernel.org/" - "index.php/Quota for more information\n\n")); - /* * Since sparse_super is the default, we would only have a problem * here if it was explicitly disabled. diff --git a/misc/tune2fs.c b/misc/tune2fs.c index f526cd99..f2fe916d 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -60,7 +60,7 @@ extern int optind; #include "jfs_user.h" #include "util.h" #include "blkid/blkid.h" -#include "quota/mkquota.h" +#include "quota/quotaio.h" #include "../version.h" #include "nls-enable.h" @@ -1287,10 +1287,6 @@ static void handle_quota_options(ext2_filsys fs) quota_release_context(&qctx); if ((usrquota == QOPT_ENABLE) || (grpquota == QOPT_ENABLE)) { - fprintf(stderr, "%s", _("\nWarning: the quota feature is still " - "under development\n" - "See https://ext4.wiki.kernel.org/" - "index.php/Quota for more information\n\n")); fs->super->s_feature_ro_compat |= EXT4_FEATURE_RO_COMPAT_QUOTA; ext2fs_mark_super_dirty(fs); } else if (!fs->super->s_usr_quota_inum && diff --git a/resize/resize2fs.c b/resize/resize2fs.c index f9408954..a8af969b 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -2123,7 +2123,7 @@ static errcode_t reserve_sparse_super2_last_group(ext2_resize_t rfs, stderr); exit(1); } - if (old_desc != sb+1) { + if (old_desc && old_desc != sb+1) { fputs(_("Should never happen! Unexpected old_desc in " "super_sparse bg?\n"), stderr); diff --git a/tests/f_quota/debugfs-cmds b/tests/f_quota/debugfs-cmds new file mode 100644 index 00000000..112a3ff1 --- /dev/null +++ b/tests/f_quota/debugfs-cmds @@ -0,0 +1,7 @@ +list_quota user +list_quota group +get_quota user 0 +get_quota user 100 +get_quota user 34 +get_quota group 0 + diff --git a/tests/f_quota/expect.0 b/tests/f_quota/expect.0 new file mode 100644 index 00000000..c0ad63dd --- /dev/null +++ b/tests/f_quota/expect.0 @@ -0,0 +1,21 @@ +debugfs: list_quota user + user id blocks quota limit inodes quota limit + 0 13312 0 0 2 0 0 + 34 1024 0 0 1 0 0 + 100 2048 32 50 2 20 30 +debugfs: list_quota group +group id blocks quota limit inodes quota limit + 0 16384 0 0 5 0 0 +debugfs: get_quota user 0 + user id blocks quota limit inodes quota limit + 0 13312 0 0 2 0 0 +debugfs: get_quota user 100 + user id blocks quota limit inodes quota limit + 100 2048 32 50 2 20 30 +debugfs: get_quota user 34 + user id blocks quota limit inodes quota limit + 34 1024 0 0 1 0 0 +debugfs: get_quota group 0 +group id blocks quota limit inodes quota limit + 0 16384 0 0 5 0 0 +debugfs: diff --git a/tests/f_quota/expect.1 b/tests/f_quota/expect.1 new file mode 100644 index 00000000..0b3b4cf6 --- /dev/null +++ b/tests/f_quota/expect.1 @@ -0,0 +1,13 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +[QUOTA WARNING] Usage inconsistent for ID 0:actual (13312, 2) != expected (14336, 3) +[QUOTA WARNING] Usage inconsistent for ID 100:actual (2048, 2) != expected (1024, 1) +Update quota info for quota type 0? yes + + +test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** +test_filesys: 14/16 files (14.3% non-contiguous), 36/100 blocks +Exit status is 1 diff --git a/tests/f_quota/expect.2 b/tests/f_quota/expect.2 new file mode 100644 index 00000000..bfc558d9 --- /dev/null +++ b/tests/f_quota/expect.2 @@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 14/16 files (14.3% non-contiguous), 36/100 blocks +Exit status is 0 diff --git a/tests/f_quota/image.gz b/tests/f_quota/image.gz new file mode 100644 index 00000000..9cea6556 Binary files /dev/null and b/tests/f_quota/image.gz differ diff --git a/tests/f_quota/name b/tests/f_quota/name new file mode 100644 index 00000000..27ea8baa --- /dev/null +++ b/tests/f_quota/name @@ -0,0 +1 @@ +fix incorrect usage stats in quota diff --git a/tests/f_quota/script b/tests/f_quota/script new file mode 100644 index 00000000..bf25e071 --- /dev/null +++ b/tests/f_quota/script @@ -0,0 +1,4 @@ +AFTER_CMD='$DEBUGFS -f $test_dir/debugfs-cmds $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $test_name.0.log' +PASS_ZERO=true + +. $cmd_dir/run_e2fsck diff --git a/tests/m_quota/expect.1 b/tests/m_quota/expect.1 index a0f65011..787871cd 100644 --- a/tests/m_quota/expect.1 +++ b/tests/m_quota/expect.1 @@ -1,7 +1,3 @@ - -Warning: the quota feature is still under development -See https://ext4.wiki.kernel.org/index.php/Quota for more information - Creating filesystem with 131072 1k blocks and 32768 inodes Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729