mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
afsdump warning killing
a couple legit bugs here but mostly i used my parentheses shaker. Change-Id: I645a239ca584fbb5759d885d42c058c757a35731 Reviewed-on: http://gerrit.openafs.org/1648 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
6fc9718446
commit
81e03e005a
@ -35,8 +35,11 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <afs/param.h>
|
||||
#include <afs/com_err.h>
|
||||
#include "dumpscan.h"
|
||||
#include "dumpscan_errs.h"
|
||||
#include "xf_errs.h"
|
||||
|
||||
#define COPYBUFSIZE (256*1024)
|
||||
|
||||
@ -89,7 +92,7 @@ parse_options(int argc, char **argv)
|
||||
int c, i, i_name, i_vnum;
|
||||
|
||||
/* Set the program name */
|
||||
if (argv0 = strrchr(argv[0], '/'))
|
||||
if ((argv0 = strrchr(argv[0], '/')))
|
||||
argv0++;
|
||||
else
|
||||
argv0 = argv[0];
|
||||
@ -158,7 +161,7 @@ parse_options(int argc, char **argv)
|
||||
vnum_count++;
|
||||
}
|
||||
file_names = (char **)malloc(name_count + sizeof(char *));
|
||||
file_vnums = (afs_uint32 *) malloc(vnum_count + sizeof(afs_uint32));
|
||||
file_vnums = (afs_int32 *) malloc(vnum_count + sizeof(afs_uint32));
|
||||
if (name_count)
|
||||
use_realpath = 1;
|
||||
|
||||
@ -297,13 +300,13 @@ static int
|
||||
copyfile(XFILE * in, XFILE * out, int size)
|
||||
{
|
||||
static char buf[COPYBUFSIZE];
|
||||
int nr, nw, r;
|
||||
int nr, r;
|
||||
|
||||
while (size) {
|
||||
nr = (size > COPYBUFSIZE) ? COPYBUFSIZE : size;
|
||||
if (r = xfread(in, buf, nr))
|
||||
if ((r = xfread(in, buf, nr)))
|
||||
return r;
|
||||
if (r = xfwrite(out, buf, nr))
|
||||
if ((r = xfwrite(out, buf, nr)))
|
||||
return r;
|
||||
size -= nr;
|
||||
}
|
||||
@ -323,6 +326,7 @@ my_error_cb(afs_uint32 code, int fatal, void *ref, char *msg, ...)
|
||||
afs_com_err_va(argv0, code, msg, alist);
|
||||
va_end(alist);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -344,11 +348,11 @@ static afs_uint32
|
||||
directory_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
{
|
||||
char *vnodepath;
|
||||
int r, use;
|
||||
int r, use = 0;
|
||||
|
||||
/* Should we even use this? */
|
||||
if (!use_vnum) {
|
||||
if (r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath))
|
||||
if ((r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath)))
|
||||
return r;
|
||||
if (!(use = usevnode(X, v->vnode, vnodepath))) {
|
||||
free(vnodepath);
|
||||
@ -391,7 +395,7 @@ file_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
char *vnodepath, vnpx[30];
|
||||
u_int64 where;
|
||||
XFILE OX;
|
||||
int r, use;
|
||||
int r, use = 0;
|
||||
|
||||
if (!dirs_done) {
|
||||
dirs_done = 1;
|
||||
@ -401,7 +405,7 @@ file_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
/* Should we even use this? */
|
||||
if (!use_vnum) {
|
||||
if (r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath))
|
||||
if ((r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath)))
|
||||
return r;
|
||||
if (!(use = usevnode(X, v->vnode, vnodepath))) {
|
||||
free(vnodepath);
|
||||
@ -452,7 +456,7 @@ symlink_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
{
|
||||
char *vnodepath, *linktarget, vnpx[30];
|
||||
u_int64 where;
|
||||
int r, use;
|
||||
int r, use = 0;
|
||||
|
||||
if (!dirs_done) {
|
||||
dirs_done = 1;
|
||||
@ -462,7 +466,7 @@ symlink_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
/* Should we even use this? */
|
||||
if (!use_vnum) {
|
||||
if (r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath))
|
||||
if ((r = Path_Build(X, &phi, v->vnode, &vnodepath, !use_realpath)))
|
||||
return r;
|
||||
if (!(use = usevnode(X, v->vnode, vnodepath))) {
|
||||
free(vnodepath);
|
||||
@ -518,8 +522,6 @@ symlink_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
static afs_uint32
|
||||
lose_cb(afs_vnode * v, XFILE * F, void *refcon)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (!dirs_done) {
|
||||
dirs_done = 1;
|
||||
if (verbose)
|
||||
@ -531,7 +533,7 @@ lose_cb(afs_vnode * v, XFILE * F, void *refcon)
|
||||
|
||||
|
||||
/* Main program */
|
||||
void
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
XFILE input_file;
|
||||
|
@ -33,8 +33,12 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dumpscan.h"
|
||||
#include <afs/param.h>
|
||||
#include <afs/com_err.h>
|
||||
|
||||
#include "dumpscan.h"
|
||||
#include "dumpscan_errs.h"
|
||||
#include "xf_errs.h"
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
@ -166,7 +170,7 @@ parse_options(int argc, char **argv)
|
||||
int c;
|
||||
|
||||
/* Set the program name */
|
||||
if (argv0 = strrchr(argv[0], '/'))
|
||||
if ((argv0 = strrchr(argv[0], '/')))
|
||||
argv0++;
|
||||
else
|
||||
argv0 = argv[0];
|
||||
@ -226,6 +230,7 @@ my_error_cb(afs_uint32 code, int fatal, void *ref, char *msg, ...)
|
||||
afs_com_err_va(argv0, code, msg, alist);
|
||||
va_end(alist);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -238,8 +243,8 @@ print_vnode_path(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
/* Do repair, but only for known vnode types */
|
||||
if (gendump_path && (!(v->field_mask & F_VNODE_TYPE)
|
||||
|| v->type != vFile || v->type != vDirectory
|
||||
|| v->type != vSymlink)) {
|
||||
|| ((v->type != vFile) && (v->type != vDirectory)
|
||||
&& (v->type != vSymlink)))) {
|
||||
r = repair_vnode_cb(v, X, refcon);
|
||||
if (r)
|
||||
return r;
|
||||
@ -272,9 +277,10 @@ setup_repair(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern afs_uint32 DumpDumpEnd(XFILE * OX);
|
||||
|
||||
/* Main program */
|
||||
void
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
XFILE input_file;
|
||||
|
@ -46,7 +46,7 @@ try_backuphdr(XFILE * X, char *tag, tagged_field * field, afs_uint32 value,
|
||||
/* Which header should we try (if any)? */
|
||||
switch (*tag) {
|
||||
case STAGE_VERSMIN:
|
||||
r = ParseStageHdr(X, tag, &bh);
|
||||
r = ParseStageHdr(X, (unsigned char *)tag, &bh);
|
||||
break;
|
||||
default:
|
||||
return DSERR_MAGIC;
|
||||
|
@ -45,7 +45,7 @@ static afs_dir_page page;
|
||||
|
||||
#define allocbit(x) (page.header.freebitmap[(x)>>3] & (1 << ((x) & 7)))
|
||||
#define DPHE (DHE + 1)
|
||||
|
||||
#if 0
|
||||
static void
|
||||
fixup(char *name, int l)
|
||||
{
|
||||
@ -57,14 +57,14 @@ fixup(char *name, int l)
|
||||
name++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
afs_uint32
|
||||
parse_directory(XFILE * X, dump_parser * p, afs_vnode * v, afs_uint32 size,
|
||||
int toeof)
|
||||
{
|
||||
afs_dir_entry de;
|
||||
int pgno, i, j, l, n;
|
||||
afs_uint32 r;
|
||||
int pgno, i, l, n;
|
||||
afs_int32 r;
|
||||
u_int64 where;
|
||||
|
||||
if (p->print_flags & DSPRINT_DIR) {
|
||||
@ -76,8 +76,8 @@ parse_directory(XFILE * X, dump_parser * p, afs_vnode * v, afs_uint32 size,
|
||||
for (pgno = 0; toeof || size; pgno++, size -= (toeof ? 0 : AFS_PAGESIZE)) {
|
||||
if ((p->flags & DSFLAG_SEEK) && (r = xfseek(X, &where)))
|
||||
return r;
|
||||
if (r = xfread(X, &page, AFS_PAGESIZE)) {
|
||||
if (toeof && r == ERROR_XFILE_EOF)
|
||||
if ((r = xfread(X, &page, AFS_PAGESIZE))) {
|
||||
if (toeof && (r == ERROR_XFILE_EOF))
|
||||
break;
|
||||
return r;
|
||||
}
|
||||
@ -139,6 +139,7 @@ ParseDirectory(XFILE * X, dump_parser * p, afs_uint32 size, int toeof)
|
||||
afs_uint32 r;
|
||||
|
||||
r = parse_directory(X, p, 0, size, toeof);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
112
src/tests/dump.c
112
src/tests/dump.c
@ -38,27 +38,27 @@ DumpDumpHeader(XFILE * OX, afs_dump_header * hdr)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = WriteTagInt32Pair(OX, TAG_DUMPHEADER, hdr->magic, hdr->version))
|
||||
if ((r = WriteTagInt32Pair(OX, TAG_DUMPHEADER, hdr->magic, hdr->version)))
|
||||
return r;
|
||||
|
||||
if (hdr->field_mask & F_DUMPHDR_VOLID) {
|
||||
if (r = WriteTagInt32(OX, DHTAG_VOLID, hdr->volid))
|
||||
if ((r = WriteTagInt32(OX, DHTAG_VOLID, hdr->volid)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_DUMPHDR_VOLNAME) {
|
||||
if (r = WriteByte(OX, DHTAG_VOLNAME))
|
||||
if ((r = WriteByte(OX, DHTAG_VOLNAME)))
|
||||
return r;
|
||||
if (r = WriteString(OX, hdr->volname))
|
||||
if ((r = WriteString(OX, hdr->volname)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & (F_DUMPHDR_FROM | F_DUMPHDR_TO)) {
|
||||
if (r = WriteTagInt16(OX, DHTAG_DUMPTIMES, 2))
|
||||
if ((r = WriteTagInt16(OX, DHTAG_DUMPTIMES, 2)))
|
||||
return r;
|
||||
if (r = WriteInt32(OX, (hdr->field_mask & F_DUMPHDR_FROM)
|
||||
if ((r = WriteInt32(OX, (hdr->field_mask & F_DUMPHDR_FROM))
|
||||
? hdr->from_date : 0))
|
||||
return r;
|
||||
if (r = WriteInt32(OX, (hdr->field_mask & F_DUMPHDR_TO)
|
||||
? hdr->to_date : time(0)))
|
||||
if ((r = WriteInt32(OX, (hdr->field_mask & F_DUMPHDR_TO)
|
||||
? hdr->to_date : time(0))))
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
@ -71,112 +71,112 @@ DumpVolumeHeader(XFILE * OX, afs_vol_header * hdr)
|
||||
afs_uint32 r;
|
||||
int i;
|
||||
|
||||
if (r = WriteByte(OX, TAG_VOLHEADER))
|
||||
if ((r = WriteByte(OX, TAG_VOLHEADER)))
|
||||
return r;
|
||||
|
||||
if (hdr->field_mask & F_VOLHDR_VOLID) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_VOLID, hdr->volid))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_VOLID, hdr->volid)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_VOLVERS) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_VERS, hdr->volvers))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_VERS, hdr->volvers)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_VOLNAME) {
|
||||
if (r = WriteByte(OX, VHTAG_VOLNAME))
|
||||
if ((r = WriteByte(OX, VHTAG_VOLNAME)))
|
||||
return r;
|
||||
if (r = WriteString(OX, hdr->volname))
|
||||
if ((r = WriteString(OX, hdr->volname)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_INSERV) {
|
||||
if (r = WriteTagByte(OX, VHTAG_INSERV, hdr->flag_inservice))
|
||||
if ((r = WriteTagByte(OX, VHTAG_INSERV, hdr->flag_inservice)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_BLESSED) {
|
||||
if (r = WriteTagByte(OX, VHTAG_BLESSED, hdr->flag_blessed))
|
||||
if ((r = WriteTagByte(OX, VHTAG_BLESSED, hdr->flag_blessed)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_VOLUNIQ) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_VUNIQ, hdr->voluniq))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_VUNIQ, hdr->voluniq)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_VOLTYPE) {
|
||||
if (r = WriteTagByte(OX, VHTAG_TYPE, hdr->voltype))
|
||||
if ((r = WriteTagByte(OX, VHTAG_TYPE, hdr->voltype)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_PARENT) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_PARENT, hdr->parent_volid))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_PARENT, hdr->parent_volid)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_CLONE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_CLONE, hdr->clone_volid))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_CLONE, hdr->clone_volid)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_MAXQ) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_MAXQUOTA, hdr->maxquota))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_MAXQUOTA, hdr->maxquota)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_MINQ) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_MINQUOTA, hdr->minquota))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_MINQUOTA, hdr->minquota)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_DISKUSED) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_DISKUSED, hdr->diskused))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_DISKUSED, hdr->diskused)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_NFILES) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_FILECNT, hdr->nfiles))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_FILECNT, hdr->nfiles)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_ACCOUNT) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_ACCOUNT, hdr->account_no))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_ACCOUNT, hdr->account_no)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_OWNER) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_OWNER, hdr->owner))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_OWNER, hdr->owner)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_CREATE_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_CREAT, hdr->create_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_CREAT, hdr->create_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_ACCESS_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_ACCESS, hdr->access_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_ACCESS, hdr->access_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_UPDATE_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_UPDATE, hdr->update_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_UPDATE, hdr->update_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_EXPIRE_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_EXPIRE, hdr->expire_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_EXPIRE, hdr->expire_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_BACKUP_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_BACKUP, hdr->backup_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_BACKUP, hdr->backup_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_OFFLINE_MSG) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_OFFLINE, hdr->offline_msg))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_OFFLINE, *hdr->offline_msg)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_MOTD) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_MOTD, hdr->motd_msg))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_MOTD, *hdr->motd_msg)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_WEEKUSE) {
|
||||
if (r = WriteTagInt16(OX, VHTAG_WEEKUSE, 7))
|
||||
if ((r = WriteTagInt16(OX, VHTAG_WEEKUSE, 7)))
|
||||
return r;
|
||||
for (i = 0; i < 7; i++)
|
||||
if (r = WriteInt32(OX, hdr->weekuse[i]))
|
||||
if ((r = WriteInt32(OX, hdr->weekuse[i])))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_DAYUSE_DATE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_DUDATE, hdr->dayuse_date))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_DUDATE, hdr->dayuse_date)))
|
||||
return r;
|
||||
}
|
||||
if (hdr->field_mask & F_VOLHDR_DAYUSE) {
|
||||
if (r = WriteTagInt32(OX, VHTAG_DAYUSE, hdr->dayuse))
|
||||
if ((r = WriteTagInt32(OX, VHTAG_DAYUSE, hdr->dayuse)))
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
@ -188,55 +188,55 @@ DumpVNode(XFILE * OX, afs_vnode * v)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = WriteTagInt32Pair(OX, TAG_VNODE, v->vnode, v->vuniq))
|
||||
if ((r = WriteTagInt32Pair(OX, TAG_VNODE, v->vnode, v->vuniq)))
|
||||
return r;
|
||||
|
||||
if (v->field_mask & F_VNODE_TYPE) {
|
||||
if (r = WriteTagByte(OX, VTAG_TYPE, v->type))
|
||||
if ((r = WriteTagByte(OX, VTAG_TYPE, v->type)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_NLINKS) {
|
||||
if (r = WriteTagInt16(OX, VTAG_NLINKS, v->nlinks))
|
||||
if ((r = WriteTagInt16(OX, VTAG_NLINKS, v->nlinks)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_DVERS) {
|
||||
if (r = WriteTagInt32(OX, VTAG_DVERS, v->datavers))
|
||||
if ((r = WriteTagInt32(OX, VTAG_DVERS, v->datavers)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_SDATE) {
|
||||
if (r = WriteTagInt32(OX, VTAG_SERVER_DATE, v->server_date))
|
||||
if ((r = WriteTagInt32(OX, VTAG_SERVER_DATE, v->server_date)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_AUTHOR) {
|
||||
if (r = WriteTagInt32(OX, VTAG_AUTHOR, v->author))
|
||||
if ((r = WriteTagInt32(OX, VTAG_AUTHOR, v->author)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_OWNER) {
|
||||
if (r = WriteTagInt32(OX, VTAG_OWNER, v->owner))
|
||||
if ((r = WriteTagInt32(OX, VTAG_OWNER, v->owner)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_GROUP) {
|
||||
if (r = WriteTagInt32(OX, VTAG_GROUP, v->group))
|
||||
if ((r = WriteTagInt32(OX, VTAG_GROUP, v->group)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_MODE) {
|
||||
if (r = WriteTagInt16(OX, VTAG_MODE, v->mode))
|
||||
if ((r = WriteTagInt16(OX, VTAG_MODE, v->mode)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_PARENT) {
|
||||
if (r = WriteTagInt32(OX, VTAG_PARENT, v->parent))
|
||||
if ((r = WriteTagInt32(OX, VTAG_PARENT, v->parent)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_CDATE) {
|
||||
if (r = WriteTagInt32(OX, VTAG_CLIENT_DATE, v->client_date))
|
||||
if ((r = WriteTagInt32(OX, VTAG_CLIENT_DATE, v->client_date)))
|
||||
return r;
|
||||
}
|
||||
if (v->field_mask & F_VNODE_ACL) {
|
||||
if (r = WriteByte(OX, VTAG_ACL))
|
||||
if ((r = WriteByte(OX, VTAG_ACL)))
|
||||
return r;
|
||||
if (r =
|
||||
if ((r =
|
||||
xfwrite(OX, v->acl,
|
||||
SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE))
|
||||
SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE)))
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
@ -248,9 +248,9 @@ DumpVNodeData(XFILE * OX, char *buf, afs_uint32 size)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = WriteTagInt32(OX, VTAG_DATA, size))
|
||||
if ((r = WriteTagInt32(OX, VTAG_DATA, size)))
|
||||
return r;
|
||||
if (r = xfwrite(OX, buf, size))
|
||||
if ((r = xfwrite(OX, buf, size)))
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
@ -262,13 +262,13 @@ CopyVNodeData(XFILE * OX, XFILE * X, afs_uint32 size)
|
||||
afs_uint32 r, n;
|
||||
static char buf[COPYBUFSIZE];
|
||||
|
||||
if (r = WriteTagInt32(OX, VTAG_DATA, size))
|
||||
if ((r = WriteTagInt32(OX, VTAG_DATA, size)))
|
||||
return r;
|
||||
while (size) {
|
||||
n = (size > COPYBUFSIZE) ? COPYBUFSIZE : size;
|
||||
if (r = xfread(X, buf, n))
|
||||
if ((r = xfread(X, buf, n)))
|
||||
return r;
|
||||
if (r = xfwrite(OX, buf, n))
|
||||
if ((r = xfwrite(OX, buf, n)))
|
||||
return r;
|
||||
size -= n;
|
||||
}
|
||||
@ -281,7 +281,7 @@ DumpDumpEnd(XFILE * OX)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = WriteTagInt32(OX, TAG_DUMPEND, DUMPENDMAGIC))
|
||||
if ((r = WriteTagInt32(OX, TAG_DUMPEND, DUMPENDMAGIC)))
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ hexify_int64(u_int64 * X, char *buf)
|
||||
#else
|
||||
if (!buf)
|
||||
buf = mybuf;
|
||||
sprintf(buf, "%08lx%08lx", X->hi, X->lo);
|
||||
sprintf(buf, "%08lx%08lx", (unsigned long)X->hi, (unsigned long)X->lo);
|
||||
#endif
|
||||
|
||||
return buf;
|
||||
|
@ -79,13 +79,13 @@ parse_dumphdr(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint32 r;
|
||||
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
sub64_32(hdr.offset, where, 1);
|
||||
|
||||
if (r = ReadInt32(X, &hdr.magic))
|
||||
if ((r = ReadInt32(X, &hdr.magic)))
|
||||
return r;
|
||||
if (r = ReadInt32(X, &hdr.version))
|
||||
if ((r = ReadInt32(X, &hdr.version)))
|
||||
return r;
|
||||
|
||||
if (hdr.magic != DUMPBEGINMAGIC) {
|
||||
@ -175,7 +175,7 @@ parse_dumptimes(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint16 count;
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = ReadInt16(X, &count))
|
||||
if ((r = ReadInt16(X, &count)))
|
||||
return r;
|
||||
if (count != 2) {
|
||||
if (p->cb_error)
|
||||
@ -183,9 +183,9 @@ parse_dumptimes(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
"Incorrect array count (%d) in dump times", count);
|
||||
return DSERR_FMT;
|
||||
}
|
||||
if (r = ReadInt32(X, &hdr->from_date))
|
||||
if ((r = ReadInt32(X, &hdr->from_date)))
|
||||
return r;
|
||||
if (r = ReadInt32(X, &hdr->to_date))
|
||||
if ((r = ReadInt32(X, &hdr->to_date)))
|
||||
return r;
|
||||
hdr->field_mask |= (F_DUMPHDR_FROM | F_DUMPHDR_TO);
|
||||
if (p->print_flags & DSPRINT_DUMPHDR)
|
||||
@ -202,7 +202,6 @@ parse_dumpend(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
void *l_refcon)
|
||||
{
|
||||
dump_parser *p = (dump_parser *) g_refcon;
|
||||
afs_uint32 r;
|
||||
|
||||
if (value != DUMPENDMAGIC) {
|
||||
if (p->cb_error)
|
||||
@ -239,7 +238,7 @@ ParseDumpHeader(XFILE * X, dump_parser * p)
|
||||
afs_uint32 r;
|
||||
|
||||
prep_pi(p, &pi);
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return handle_return(r, X, tag, p);
|
||||
if (tag != TAG_DUMPHEADER)
|
||||
return handle_return(0, X, tag, p);
|
||||
@ -258,7 +257,7 @@ ParseVolumeHeader(XFILE * X, dump_parser * p)
|
||||
afs_uint32 r;
|
||||
|
||||
prep_pi(p, &pi);
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return handle_return(r, X, tag, p);
|
||||
if (tag != TAG_VOLHEADER)
|
||||
return handle_return(0, X, tag, p);
|
||||
@ -277,7 +276,7 @@ ParseVNode(XFILE * X, dump_parser * p)
|
||||
afs_uint32 r;
|
||||
|
||||
prep_pi(p, &pi);
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return handle_return(r, X, tag, p);
|
||||
if (tag != TAG_VNODE)
|
||||
return handle_return(0, X, tag, p);
|
||||
|
@ -67,7 +67,7 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
for (;;) {
|
||||
if (i < 0 || (fields[i].kind & DKIND_MASK) != DKIND_SPECIAL) {
|
||||
/* Need to read in a tag */
|
||||
if (r = ReadByte(X, tag))
|
||||
if ((r = ReadByte(X, tag)))
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -83,10 +83,10 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
char buf1[21], buf2[21], buf3[21];
|
||||
char *p1, *p2, *p3;
|
||||
|
||||
if (r = xftell(X, &tmp64a))
|
||||
if ((r = xftell(X, &tmp64a)))
|
||||
return r;
|
||||
sub64_32(where, tmp64a, pi->shift_offset + 1);
|
||||
if (r = xfseek(X, &where))
|
||||
if ((r = xfseek(X, &where)))
|
||||
return r;
|
||||
if (pi->cb_error) {
|
||||
(pi->cb_error) (DSERR_FMT, 0, pi->err_refcon,
|
||||
@ -102,18 +102,18 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
p2, p3);
|
||||
}
|
||||
pi->shift_offset = 0;
|
||||
if (r = ReadByte(X, tag))
|
||||
if ((r = ReadByte(X, tag)))
|
||||
return r;
|
||||
}
|
||||
if (!*tag && (pi->flags & TPFLAG_SKIP)) {
|
||||
int count = 0;
|
||||
u_int64 where, tmp64a;
|
||||
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
|
||||
while (!*tag) {
|
||||
if (r = ReadByte(X, tag))
|
||||
if ((r = ReadByte(X, tag)))
|
||||
return r;
|
||||
count++;
|
||||
}
|
||||
@ -142,7 +142,7 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
break;
|
||||
|
||||
case DKIND_BYTE:
|
||||
if (r = ReadByte(X, &val8))
|
||||
if ((r = ReadByte(X, &val8)))
|
||||
return r;
|
||||
if (fields[i].func) {
|
||||
r = (fields[i].func) (X, 0, fields + i, val8, pi, g_refcon,
|
||||
@ -153,7 +153,7 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
break;
|
||||
|
||||
case DKIND_INT16:
|
||||
if (r = ReadInt16(X, &val16))
|
||||
if ((r = ReadInt16(X, &val16)))
|
||||
return r;
|
||||
if (fields[i].func) {
|
||||
r = (fields[i].func) (X, 0, fields + i, val16, pi, g_refcon,
|
||||
@ -164,7 +164,7 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
break;
|
||||
|
||||
case DKIND_INT32:
|
||||
if (r = ReadInt32(X, &val))
|
||||
if ((r = ReadInt32(X, &val)))
|
||||
return r;
|
||||
if (fields[i].func) {
|
||||
r = (fields[i].func) (X, 0, fields + i, val, pi, g_refcon,
|
||||
@ -175,7 +175,7 @@ ParseTaggedData(XFILE * X, tagged_field * fields, unsigned char *tag,
|
||||
break;
|
||||
|
||||
case DKIND_STRING:
|
||||
if (r = ReadString(X, &strval))
|
||||
if ((r = ReadString(X, &strval)))
|
||||
return r;
|
||||
if (fields[i].func) {
|
||||
r = (fields[i].func) (X, strval, fields + i, 0, pi, g_refcon,
|
||||
|
@ -73,7 +73,7 @@ resync_vnode(XFILE * X, dump_parser * p, afs_vnode * v, int start, int limit)
|
||||
afs_uint32 r;
|
||||
int i;
|
||||
|
||||
if (r = xftell(X, &expected_where))
|
||||
if ((r = xftell(X, &expected_where)))
|
||||
return r;
|
||||
cp64(where, expected_where);
|
||||
|
||||
@ -128,13 +128,13 @@ parse_vnode(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint32 r;
|
||||
|
||||
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
memset(&v, 0, sizeof(v));
|
||||
sub64_32(v.offset, where, 1);
|
||||
if (r = ReadInt32(X, &v.vnode))
|
||||
if ((r = ReadInt32(X, &v.vnode)))
|
||||
return r;
|
||||
if (r = ReadInt32(X, &v.vuniq))
|
||||
if ((r = ReadInt32(X, &v.vuniq)))
|
||||
return r;
|
||||
|
||||
mk64(offset2k, 0, 2048);
|
||||
@ -155,7 +155,7 @@ parse_vnode(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint32 drop;
|
||||
u_int64 xwhere;
|
||||
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
sub64_32(xwhere, where, 1);
|
||||
|
||||
@ -173,15 +173,15 @@ parse_vnode(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
return r;
|
||||
if (!r) {
|
||||
add64_32(where, v.offset, 1);
|
||||
if (r = xfseek(X, &v.offset))
|
||||
if ((r = xfseek(X, &v.offset)))
|
||||
return r;
|
||||
} else {
|
||||
if (r = xfseek(X, &xwhere))
|
||||
if ((r = xfseek(X, &xwhere)))
|
||||
return r;
|
||||
}
|
||||
if (r = resync_vnode(X, p, &v, 0, 1024))
|
||||
if ((r = resync_vnode(X, p, &v, 0, 1024)))
|
||||
return r;
|
||||
if (r = ReadByte(X, tag))
|
||||
if ((r = ReadByte(X, tag)))
|
||||
return r;
|
||||
if (drop) {
|
||||
if (p->cb_error)
|
||||
@ -190,7 +190,7 @@ parse_vnode(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (r = xfseek(X, &where))
|
||||
if ((r = xfseek(X, &where)))
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ parse_vnode(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
if (cb) {
|
||||
u_int64 where;
|
||||
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
r = (cb) (&v, X, p->refcon);
|
||||
if (p->flags & DSFLAG_SEEK) {
|
||||
@ -399,7 +399,7 @@ parse_acl(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_vnode *v = (afs_vnode *) l_refcon;
|
||||
afs_uint32 r, i, n;
|
||||
|
||||
if (r = xfread(X, v->acl, SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE))
|
||||
if ((r = xfread(X, v->acl, SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE)))
|
||||
return r;
|
||||
|
||||
v->field_mask |= F_VNODE_ACL;
|
||||
@ -436,13 +436,13 @@ parse_vdata(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
static int symlink_size = 0;
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = ReadInt32(X, &v->size))
|
||||
if ((r = ReadInt32(X, &v->size)))
|
||||
return r;
|
||||
v->field_mask |= F_VNODE_SIZE;
|
||||
|
||||
if (v->size) {
|
||||
v->field_mask |= F_VNODE_DATA;
|
||||
if (r = xftell(X, &v->d_offset))
|
||||
if ((r = xftell(X, &v->d_offset)))
|
||||
return r;
|
||||
if (p->print_flags & DSPRINT_VNODE)
|
||||
printf("%s%d (0x%08x) bytes at %s (0x%s)\n", field->label,
|
||||
@ -459,7 +459,7 @@ parse_vdata(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
symlink_size = symlink_buf ? v->size : 0;
|
||||
}
|
||||
if (symlink_buf) {
|
||||
if (r = xfread(X, symlink_buf, v->size))
|
||||
if ((r = xfread(X, symlink_buf, v->size)))
|
||||
return r;
|
||||
symlink_buf[v->size] = 0;
|
||||
if (p->print_flags & DSPRINT_VNODE)
|
||||
@ -469,20 +469,20 @@ parse_vdata(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
if (p->cb_error)
|
||||
(p->cb_error) (ENOMEM, 0, p->err_refcon,
|
||||
"Out of memory reading symlink");
|
||||
if (r = xfskip(X, v->size))
|
||||
if ((r = xfskip(X, v->size)))
|
||||
return r;
|
||||
}
|
||||
break;
|
||||
|
||||
case vDirectory:
|
||||
if (p->cb_dirent || (p->print_flags & DSPRINT_DIR)) {
|
||||
if (r = parse_directory(X, p, v, v->size, 0))
|
||||
if ((r = parse_directory(X, p, v, v->size, 0)))
|
||||
return r;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
if (r = xfskip(X, v->size))
|
||||
if ((r = xfskip(X, v->size)))
|
||||
return r;
|
||||
}
|
||||
} else if (p->print_flags & DSPRINT_VNODE) {
|
||||
|
@ -82,7 +82,7 @@ parse_volhdr(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint32 r;
|
||||
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
sub64_32(hdr.offset, where, 1);
|
||||
if (p->print_flags & DSPRINT_VOLHDR)
|
||||
@ -92,7 +92,7 @@ parse_volhdr(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
r = ParseTaggedData(X, volhdr_fields, tag, pi, g_refcon, (void *)&hdr);
|
||||
|
||||
if (!r && p->cb_volhdr) {
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
r = (p->cb_volhdr) (&hdr, X, p->refcon);
|
||||
if (p->flags & DSFLAG_SEEK) {
|
||||
@ -302,7 +302,7 @@ parse_weekuse(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
afs_uint32 r;
|
||||
unsigned int i;
|
||||
|
||||
if (r = ReadInt16(X, &count))
|
||||
if ((r = ReadInt16(X, &count)))
|
||||
return r;
|
||||
if (count != 7) {
|
||||
if (p->cb_error)
|
||||
@ -312,7 +312,7 @@ parse_weekuse(XFILE * X, unsigned char *tag, tagged_field * field,
|
||||
return DSERR_FMT;
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
if (r = ReadInt32(X, hdr->weekuse + i))
|
||||
if ((r = ReadInt32(X, hdr->weekuse + i)))
|
||||
return r;
|
||||
hdr->field_mask |= F_VOLHDR_WEEKUSE;
|
||||
if (p->print_flags & DSPRINT_VOLHDR) {
|
||||
|
@ -123,7 +123,7 @@ vnode_stop(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
/* If the file is seekable, try to position so we can pick up later... */
|
||||
if (phi->p->flags & DSFLAG_SEEK)
|
||||
if (r = xfseek(X, &v->offset))
|
||||
if ((r = xfseek(X, &v->offset)))
|
||||
return r;
|
||||
return DSERR_DONE;
|
||||
}
|
||||
@ -158,7 +158,6 @@ afs_uint32
|
||||
Path_PreScan(XFILE * X, path_hashinfo * phi, int full)
|
||||
{
|
||||
dump_parser my_p, *p = phi->p;
|
||||
int r;
|
||||
|
||||
memset(phi, 0, sizeof(path_hashinfo));
|
||||
phi->p = p;
|
||||
@ -239,7 +238,7 @@ Path_Follow(XFILE * X, path_hashinfo * phi, char *path, vhash_ent * his_vhe)
|
||||
"Directory vnode %d is incomplete", vnum);
|
||||
return DSERR_FMT;
|
||||
}
|
||||
if (r = xfseek(X, &vhe->d_offset)) {
|
||||
if ((r = xfseek(X, &vhe->d_offset))) {
|
||||
if (phi->p->cb_error)
|
||||
(phi->p->cb_error) (r, 1, phi->p->err_refcon,
|
||||
"Unable to seek to directory %d", vnum);
|
||||
@ -339,7 +338,7 @@ Path_Build(XFILE * X, path_hashinfo * phi, afs_uint32 vnode, char **his_path,
|
||||
free(path);
|
||||
return DSERR_FMT;
|
||||
}
|
||||
if (r = xfseek(X, &vhe->d_offset)) {
|
||||
if ((r = xfseek(X, &vhe->d_offset))) {
|
||||
if (phi->p->cb_error)
|
||||
(phi->p->cb_error) (errno, 1, phi->p->err_refcon,
|
||||
"Unable to seek to directory %d",
|
||||
|
@ -50,7 +50,7 @@ ReadInt16(XFILE * X, afs_uint16 * val)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = xfread(X, val, 2))
|
||||
if ((r = xfread(X, val, 2)))
|
||||
return r;
|
||||
*val = ntohs(*val);
|
||||
return 0;
|
||||
@ -61,7 +61,7 @@ ReadInt32(XFILE * X, afs_uint32 * val)
|
||||
{
|
||||
afs_uint32 r;
|
||||
|
||||
if (r = xfread(X, val, 4))
|
||||
if ((r = xfread(X, val, 4)))
|
||||
return r;
|
||||
*val = ntohl(*val);
|
||||
return 0;
|
||||
|
@ -46,12 +46,14 @@ XFILE repair_output;
|
||||
int repair_verbose;
|
||||
#define RV repair_verbose
|
||||
|
||||
extern afs_uint32 CopyVNodeData(XFILE * OX, XFILE * X, afs_uint32 size);
|
||||
extern afs_uint32 DumpVNodeData(XFILE * OX, char *buf, afs_uint32 size);
|
||||
|
||||
/* Try to dump a dump header. Generate missing fields, if neccessary */
|
||||
afs_uint32
|
||||
repair_dumphdr_cb(afs_dump_header * hdr, XFILE * X, void *refcon)
|
||||
{
|
||||
afs_uint32 r, field_mask = hdr->field_mask;
|
||||
afs_uint32 field_mask = hdr->field_mask;
|
||||
char volname[22];
|
||||
|
||||
if (!(field_mask & F_DUMPHDR_VOLID)) {
|
||||
@ -68,7 +70,7 @@ repair_dumphdr_cb(afs_dump_header * hdr, XFILE * X, void *refcon)
|
||||
hdr->volname = (unsigned char *)malloc(strlen(volname) + 1);
|
||||
if (!hdr->volname)
|
||||
return ENOMEM;
|
||||
strcpy(hdr->volname, volname);
|
||||
strcpy((char *)hdr->volname, volname);
|
||||
hdr->field_mask |= F_DUMPHDR_VOLNAME;
|
||||
}
|
||||
if (!(field_mask & F_DUMPHDR_FROM)) {
|
||||
@ -93,7 +95,7 @@ repair_dumphdr_cb(afs_dump_header * hdr, XFILE * X, void *refcon)
|
||||
afs_uint32
|
||||
repair_volhdr_cb(afs_vol_header * hdr, XFILE * X, void *refcon)
|
||||
{
|
||||
afs_uint32 r, field_mask = hdr->field_mask;
|
||||
afs_uint32 field_mask = hdr->field_mask;
|
||||
char volname[22];
|
||||
|
||||
if (!(field_mask & F_VOLHDR_VOLID)) {
|
||||
@ -121,7 +123,7 @@ repair_volhdr_cb(afs_vol_header * hdr, XFILE * X, void *refcon)
|
||||
hdr->volname = (unsigned char *)malloc(strlen(volname) + 1);
|
||||
if (!hdr->volname)
|
||||
return ENOMEM;
|
||||
strcpy(hdr->volname, volname);
|
||||
strcpy((char *)hdr->volname, volname);
|
||||
hdr->field_mask |= F_VOLHDR_VOLNAME;
|
||||
}
|
||||
if (!(field_mask & F_VOLHDR_INSERV)) {
|
||||
@ -246,7 +248,7 @@ repair_vnode_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
if ((v->vnode & 1) && !field_mask) {
|
||||
if (RV)
|
||||
fprintf(stderr, ">>> VNODE %d is directory but has no fields?\n");
|
||||
fprintf(stderr, ">>> VNODE %d is directory but has no fields?\n", v->vnode);
|
||||
v->type = vDirectory;
|
||||
v->field_mask |= F_VNODE_TYPE;
|
||||
field_mask = F_VNODE_TYPE; /* Messy! */
|
||||
@ -329,7 +331,7 @@ repair_vnode_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
}
|
||||
if (field_mask && !(field_mask & F_VNODE_SIZE)) {
|
||||
if (RV)
|
||||
fprintf(stderr, ">>> VNODE %d has no data size (using 0)\n");
|
||||
fprintf(stderr, ">>> VNODE %d has no data size (using 0)\n", v->vnode);
|
||||
v->size = 0;
|
||||
v->field_mask |= F_VNODE_SIZE;
|
||||
}
|
||||
@ -343,7 +345,7 @@ repair_vnode_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
if (field_mask && v->type == vDirectory && !(field_mask & F_VNODE_ACL)) {
|
||||
struct acl_accessList *acl = (struct acl_accessList *)v->acl;
|
||||
if (RV) {
|
||||
fprintf(stderr, ">>> VNODE %d is directory but has no ACL\n");
|
||||
fprintf(stderr, ">>> VNODE %d is directory but has no ACL\n", v->vnode);
|
||||
fprintf(stderr, ">>> Will generate default ACL\n");
|
||||
}
|
||||
memset(v->acl, 0, SIZEOF_LARGEDISKVNODE - SIZEOF_SMALLDISKVNODE);
|
||||
@ -366,7 +368,7 @@ repair_vnode_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
return r;
|
||||
|
||||
if (v->size) {
|
||||
if (r = xfseek(X, &v->d_offset))
|
||||
if ((r = xfseek(X, &v->d_offset)))
|
||||
return r;
|
||||
r = CopyVNodeData(&repair_output, X, v->size);
|
||||
} else if (v->type == vDirectory) {
|
||||
@ -376,7 +378,7 @@ repair_vnode_cb(afs_vnode * v, XFILE * X, void *refcon)
|
||||
|
||||
if (RV) {
|
||||
fprintf(stderr,
|
||||
">>> VNODE %d is directory but has no contents\n");
|
||||
">>> VNODE %d is directory but has no contents\n", v->vnode);
|
||||
fprintf(stderr, ">>> Will generate deafult directory entries\n");
|
||||
}
|
||||
memset(&page, 0, sizeof(page));
|
||||
|
@ -64,9 +64,9 @@ ParseStageHdr(XFILE * X, unsigned char *tag, backup_system_header * hdr)
|
||||
char buf[STAGE_HDRLEN];
|
||||
struct stage_header *bckhdr = (struct stage_header *)buf;
|
||||
u_int64 where;
|
||||
afs_uint32 r;
|
||||
afs_int32 r;
|
||||
|
||||
if (r = xftell(X, &where))
|
||||
if ((r = xftell(X, &where)))
|
||||
return r;
|
||||
if (hdr)
|
||||
memset(hdr, 0, sizeof(*hdr));
|
||||
@ -117,9 +117,9 @@ ParseStageHdr(XFILE * X, unsigned char *tag, backup_system_header * hdr)
|
||||
free(hdr->volname);
|
||||
return ENOMEM;
|
||||
}
|
||||
strcpy(hdr->server, bckhdr->c_host);
|
||||
strcpy(hdr->part, bckhdr->c_disk);
|
||||
strcpy(hdr->volname, bckhdr->c_name);
|
||||
strcpy((char *)hdr->server, bckhdr->c_host);
|
||||
strcpy((char *)hdr->part, bckhdr->c_disk);
|
||||
strcpy((char *)hdr->volname, bckhdr->c_name);
|
||||
}
|
||||
|
||||
if (tag)
|
||||
@ -150,15 +150,15 @@ DumpStageHdr(XFILE * OX, backup_system_header * hdr)
|
||||
bckhdr->c_magic = htonl(STAGE_MAGIC);
|
||||
bckhdr->c_flags = htonl(hdr->flags);
|
||||
|
||||
strcpy(bckhdr->c_host, hdr->server);
|
||||
strcpy(bckhdr->c_disk, hdr->part);
|
||||
strcpy(bckhdr->c_name, hdr->volname);
|
||||
strcpy(bckhdr->c_host, (char *)hdr->server);
|
||||
strcpy(bckhdr->c_disk, (char *)hdr->part);
|
||||
strcpy(bckhdr->c_name, (char *)hdr->volname);
|
||||
|
||||
/* Now, compute the checksum */
|
||||
checksum = hdr_checksum(buf, STAGE_HDRLEN);
|
||||
bckhdr->c_checksum = htonl(STAGE_CHECKSUM - checksum);
|
||||
|
||||
if (r = xfwrite(OX, buf, STAGE_HDRLEN))
|
||||
if ((r = xfwrite(OX, buf, STAGE_HDRLEN)))
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ handle_return(int r, XFILE * X, unsigned char tag, dump_parser * p)
|
||||
}
|
||||
|
||||
|
||||
/* Prepare a tag_parse_info for use by the dump parser. *
|
||||
/*** THIS FUNCTION INTENDED FOR INTERNAL USE ONLY ***/
|
||||
/* Prepare a tag_parse_info for use by the dump parser. */
|
||||
/* ** THIS FUNCTION INTENDED FOR INTERNAL USE ONLY ** */
|
||||
void
|
||||
prep_pi(dump_parser * p, tag_parse_info * pi)
|
||||
{
|
||||
@ -121,18 +121,18 @@ match_next_vnode(XFILE * X, dump_parser * p, u_int64 * where,
|
||||
afs_uint32 r, x, y, z;
|
||||
unsigned char tag;
|
||||
|
||||
if (r = xfseek(X, where))
|
||||
if ((r = xfseek(X, where)))
|
||||
return r;
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return r;
|
||||
switch (tag) {
|
||||
case 3: /* A vnode? */
|
||||
if (r = ReadInt32(X, &x))
|
||||
if ((r = ReadInt32(X, &x)))
|
||||
return r;
|
||||
if (r = ReadInt32(X, &y))
|
||||
return r;
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadInt32(X, &y)))
|
||||
return r;
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return r;
|
||||
if (!((vnode & 1) && !(x & 1) && x < vnode)
|
||||
&& !((vnode & 1) == (x & 1) && x > vnode))
|
||||
return DSERR_FMT;
|
||||
@ -146,7 +146,7 @@ match_next_vnode(XFILE * X, dump_parser * p, u_int64 * where,
|
||||
case 3: /* Another vnode? - Only if this is a non-directory */
|
||||
if (x & 1)
|
||||
return DSERR_FMT;
|
||||
if (r = ReadInt32(X, &z))
|
||||
if ((r = ReadInt32(X, &z)))
|
||||
return r;
|
||||
if (!((x & 1) && !(z & 1) && z < x)
|
||||
&& !((x & 1) == (z & 1) && z > x))
|
||||
@ -156,14 +156,14 @@ match_next_vnode(XFILE * X, dump_parser * p, u_int64 * where,
|
||||
case 4: /* Dump end - Only if this is a non-directory */
|
||||
if (x & 1)
|
||||
return DSERR_FMT;
|
||||
if (r = ReadInt32(X, &z))
|
||||
if ((r = ReadInt32(X, &z)))
|
||||
return r;
|
||||
if (z != DUMPENDMAGIC)
|
||||
return DSERR_FMT;
|
||||
return 0;
|
||||
|
||||
case 't': /* Vnode type byte */
|
||||
if (r = ReadByte(X, &tag))
|
||||
if ((r = ReadByte(X, &tag)))
|
||||
return r;
|
||||
if ((tag == vFile || tag == vSymlink) && !(x & 1))
|
||||
return 0;
|
||||
@ -176,7 +176,7 @@ match_next_vnode(XFILE * X, dump_parser * p, u_int64 * where,
|
||||
}
|
||||
|
||||
case 4: /* A dump end? */
|
||||
if (r = ReadInt32(X, &x))
|
||||
if ((r = ReadInt32(X, &x)))
|
||||
return r;
|
||||
if (x != DUMPENDMAGIC)
|
||||
return DSERR_FMT;
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "xfiles.h"
|
||||
#include "xf_errs.h"
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xfiles.h"
|
||||
#include "xf_errs.h"
|
||||
@ -514,8 +516,6 @@ vxfprintf(XFILE * X, char *fmt, va_list ap)
|
||||
if (lit && (err = xfwrite(X, lit, fmt - lit)))
|
||||
return err;
|
||||
return 0;
|
||||
lose:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,7 +162,7 @@ xfopen_profile(XFILE * X, int flag, char *xname, char *profile)
|
||||
X->do_close = xf_PROFILE_do_close;
|
||||
X->is_writable = PF->content.is_writable;
|
||||
if (PF->content.is_seekable) {
|
||||
X->is_seekable;
|
||||
X->is_seekable = 1;
|
||||
X->do_seek = xf_PROFILE_do_seek;
|
||||
X->do_skip = xf_PROFILE_do_skip;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <afs/cellconfig.h>
|
||||
#include <afs/vlserver.h>
|
||||
#include <afs/volser.h>
|
||||
#include <afs/volint.h>
|
||||
|
||||
#ifndef AFSCONF_CLIENTNAME
|
||||
#include <afs/dirpath.h>
|
||||
@ -114,7 +115,7 @@ xf_voldump_do_close(XFILE * X)
|
||||
{
|
||||
struct rxinfo *i = X->refcon;
|
||||
struct rx_connection *conn = i->conn;
|
||||
afs_uint32 code, rcode, xcode;
|
||||
afs_int32 code, rcode, xcode;
|
||||
afs_int32 tid = i->tid;
|
||||
|
||||
code = xf_rxcall_do_close(X);
|
||||
@ -153,10 +154,10 @@ xfopen_voldump(XFILE * X, struct rx_connection * conn, afs_int32 part,
|
||||
{
|
||||
struct rx_call *call;
|
||||
struct rxinfo *i;
|
||||
afs_uint32 code, rcode;
|
||||
afs_int32 code, rcode;
|
||||
afs_int32 tid;
|
||||
|
||||
if (code = AFSVolTransCreate(conn, volid, part, ITBusy, &tid))
|
||||
if ((code = AFSVolTransCreate(conn, volid, part, ITBusy, &tid)))
|
||||
return code;
|
||||
call = rx_NewCall(conn);
|
||||
if ((code = StartAFSVolDump(call, tid, date))
|
||||
@ -184,22 +185,22 @@ xfon_voldump(XFILE * X, int flag, char *name)
|
||||
struct ktc_token token;
|
||||
struct afsconf_dir *confdir;
|
||||
afs_uint32 code, server_addr;
|
||||
afs_int32 volid, partid, date;
|
||||
afs_int32 volid, date, partid = 0;
|
||||
int isnum, index;
|
||||
char *x, *y;
|
||||
|
||||
/* Parse out the optional date and server location */
|
||||
if (code = rx_Init(0))
|
||||
if ((code = rx_Init(0)))
|
||||
return code;
|
||||
if (!(name = strdup(name)))
|
||||
return ENOMEM;
|
||||
if (x = strrchr(name, ',')) {
|
||||
if ((x = strrchr(name, ','))) {
|
||||
*x++ = 0;
|
||||
date = atoi(x);
|
||||
} else {
|
||||
date = 0;
|
||||
}
|
||||
if (x = strrchr(name, '@')) {
|
||||
if ((x = strrchr(name, '@'))) {
|
||||
int a, b, c, d;
|
||||
|
||||
*x++ = 0;
|
||||
@ -234,7 +235,7 @@ xfon_voldump(XFILE * X, int flag, char *name)
|
||||
free(name);
|
||||
return AFSCONF_NODB;
|
||||
}
|
||||
if (code = afsconf_GetLocalCell(confdir, sname.cell, MAXKTCNAMELEN)) {
|
||||
if ((code = afsconf_GetLocalCell(confdir, sname.cell, MAXKTCNAMELEN))) {
|
||||
free(name);
|
||||
return code;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xfiles.h"
|
||||
#include "xf_errs.h"
|
||||
@ -132,7 +133,7 @@ xfskip(XFILE * X, afs_uint32 count)
|
||||
|
||||
/* Simulate using absolute seek, if available */
|
||||
if (X->do_seek && !X->passthru) {
|
||||
if (code = xftell(X, &tmp64))
|
||||
if ((code = xftell(X, &tmp64)))
|
||||
return code;
|
||||
add64_32(X->filepos, tmp64, count);
|
||||
cp64(tmp64, X->filepos);
|
||||
@ -149,7 +150,7 @@ xfskip(XFILE * X, afs_uint32 count)
|
||||
|
||||
while (count) {
|
||||
n = (count > SKIP_SIZE) ? SKIP_SIZE : count;
|
||||
if (code = xfread(X, buf, n))
|
||||
if ((code = xfread(X, buf, n)))
|
||||
return code;
|
||||
count -= n;
|
||||
}
|
||||
@ -204,6 +205,7 @@ xfregister(char *name, afs_uint32(*do_on) (XFILE *, int, char *))
|
||||
x->name = name;
|
||||
x->do_on = do_on;
|
||||
xftypes = x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user