X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Ftraverse.c;h=80d7e86bf17e18441bb28cf38ac708f59d5d516b;hp=ffcac8842cab2c9f4560ef7a5ccf845db26263ba;hb=e51470bfc05d83f82c37d24504220c7163bbd4c1;hpb=b82d31dc01e8474d503a86fbf52ddf6d74c245e6 diff --git a/dump/traverse.c b/dump/traverse.c index ffcac88..80d7e86 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -2,8 +2,8 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999-2000 - * Stelian Pop - Alcôve , 2000 + * Stelian Pop , 1999-2000 + * Stelian Pop - Alcôve , 2000-2002 */ /*- @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.39 2001/11/11 00:06:39 stelian Exp $"; + "$Id: traverse.c,v 1.41 2002/01/25 14:59:53 stelian Exp $"; #endif /* not lint */ #include @@ -1176,21 +1176,20 @@ dumpmap(char *map, int type, dump_ino_t ino) writerec(cp, 0); } -/* - * Write a header record to the dump tape. - */ #if defined __linux__ && !defined(int32_t) #define int32_t __s32 #endif + +/* + * Compute and fill in checksum information. + */ void -writeheader(dump_ino_t ino) +mkchecksum(union u_spcl *tmpspcl) { - register int32_t sum, cnt, *lp; + int32_t sum, cnt, *lp; - spcl.c_inumber = ino; - spcl.c_magic = NFS_MAGIC; - spcl.c_checksum = 0; - lp = (int32_t *)&spcl; + tmpspcl->s_spcl.c_checksum = 0; + lp = (int32_t *)&tmpspcl->s_spcl; sum = 0; cnt = sizeof(union u_spcl) / (4 * sizeof(int32_t)); while (--cnt >= 0) { @@ -1199,7 +1198,18 @@ writeheader(dump_ino_t ino) sum += *lp++; sum += *lp++; } - spcl.c_checksum = CHECKSUM - sum; + tmpspcl->s_spcl.c_checksum = CHECKSUM - sum; +} + +/* + * Write a header record to the dump tape. + */ +void +writeheader(dump_ino_t ino) +{ + spcl.c_inumber = ino; + spcl.c_magic = NFS_MAGIC; + mkchecksum((union u_spcl *)&spcl); writerec((char *)&spcl, 1); }