done
fi
-for ac_header in dirent.h errno.h execinfo.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/falloc.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h
+for ac_header in dirent.h errno.h execinfo.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/falloc.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/quota.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
fi
fi
-for ac_func in chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs backtrace
+for ac_func in chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync quotactl strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs backtrace
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
-AC_CHECK_HEADERS(dirent.h errno.h execinfo.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/falloc.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
+AC_CHECK_HEADERS(dirent.h errno.h execinfo.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/falloc.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/quota.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
[[
#if HAVE_SYS_QUEUE_H
AC_SEARCH_LIBS([blkid_probe_all], [blkid])
fi
dnl
-AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs backtrace)
+AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync quotactl strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs backtrace)
dnl
dnl Check to see if -lsocket is required (solaris) to make something
dnl that uses socket() to compile; this is needed for the UUID library
/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV
+/* Define to 1 if you have the `quotactl' function. */
+#undef HAVE_QUOTACTL
+
/* Define to 1 if dirent has d_reclen */
#undef HAVE_RECLEN_DIRENT
/* Define to 1 if you have the <sys/queue.h> header file. */
#undef HAVE_SYS_QUEUE_H
+/* Define to 1 if you have the <sys/quota.h> header file. */
+#undef HAVE_SYS_QUOTA_H
+
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
errcode_t ext2fs_mmp_start(ext2_filsys fs);
errcode_t ext2fs_mmp_update(ext2_filsys fs);
errcode_t ext2fs_mmp_stop(ext2_filsys fs);
-unsigned ext2fs_mmp_new_seq();
+unsigned ext2fs_mmp_new_seq(void);
/* read_bb.c */
extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_QUOTA_H
+#include <sys/quota.h>
+#endif
#include <unistd.h>
#include <errno.h>
#include <string.h>
char tmp[1024];
qid_t id = (type == USRQUOTA) ? getuid() : getgid();
+#ifdef HAVE_QUOTACTL
if (!quotactl(QCMD(Q_V2_GETQUOTA, type), fs->device_name, id, tmp))
return 1;
+#endif
return 0;
}
static void write_dquots(dict_t *dict, struct quota_handle *qh)
{
- int i = 0;
dnode_t *n;
struct dquot *dq;
- __u32 key;
for (n = dict_first(dict); n; n = dict_next(dict, n)) {
dq = dnode_get(n);
errcode_t write_quota_inode(quota_ctx_t qctx, int qtype)
{
- int retval, i;
- unsigned long qf_inums[MAXQUOTAS];
- struct dquot *dquot;
+ int retval = 0, i;
dict_t *dict;
ext2_filsys fs;
struct quota_handle *h;
int fmt = QFMT_VFS_V1;
if (!qctx)
- return;
+ return 0;
fs = qctx->fs;
h = smalloc(sizeof(struct quota_handle));
}
ext2fs_write_bitmaps(fs);
-out:
free(h);
return retval;
}
errcode_t compute_quota(quota_ctx_t qctx, int qtype)
{
ext2_filsys fs;
- const char *name = "lost+found";
ext2_ino_t ino;
errcode_t ret;
struct ext2_inode inode;
ext2_inode_scan scan;
if (!qctx)
- return;
+ return 0;
fs = qctx->fs;
ret = ext2fs_open_inode_scan(fs, 0, &scan);
#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
/*
- * Quota structure used for communication with userspace via quotactl
- * Following flags are used to specify which fields are valid
- */
-enum {
- QIF_BLIMITS_B = 0,
- QIF_SPACE_B,
- QIF_ILIMITS_B,
- QIF_INODES_B,
- QIF_BTIME_B,
- QIF_ITIME_B,
-};
-
-#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
-#define QIF_SPACE (1 << QIF_SPACE_B)
-#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
-#define QIF_INODES (1 << QIF_INODES_B)
-#define QIF_BTIME (1 << QIF_BTIME_B)
-#define QIF_ITIME (1 << QIF_ITIME_B)
-#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
-#define QIF_USAGE (QIF_SPACE | QIF_INODES)
-#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
-#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
-
-struct if_dqblk {
- __u64 dqb_bhardlimit;
- __u64 dqb_bsoftlimit;
- __u64 dqb_curspace;
- __u64 dqb_ihardlimit;
- __u64 dqb_isoftlimit;
- __u64 dqb_curinodes;
- __u64 dqb_btime;
- __u64 dqb_itime;
- __u32 dqb_valid;
-};
-
-/*
* Structure used for setting quota information about file via quotactl
* Following flags are used to specify which fields are valid
*/
void truncate_quota_inode(ext2_filsys fs, ext2_ino_t ino)
{
struct ext2_inode inode;
- int i;
if (ext2fs_read_inode(fs, ino, &inode))
return;
static ext2_off64_t compute_inode_size(ext2_filsys fs, ext2_ino_t ino)
{
- struct ext2_inode inode;
blk64_t num_blocks = 0;
ext2fs_block_iterate3(fs, ino,
*/
int new_io(struct quota_handle *h, ext2_filsys fs, int type, int fmt)
{
- int fd = 0;
ext2_file_t e2_file;
- const char *mnt_fsname;
- char qf_name[PATH_MAX];
int err;
- struct ext2_inode inode;
unsigned long qf_inum;
- struct stat st;
if (fmt == -1)
fmt = QFMT_VFS_V1;
const char *type2name(int type);
+void update_grace_times(struct dquot *q);
+
#endif /* GUARD_QUOTAIO_H */
static int v2_report(struct quota_handle *h, int verbose);
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
+ .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,
};
#define getdqbuf() smalloc(V2_DQBLKSIZE)