Use <sys/queue.h> instead of home-rolled list.

Submitted by:	"Jason Smethers" <jsmethers@pdq.net>
This commit is contained in:
Poul-Henning Kamp 2001-01-29 09:45:51 +00:00
parent 810d0bd1a9
commit 941ee63274
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71787
3 changed files with 16 additions and 16 deletions

View file

@ -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 */

View file

@ -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)

View file

@ -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)