summaryrefslogtreecommitdiffstats
path: root/sbin/restore/symtab.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 12:55:19 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 12:55:19 +0000
commit494e7b3a77c6b07213586c03d8ee844304aafe20 (patch)
tree4dfb78949ad3c93600795746b894fcbb170c485f /sbin/restore/symtab.c
parenta4f4635e03e0fdc84d465c0517f302f55961b645 (diff)
downloadFreeBSD-src-494e7b3a77c6b07213586c03d8ee844304aafe20.zip
FreeBSD-src-494e7b3a77c6b07213586c03d8ee844304aafe20.tar.gz
Merge from Lite2
- cleanups, - whiteout support - bug fixes (chflags missing on a few file types etc) The dump/restore folks would want to have a closer look at this, the change is pretty big.
Diffstat (limited to 'sbin/restore/symtab.c')
-rw-r--r--sbin/restore/symtab.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index dc779a3..6895053 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)symtab.c 8.1 (Berkeley) 6/5/93";
+static char sccsid[] = "@(#)symtab.c 8.3 (Berkeley) 4/28/95";
#endif /* not lint */
/*
@@ -83,7 +83,7 @@ lookupino(inum)
{
register struct entry *ep;
- if (inum < ROOTINO || inum >= maxino)
+ if (inum < WINO || inum >= maxino)
return (NULL);
for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next)
if (ep->e_ino == inum)
@@ -101,7 +101,7 @@ addino(inum, np)
{
struct entry **epp;
- if (inum < ROOTINO || inum >= maxino)
+ if (inum < WINO || inum >= maxino)
panic("addino: out of range %d\n", inum);
epp = &entry[inum % entrytblsize];
np->e_ino = inum;
@@ -123,7 +123,7 @@ deleteino(inum)
register struct entry *next;
struct entry **prev;
- if (inum < ROOTINO || inum >= maxino)
+ if (inum < WINO || inum >= maxino)
panic("deleteino: out of range %d\n", inum);
prev = &entry[inum % entrytblsize];
for (next = *prev; next != NULL; next = next->e_next) {
@@ -177,7 +177,7 @@ lookupparent(name)
struct entry *ep;
char *tailindex;
- tailindex = rindex(name, '/');
+ tailindex = strrchr(name, '/');
if (tailindex == NULL)
return (NULL);
*tailindex = '\0';
@@ -202,7 +202,7 @@ myname(ep)
for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
cp -= ep->e_namlen;
- bcopy(ep->e_name, cp, (long)ep->e_namlen);
+ memmove(cp, ep->e_name, (long)ep->e_namlen);
if (ep == lookupino(ROOTINO))
return (cp);
*(--cp) = '/';
@@ -232,7 +232,7 @@ addentry(name, inum, type)
if (freelist != NULL) {
np = freelist;
freelist = np->e_next;
- bzero((char *)np, (long)sizeof(struct entry));
+ memset(np, 0, (long)sizeof(struct entry));
} else {
np = (struct entry *)calloc(1, sizeof(struct entry));
if (np == NULL)
@@ -249,7 +249,7 @@ addentry(name, inum, type)
addino(ROOTINO, np);
return (np);
}
- np->e_name = savename(rindex(name, '/') + 1);
+ np->e_name = savename(strrchr(name, '/') + 1);
np->e_namlen = strlen(np->e_name);
np->e_parent = ep;
np->e_sibling = ep->e_entries;
@@ -333,7 +333,7 @@ moveentry(ep, newname)
ep->e_sibling = np->e_entries;
np->e_entries = ep;
}
- cp = rindex(newname, '/') + 1;
+ cp = strrchr(newname, '/') + 1;
freename(ep->e_name);
ep->e_name = savename(cp);
ep->e_namlen = strlen(cp);
@@ -473,7 +473,7 @@ dumpsymtable(filename, checkpt)
* Assign indicies to each entry
* Write out the string entries
*/
- for (i = ROOTINO; i < maxino; i++) {
+ for (i = WINO; i <= maxino; i++) {
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
ep->e_index = mynum++;
(void) fwrite(ep->e_name, sizeof(char),
@@ -485,10 +485,9 @@ dumpsymtable(filename, checkpt)
*/
tep = &temp;
stroff = 0;
- for (i = ROOTINO; i < maxino; i++) {
+ for (i = WINO; i <= maxino; i++) {
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
- bcopy((char *)ep, (char *)tep,
- (long)sizeof(struct entry));
+ memmove(tep, ep, (long)sizeof(struct entry));
tep->e_name = (char *)stroff;
stroff += allocsize(ep->e_namlen);
tep->e_parent = (struct entry *)ep->e_parent->e_index;
OpenPOWER on IntegriCloud