aboutsummaryrefslogtreecommitdiff
path: root/sbin/dump
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2001-01-29 09:45:51 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2001-01-29 09:45:51 +0000
commit941ee632745d1592fb5986960a56ae597f230ec5 (patch)
tree6bd84448b837b2c3c5bf12d7dff705377b8c4d2a /sbin/dump
parent810d0bd1a947d2fb8715f92478ae156f746b9414 (diff)
downloadsrc-941ee632745d1592fb5986960a56ae597f230ec5.tar.gz
src-941ee632745d1592fb5986960a56ae597f230ec5.zip
Use <sys/queue.h> instead of home-rolled list.
Submitted by: "Jason Smethers" <jsmethers@pdq.net>
Notes
Notes: svn path=/head/; revision=71787
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/dump.h7
-rw-r--r--sbin/dump/itime.c15
-rw-r--r--sbin/dump/optr.c10
3 files changed, 16 insertions, 16 deletions
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index 2c907a957389..b41ffda95f98 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -31,6 +31,8 @@
* SUCH DAMAGE.
*
* @(#)dump.h 8.2 (Berkeley) 4/28/95
+ *
+ * $FreeBSD$
*/
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
@@ -166,11 +168,6 @@ struct dumpdates {
char dd_level;
time_t dd_ddate;
};
-struct dumptime {
- struct dumpdates dt_value;
- struct dumptime *dt_next;
-};
-struct dumptime *dthead; /* head of the list version */
int nddates; /* number of records (might be zero) */
int ddates_in; /* we have read the increment file */
struct dumpdates **ddatev; /* the arrayfied version */
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c
index 6209dab66feb..cd60c9efac75 100644
--- a/sbin/dump/itime.c
+++ b/sbin/dump/itime.c
@@ -40,6 +40,7 @@ static const char rcsid[] =
#endif /* not lint */
#include <sys/param.h>
+#include <sys/queue.h>
#include <sys/time.h>
#ifdef sunos
#include <sys/vnode.h>
@@ -63,10 +64,14 @@ static const char rcsid[] =
#include "dump.h"
+struct dumptime {
+ struct dumpdates dt_value;
+ SLIST_ENTRY(dumptime) dt_list;
+};
+SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
struct dumpdates **ddatev = 0;
int nddates = 0;
int ddates_in = 0;
-struct dumptime *dthead = 0;
static void dumprecout __P((FILE *, struct dumpdates *));
static int getrecord __P((FILE *, struct dumpdates *));
@@ -117,8 +122,7 @@ readdumptimes(df)
if (getrecord(df, &(dtwalk->dt_value)) < 0)
break;
nddates++;
- dtwalk->dt_next = dthead;
- dthead = dtwalk;
+ SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list);
}
ddates_in = 1;
@@ -128,8 +132,8 @@ readdumptimes(df)
*/
ddatev = (struct dumpdates **)
calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *));
- dtwalk = dthead;
- for (i = nddates - 1; i >= 0; i--, dtwalk = dtwalk->dt_next)
+ dtwalk = SLIST_FIRST(&dthead);
+ for (i = nddates - 1; i >= 0; i--, dtwalk = SLIST_NEXT(dtwalk, dt_list))
ddatev[i] = &dtwalk->dt_value;
}
@@ -184,7 +188,6 @@ putdumptime()
free((char *)ddatev);
ddatev = 0;
nddates = 0;
- dthead = 0;
ddates_in = 0;
readdumptimes(df);
if (fseek(df, 0L, 0) < 0)
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c
index 57067a2f4617..47c5792cccff 100644
--- a/sbin/dump/optr.c
+++ b/sbin/dump/optr.c
@@ -40,6 +40,7 @@ static const char rcsid[] =
#endif /* not lint */
#include <sys/param.h>
+#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/time.h>
@@ -401,11 +402,11 @@ allocfsent(fs)
}
struct pfstab {
- struct pfstab *pf_next;
+ SLIST_ENTRY(pfstab) pf_list;
struct fstab *pf_fstab;
};
-static struct pfstab *table;
+static SLIST_HEAD(, pfstab) table;
void
getfstab()
@@ -427,8 +428,7 @@ getfstab()
if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL)
quit("%s\n", strerror(errno));
pf->pf_fstab = fs;
- pf->pf_next = table;
- table = pf;
+ SLIST_INSERT_HEAD(&table, pf, pf_list);
}
(void) endfsent();
}
@@ -447,7 +447,7 @@ fstabsearch(key)
register struct fstab *fs;
char *rn;
- for (pf = table; pf != NULL; pf = pf->pf_next) {
+ SLIST_FOREACH(pf, &table, pf_list) {
fs = pf->pf_fstab;
if (strcmp(fs->fs_file, key) == 0 ||
strcmp(fs->fs_spec, key) == 0)