Deleted Added
full compact
itime.c (50476) itime.c (71787)
1/*-
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93";
37#endif
38static const char rcsid[] =
1/*-
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/sbin/dump/itime.c 50476 1999-08-28 00:22:10Z peter $";
39 "$FreeBSD: head/sbin/dump/itime.c 71787 2001-01-29 09:45:51Z phk $";
40#endif /* not lint */
41
42#include <sys/param.h>
40#endif /* not lint */
41
42#include <sys/param.h>
43#include <sys/queue.h>
43#include <sys/time.h>
44#ifdef sunos
45#include <sys/vnode.h>
46
47#include <ufs/fsdir.h>
48#include <ufs/inode.h>
49#include <ufs/fs.h>
50#else

--- 7 unchanged lines hidden (view full) ---

58#include <stdio.h>
59#ifdef __STDC__
60#include <stdlib.h>
61#include <string.h>
62#endif
63
64#include "dump.h"
65
44#include <sys/time.h>
45#ifdef sunos
46#include <sys/vnode.h>
47
48#include <ufs/fsdir.h>
49#include <ufs/inode.h>
50#include <ufs/fs.h>
51#else

--- 7 unchanged lines hidden (view full) ---

59#include <stdio.h>
60#ifdef __STDC__
61#include <stdlib.h>
62#include <string.h>
63#endif
64
65#include "dump.h"
66
67struct dumptime {
68 struct dumpdates dt_value;
69 SLIST_ENTRY(dumptime) dt_list;
70};
71SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
66struct dumpdates **ddatev = 0;
67int nddates = 0;
68int ddates_in = 0;
72struct dumpdates **ddatev = 0;
73int nddates = 0;
74int ddates_in = 0;
69struct dumptime *dthead = 0;
70
71static void dumprecout __P((FILE *, struct dumpdates *));
72static int getrecord __P((FILE *, struct dumpdates *));
73static int makedumpdate __P((struct dumpdates *, char *));
74static void readdumptimes __P((FILE *));
75
76void
77initdumptimes()

--- 34 unchanged lines hidden (view full) ---

112 register int i;
113 register struct dumptime *dtwalk;
114
115 for (;;) {
116 dtwalk = (struct dumptime *)calloc(1, sizeof (struct dumptime));
117 if (getrecord(df, &(dtwalk->dt_value)) < 0)
118 break;
119 nddates++;
75
76static void dumprecout __P((FILE *, struct dumpdates *));
77static int getrecord __P((FILE *, struct dumpdates *));
78static int makedumpdate __P((struct dumpdates *, char *));
79static void readdumptimes __P((FILE *));
80
81void
82initdumptimes()

--- 34 unchanged lines hidden (view full) ---

117 register int i;
118 register struct dumptime *dtwalk;
119
120 for (;;) {
121 dtwalk = (struct dumptime *)calloc(1, sizeof (struct dumptime));
122 if (getrecord(df, &(dtwalk->dt_value)) < 0)
123 break;
124 nddates++;
120 dtwalk->dt_next = dthead;
121 dthead = dtwalk;
125 SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list);
122 }
123
124 ddates_in = 1;
125 /*
126 * arrayify the list, leaving enough room for the additional
127 * record that we may have to add to the ddate structure
128 */
129 ddatev = (struct dumpdates **)
130 calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *));
126 }
127
128 ddates_in = 1;
129 /*
130 * arrayify the list, leaving enough room for the additional
131 * record that we may have to add to the ddate structure
132 */
133 ddatev = (struct dumpdates **)
134 calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *));
131 dtwalk = dthead;
132 for (i = nddates - 1; i >= 0; i--, dtwalk = dtwalk->dt_next)
135 dtwalk = SLIST_FIRST(&dthead);
136 for (i = nddates - 1; i >= 0; i--, dtwalk = SLIST_NEXT(dtwalk, dt_list))
133 ddatev[i] = &dtwalk->dt_value;
134}
135
136void
137getdumptime()
138{
139 register struct dumpdates *ddp;
140 register int i;

--- 38 unchanged lines hidden (view full) ---

179 if ((df = fopen(dumpdates, "r+")) == NULL)
180 quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno));
181 fd = fileno(df);
182 (void) flock(fd, LOCK_EX);
183 fname = disk;
184 free((char *)ddatev);
185 ddatev = 0;
186 nddates = 0;
137 ddatev[i] = &dtwalk->dt_value;
138}
139
140void
141getdumptime()
142{
143 register struct dumpdates *ddp;
144 register int i;

--- 38 unchanged lines hidden (view full) ---

183 if ((df = fopen(dumpdates, "r+")) == NULL)
184 quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno));
185 fd = fileno(df);
186 (void) flock(fd, LOCK_EX);
187 fname = disk;
188 free((char *)ddatev);
189 ddatev = 0;
190 nddates = 0;
187 dthead = 0;
188 ddates_in = 0;
189 readdumptimes(df);
190 if (fseek(df, 0L, 0) < 0)
191 quit("fseek: %s\n", strerror(errno));
192 spcl.c_ddate = 0;
193 ITITERATE(i, dtwalk) {
194 if (strncmp(fname, dtwalk->dd_name,
195 sizeof (dtwalk->dd_name)) != 0)

--- 79 unchanged lines hidden ---
191 ddates_in = 0;
192 readdumptimes(df);
193 if (fseek(df, 0L, 0) < 0)
194 quit("fseek: %s\n", strerror(errno));
195 spcl.c_ddate = 0;
196 ITITERATE(i, dtwalk) {
197 if (strncmp(fname, dtwalk->dd_name,
198 sizeof (dtwalk->dd_name)) != 0)

--- 79 unchanged lines hidden ---