Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add quotadump(8), which is a link to repquota, and quotarest...
details: https://anonhg.NetBSD.org/src/rev/06ed75412314
branches: trunk
changeset: 773680:06ed75412314
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Feb 13 01:35:06 2012 +0000
description:
Add quotadump(8), which is a link to repquota, and quotarestore(8),
which is new. Includes man page updates. Approved by releng for
freeze.
diffstat:
distrib/sets/lists/base/mi | 4 +-
distrib/sets/lists/comp/mi | 4 +-
distrib/sets/lists/man/mi | 8 +-
usr.sbin/Makefile | 4 +-
usr.sbin/quotarestore/Makefile | 10 +
usr.sbin/quotarestore/quotarestore.8 | 76 ++++
usr.sbin/quotarestore/quotarestore.c | 577 +++++++++++++++++++++++++++++++++++
usr.sbin/repquota/Makefile | 5 +-
usr.sbin/repquota/repquota.8 | 12 +-
usr.sbin/repquota/repquota.c | 16 +-
10 files changed, 702 insertions(+), 14 deletions(-)
diffs (truncated from 892 to 300 lines):
diff -r c7b44e8a92cb -r 06ed75412314 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi Mon Feb 13 01:24:00 2012 +0000
+++ b/distrib/sets/lists/base/mi Mon Feb 13 01:35:06 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.981 2012/02/07 19:13:25 joerg Exp $
+# $NetBSD: mi,v 1.982 2012/02/13 01:35:06 dholland Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -1390,8 +1390,10 @@
./usr/sbin/quot base-sysutil-bin
./usr/sbin/quotacheck base-sysutil-bin
./usr/sbin/quotactl base-sysutil-bin
+./usr/sbin/quotadump base-sysutil-bin
./usr/sbin/quotaoff base-sysutil-bin
./usr/sbin/quotaon base-sysutil-bin
+./usr/sbin/quotarestore base-sysutil-bin
./usr/sbin/racoon base-netutil-bin crypto
./usr/sbin/racoonctl base-netutil-bin crypto
./usr/sbin/rarpd base-bootserver-bin
diff -r c7b44e8a92cb -r 06ed75412314 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Mon Feb 13 01:24:00 2012 +0000
+++ b/distrib/sets/lists/comp/mi Mon Feb 13 01:35:06 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1734 2012/02/13 01:24:01 dholland Exp $
+# $NetBSD: mi,v 1.1735 2012/02/13 01:35:06 dholland Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4230,7 +4230,9 @@
./usr/libdata/debug/usr/sbin/quot.debug comp-sysutil-debug debug
./usr/libdata/debug/usr/sbin/quotacheck.debug comp-sysutil-debug debug
./usr/libdata/debug/usr/sbin/quotactl.debug comp-sysutil-debug debug
+./usr/libdata/debug/usr/sbin/quotadump.debug comp-sysutil-debug debug
./usr/libdata/debug/usr/sbin/quotaon.debug comp-sysutil-debug debug
+./usr/libdata/debug/usr/sbin/quotarestore.debug comp-sysutil-debug debug
./usr/libdata/debug/usr/sbin/racoon.debug comp-netutil-debug crypto,debug
./usr/libdata/debug/usr/sbin/racoonctl.debug comp-netutil-debug crypto,debug
./usr/libdata/debug/usr/sbin/rarpd.debug comp-bootserver-debug debug
diff -r c7b44e8a92cb -r 06ed75412314 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Feb 13 01:24:00 2012 +0000
+++ b/distrib/sets/lists/man/mi Mon Feb 13 01:35:06 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1376 2012/02/07 19:13:29 joerg Exp $
+# $NetBSD: mi,v 1.1377 2012/02/13 01:35:08 dholland Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -2699,8 +2699,10 @@
./usr/share/man/cat8/quot.0 man-sysutil-catman .cat
./usr/share/man/cat8/quotacheck.0 man-sysutil-catman .cat
./usr/share/man/cat8/quotactl.0 man-sysutil-catman .cat
+./usr/share/man/cat8/quotadump.0 man-sysutil-catman .cat
./usr/share/man/cat8/quotaoff.0 man-sysutil-catman .cat
./usr/share/man/cat8/quotaon.0 man-sysutil-catman .cat
+./usr/share/man/cat8/quotarestore.0 man-sysutil-catman .cat
./usr/share/man/cat8/racoon.0 man-netutil-catman crypto,.cat
./usr/share/man/cat8/racoonctl.0 man-netutil-catman crypto,.cat
./usr/share/man/cat8/raidctl.0 man-sysutil-catman .cat
@@ -5311,8 +5313,10 @@
./usr/share/man/html8/quot.html man-sysutil-htmlman html
./usr/share/man/html8/quotacheck.html man-sysutil-htmlman html
./usr/share/man/html8/quotactl.html man-sysutil-htmlman html
+./usr/share/man/html8/quotadump.html man-sysutil-htmlman html
./usr/share/man/html8/quotaoff.html man-sysutil-htmlman html
./usr/share/man/html8/quotaon.html man-sysutil-htmlman html
+./usr/share/man/html8/quotarestore.html man-sysutil-htmlman html
./usr/share/man/html8/racoon.html man-netutil-htmlman crypto,html
./usr/share/man/html8/racoonctl.html man-netutil-htmlman crypto,html
./usr/share/man/html8/raidctl.html man-sysutil-htmlman html
@@ -8200,8 +8204,10 @@
./usr/share/man/man8/quot.8 man-sysutil-man .man
./usr/share/man/man8/quotacheck.8 man-sysutil-man .man
./usr/share/man/man8/quotactl.8 man-sysutil-man .man
+./usr/share/man/man8/quotadump.8 man-sysutil-man .man
./usr/share/man/man8/quotaoff.8 man-sysutil-man .man
./usr/share/man/man8/quotaon.8 man-sysutil-man .man
+./usr/share/man/man8/quotarestore.8 man-sysutil-man .man
./usr/share/man/man8/racoon.8 man-netutil-man crypto,.man
./usr/share/man/man8/racoonctl.8 man-netutil-man crypto,.man
./usr/share/man/man8/raidctl.8 man-sysutil-man .man
diff -r c7b44e8a92cb -r 06ed75412314 usr.sbin/Makefile
--- a/usr.sbin/Makefile Mon Feb 13 01:24:00 2012 +0000
+++ b/usr.sbin/Makefile Mon Feb 13 01:35:06 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.261 2012/02/07 19:13:32 joerg Exp $
+# $NetBSD: Makefile,v 1.262 2012/02/13 01:35:08 dholland Exp $
# from: @(#)Makefile 5.20 (Berkeley) 6/12/93
.include <bsd.own.mk>
@@ -21,7 +21,7 @@
ofctl \
paxctl pcictl perfused pppd psrset pstat pwd_mkdb postinstall \
powerd puffs \
- quot quotacheck quotactl quotaon \
+ quot quotacheck quotactl quotaon quotarestore \
rarpd rbootd rdate repquota rmt rpc.bootparamd rpc.lockd \
rpc.pcnfsd rpc.statd rpcbind rwhod \
sa screenblank sdpd services_mkdb sesd schedctl sliplogin spray \
diff -r c7b44e8a92cb -r 06ed75412314 usr.sbin/quotarestore/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/quotarestore/Makefile Mon Feb 13 01:35:06 2012 +0000
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2012/02/13 01:35:09 dholland Exp $
+
+PROG= quotarestore
+SRCS= quotarestore.c
+MAN= quotarestore.8
+
+DPADD= ${LIBQUOTA} ${LIBRPCSVC}
+LDADD= -lquota -lrpcsvc
+
+.include <bsd.prog.mk>
diff -r c7b44e8a92cb -r 06ed75412314 usr.sbin/quotarestore/quotarestore.8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/quotarestore/quotarestore.8 Mon Feb 13 01:35:06 2012 +0000
@@ -0,0 +1,76 @@
+.\" $NetBSD: quotarestore.8,v 1.1 2012/02/13 01:35:09 dholland Exp $
+.\"
+.\" Copyright (c) 2012 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by David A. Holland.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd February 11, 2012
+.Dt QUOTARESTORE 8
+.Os
+.Sh NAME
+.Nm quotarestore
+.Nd restore dumped quota information to a file system volume
+.Sh SYNOPSIS
+.Nm
+.Op Fl d
+.Ar file-system
+.Op Ar dump-file
+.Sh DESCRIPTION
+The
+.Nm
+program restores dumped quota information to a file system.
+The file
+.Ar dump-file
+should be in the format produced with
+.Xr quotadump 8 .
+The quotas, expiration times, and configured grace times listed in the
+dump file are loaded into the named file system.
+The
+.Ar file-system
+argument should be a file or directory on the
+.Pq mounted
+file system, not a device special file.
+.Pp
+If the
+.Fl d
+option is given, quota entries on the file system that are not
+mentioned in the dump file will be deleted.
+Otherwise, they are left alone.
+.Pp
+If the
+.Ar dump-file
+is not specified, standard input is used.
+.Sh SEE ALSO
+.Xr quota 1 ,
+.Xr libquota 3 ,
+.Xr fstab 5 ,
+.Xr edquota 8 ,
+.Xr quotadump 8
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Nx 6.0 .
diff -r c7b44e8a92cb -r 06ed75412314 usr.sbin/quotarestore/quotarestore.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/quotarestore/quotarestore.c Mon Feb 13 01:35:06 2012 +0000
@@ -0,0 +1,577 @@
+/* $NetBSD: quotarestore.c,v 1.1 2012/02/13 01:35:09 dholland Exp $ */
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: quotarestore.c,v 1.1 2012/02/13 01:35:09 dholland Exp $");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <getopt.h>
+#include <limits.h>
+#include <errno.h>
+#include <err.h>
+
+#include <quota.h>
+
+static const char const ws[] = " \t\r\n";
+
+static char **idtypenames;
+static unsigned numidtypes;
+
+static char **objtypenames;
+static unsigned numobjtypes;
+
+////////////////////////////////////////////////////////////
+// table of quota keys
+
+struct qklist {
+ struct quotakey *keys;
+ unsigned num, max;
+};
+
+static struct qklist *
+qklist_create(void)
+{
+ struct qklist *l;
+
+ l = malloc(sizeof(*l));
+ if (l == NULL) {
+ err(EXIT_FAILURE, "malloc");
+ }
+ l->keys = 0;
+ l->num = 0;
+ l->max = 0;
+ return l;
+}
+
+static void
+qklist_destroy(struct qklist *l)
+{
+ free(l->keys);
+ free(l);
+}
+
+static void
+qklist_truncate(struct qklist *l)
+{
+ l->num = 0;
+}
+
+static void
+qklist_add(struct qklist *l, const struct quotakey *qk)
+{
+ assert(l->num <= l->max);
+ if (l->num == l->max) {
+ l->max = l->max ? l->max * 2 : 4;
+ l->keys = realloc(l->keys, l->max * sizeof(l->keys[0]));
+ if (l->keys == NULL) {
+ err(EXIT_FAILURE, "realloc");
+ }
+ }
+ l->keys[l->num++] = *qk;
+}
+
+static int
Home |
Main Index |
Thread Index |
Old Index