/xf_errs.h
/OS.pm
/Dirpath.pm
+/afscp
/afsdump_dirlist
/afsdump_extract
/afsdump_scan
/rename6
/rm-rf
/run-tests
+/run-tests.conf
/still-there-p
/strange-characters-c
/symlink
TARGETS = libxfiles.a libdumpscan.a \
afsdump_scan afsdump_dirlist afsdump_extract dumptool
+all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
+ afsdump_scan afsdump_dirlist afsdump_extract dumptool OpenAFS/Dirpath.sh
+ @chmod +x run-tests
+
afsdump_scan: libxfiles.a libdumpscan.a $(OBJS_afsdump_scan)
$(CC) $(CFLAGS) $(LDFLAGS) -o afsdump_scan $(OBJS_afsdump_scan) $(LIBS)
util.o xfiles.o xf_files.o: xf_errs.h
backuphdr.o directory.o parsedump.o parsetag.o: dumpscan_errs.h
-parsevnode.o parsevol.o pathname.o repair.o: dumpscan_errs.h
-stagehdr.o util.o: dumpscan_errs.h
+parsevnode.o parsevol.o pathname.o stagehdr.o: dumpscan_errs.h
+util.o: dumpscan_errs.h
+
+# repair addresses the same storage as two different types of structs at the
+# same time.
+repair.o: repair.c dumpscan_errs.h
+ $(CCOBJ) $(CFLAGS) @CFLAGS_NOSTRICT@ -c ${srcdir}/repair.c
${TOP_LIBDIR}/libxfiles.a: libxfiles.a
${INSTALL_DATA} $? $@
uninstall:
-all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
- afsdump_scan afsdump_dirlist afsdump_extract dumptool OpenAFS/Dirpath.sh
- @chmod +x run-tests
-
clean:
-rm -f xf_errs.c xf_errs.h dumpscan_errs.c dumpscan_errs.h *.o \
$(TARGETS) run-tests $(TEST_PROGRAMS) OpenAFS/Dirpath.pm OpenAFS/Dirpath.sh
double rate, size, time;
if (finish.tv_sec == start.tv_sec) {
printf("Copied %d bytes in %d microseconds\n", filesz,
- finish.tv_usec - start.tv_usec);
+ (int)(finish.tv_usec - start.tv_usec));
} else {
printf("Copied %d bytes in %d seconds\n", filesz,
(int)(finish.tv_sec - start.tv_sec));
/* afsdump_dirlist.c - List an AFS directory file */
+#include <afsconfig.h>
+
#include <sys/fcntl.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#include <afs/stds.h>
+#include <afs/com_err.h>
+#include <afs/cellconfig.h>
+#include <afs/vlserver.h>
+#include <afs/volser.h>
+#include <rx/rxkad.h>
+
#include "dumpscan.h"
+#include "dumpscan_errs.h"
+#include "xf_errs.h"
extern int optind;
extern char *optarg;
static char *input_path;
static int quiet, verbose, error_count;
-static path_hashinfo phi;
static dump_parser dp;
int c;
/* Set the program name */
- if (argv0 = strrchr(argv[0], '/'))
+ if ((argv0 = strrchr(argv[0], '/')) != NULL)
argv0++;
else
argv0 = argv[0];
afs_com_err_va(argv0, code, msg, alist);
va_end(alist);
}
+ return 0;
}
/* Main program */
-void
+int
main(int argc, char **argv)
{
XFILE input_file;
fprintf(stderr, "*** %d errors\n", error_count);
if (r && !quiet)
fprintf(stderr, "*** FAILED: %s\n", afs_error_message(r));
- exit(0);
+ return 0;
}
#include <string.h>
#include <afs/com_err.h>
+#include <afs/cellconfig.h>
+#include <afs/vlserver.h>
+#include <afs/volser.h>
+#include <rx/rxkad.h>
+
#include "dumpscan.h"
#include "dumpscan_errs.h"
#include "xf_errs.h"
#include <stdio.h>
#include <pwd.h>
#include <unistd.h>
-
+#include <grp.h>
#include <err.h>
printf(" => %s", ctime(&to));
printf(" Dump Time: %d == %s", hdr->dump_date, ctime(&dd));
printf(" Dump Flags: 0x%08x\n", hdr->flags);
- printf(" Length: %d\n", hdr->dumplen);
+#ifdef NATIVE_INT64
+ printf(" Length: %llu\n", hdr->dumplen);
+#else
+ printf(" Length: %u,%u\n", hdr->dumplen.hi, hdr->dumplen.lo);
+#endif
printf(" File Num: %d\n", hdr->filenum);
}
#include <config.h>
#endif
+#include <afsconfig.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <afs/cmd.h>
#include <err.h>
-
-struct VenusFid {
- afs_int32 Cell;
- struct AFSFid Fid;
-};
+#include <fs_lib.h>
static void
usage(int ret)
static int ReadDumpHeader(FILE *, struct DumpHeader *);
static int ReadVolumeHeader(FILE *, VolumeDiskData *);
static int ScanVnodes(FILE *, VolumeDiskData *, int);
-static int DumpVnodeFile(FILE *, struct VnodeDiskObject *, VolumeDiskData *);
static struct vnodeData *InsertVnode(unsigned int, struct VnodeDiskObject *);
static struct vnodeData *GetVnode(unsigned int);
static int CompareVnode(const void *, const void *);
static void CopyFile(int, char **, struct vnodeData *, FILE *);
static void CopyVnode(int, char **, FILE *);
static void DumpAllFiles(int, char **, struct vnodeData *, VolumeDiskData *);
-static void DumpAllResidencies(FILE *, struct vnodeData *, VolumeDiskData *);
static struct vnodeData *FindFile(struct vnodeData *, char *);
static void ResetDirCursor(struct DirCursor *, struct vnodeData *);
static struct DirEntry *ReadNextDir(struct DirCursor *, struct vnodeData *);
static int ReadString(FILE *, char *, int);
static int ReadByteString(FILE *, void *, int);
+#ifdef RESIDENCY
+static int DumpVnodeFile(FILE *, struct VnodeDiskObject *, VolumeDiskData *);
+static void DumpAllResidencies(FILE *, struct vnodeData *, VolumeDiskData *);
+#endif
+
int
main(int argc, char *argv[])
{
- int c, errflg = 0, dumpvnodes = 0, force = 0, inode = 0;
+ int c, errflg = 0, force = 0, inode = 0;
unsigned int magic;
struct DumpHeader dheader;
VolumeDiskData vol;
off64_t offset;
+#ifdef RESIDENCY
int Res, Arg1, Arg2, Arg3, i;
+ int dumpvnodes = 0;
+#endif
char *p;
struct winsize win;
FILE *f;
}
if (verbose)
- printf("Dump is for volume %lu (%s)\n", dheader.volumeId,
- dheader.volumeName);
+ printf("Dump is for volume %lu (%s)\n",
+ (unsigned long) dheader.volumeId, dheader.volumeName);
if (getc(f) != D_VOLUMEHEADER) {
fprintf(stderr, "Volume header is missing from dump, aborting\n");
if (verbose) {
printf("Volume information:\n");
- printf("\tid = %lu\n", vol.id);
- printf("\tparent id = %lu\n", vol.parentId);
+ printf("\tid = %lu\n", (unsigned long) vol.id);
+ printf("\tparent id = %lu\n", (unsigned long) vol.parentId);
printf("\tname = %s\n", vol.name);
printf("\tflags =");
if (vol.inUse)
if (vol.needsSalvaged)
printf(" needsSalvaged");
printf("\n");
- printf("\tuniquifier = %lu\n", vol.uniquifier);
+ printf("\tuniquifier = %lu\n", (unsigned long) vol.uniquifier);
tmv = vol.creationDate;
printf("\tCreation date = %s", ctime(&tmv));
tmv = vol.accessDate;
printf("\tLast access date = %s", ctime(&tmv));
tmv = vol.updateDate;
printf("\tLast update date = %s", ctime(&tmv));
- printf("\tVolume owner = %lu\n", vol.owner);
+ printf("\tVolume owner = %lu\n", (unsigned long) vol.owner);
}
if (verbose)
c = '/';
else if (lvdata->vnode->type == vSymlink)
c = '@';
- else if (lvdata->vnode->modeBits & 0111 != 0)
+ else if ((lvdata->vnode->modeBits & 0111) != 0)
c = '*';
else
c = ' ';
}
if ((vdata = GetVnode(ntohl(ep->fid.vnode))) == NULL) {
- fprintf(stderr, "%s: No vnode information for %lu found\n", filename,
+ fprintf(stderr, "%s: No vnode information for %u found\n", filename,
ntohl(ep->fid.vnode));
return NULL;
}
*argc = 0;
*argv = largv;
- while (*la++ = GetToken(s, &s, ap, &ap))
+ while ((*la++ = GetToken(s, &s, ap, &ap)) != NULL)
(*argc)++;
}
* The directory hashing algorithm used by AFS
*/
-DirHash(string)
- register char *string;
+int
+DirHash(char *string)
{
/* Hash a string to a number between 0 and NHASHENT. */
register unsigned char tc;
register int hval;
register int tval;
hval = 0;
- while (tc = (*string++)) {
+ while ((tc = (*string++)) != '\0') {
hval *= 173;
hval += tc;
}
#include <unistd.h>
#include <err.h>
+#include <afs/stds.h>
+#include <afs/auth.h>
+
int
main(int argc, char **argv)
{
#include <afs/afsint.h>
#include <afs/cellconfig.h>
#include <afs/cmd.h>
+#include <afs/sys_prototypes.h>
-enum { PIOCTL_MAXSIZE = 2000 };
+#include <err.h>
+#include <fs_lib.h>
-struct VenusFid {
- afs_int32 Cell;
- struct AFSFid Fid;
-};
+enum { PIOCTL_MAXSIZE = 2000 };
/*
* fs_getfid, the the `fid' that `path' points on.
* outflags == NULL -> don't return
*/
+#if defined(VIOC_XFSDEBUG) || defined(VIOC_XFSDEBUG_PRINT) \
+ || defined(VIOC_ARLADEBUG)
static int
debug(int pioctl_cmd, int inflags, int *outflags, char *pathname)
{
return 0;
}
+#endif
/*
* xfs_debug
--- /dev/null
+/* Prototypes for fs_lib.c. */
+
+#ifndef FS_LIB_H
+#define FS_LIB_H 1
+
+#include <afs/stds.h>
+#include <afs/afsint.h>
+
+struct VenusFid {
+ afs_int32 Cell;
+ struct AFSFid Fid;
+};
+
+int fs_getfid(char *, struct VenusFid *);
+int fs_rmmount(const char *);
+
+#endif /* !FS_LIB_H */
return;
if (!quiet
- && (progressinterval && testcalls % progressinterval == 0 || debug
- && (monitorstart == -1 || offset + size > monitorstart
- && (monitorend == -1 || offset <= monitorend))))
+ && ((progressinterval && testcalls % progressinterval == 0)
+ || (debug
+ && (monitorstart == -1 || offset + size > monitorstart)
+ && (monitorend == -1 || offset <= monitorend))))
prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls, offset,
offset + size - 1, size);
ret = lseek(fd, (off_t) offset, SEEK_SET);
return;
if (!quiet
- && (progressinterval && testcalls % progressinterval == 0 || debug
- && (monitorstart == -1 || offset + size > monitorstart
- && (monitorend == -1 || offset <= monitorend))))
+ && ((progressinterval && testcalls % progressinterval == 0)
+ || (debug
+ && (monitorstart == -1 || offset + size > monitorstart)
+ && (monitorend == -1 || offset <= monitorend))))
prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls, offset,
offset + size - 1, size);
return;
if (!quiet
- && (progressinterval && testcalls % progressinterval == 0 || debug
- && (monitorstart == -1 || offset + size > monitorstart
- && (monitorend == -1 || offset <= monitorend))))
+ && ((progressinterval && testcalls % progressinterval == 0)
+ || (debug
+ && (monitorstart == -1 || offset + size > monitorstart)
+ && (monitorend == -1 || offset <= monitorend))))
prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls, offset,
offset + size - 1, size);
ret = lseek(fd, (off_t) offset, SEEK_SET);
return;
if (!quiet
- && (progressinterval && testcalls % progressinterval == 0 || debug
- && (monitorstart == -1 || offset + size > monitorstart
- && (monitorend == -1 || offset <= monitorend))))
+ && ((progressinterval && testcalls % progressinterval == 0)
+ || (debug
+ && (monitorstart == -1 || offset + size > monitorstart)
+ && (monitorend == -1 || offset <= monitorend))))
prt("%lu mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
offset, offset + size - 1, size);
if (testcalls <= simulatedopcount)
return;
- if (progressinterval && testcalls % progressinterval == 0 || debug
- && (monitorstart == -1 || monitorend == -1 || size <= monitorend))
+ if ((progressinterval && testcalls % progressinterval == 0)
+ || (debug
+ && (monitorstart == -1 || monitorend == -1 || size <= monitorend)))
prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
if (ftruncate(fd, (off_t) size) == -1) {
prt("ftruncate1: %x\n", size);
void
-writefileimage()
+writefileimage(void)
{
ssize_t iret;
void
-cleanup(sig)
- int sig;
+cleanup(int sig)
{
if (sig)
prt("signal %d\n", sig);
warn("main: error on write");
} else
warn("main: short write, 0x%x bytes instead of 0x%x\n",
- (unsigned)written, maxfilelen);
+ (unsigned)written, (unsigned)maxfilelen);
exit(98);
}
} else
int
main(int argc, char *argv[])
{
- int fd1;
int ret;
- struct stat sb1;
-
ret = mkdir("1", 0777);
if (ret < 0)
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
+#include <time.h>
#include <err.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
+#include <time.h>
#include <err.h>
static int read_flag;
static int mmap_flag;
-static int help_flag;
static void
usage(int exit_val)
int
main(int argc, char **argv)
{
- int optind = 0;
-
if (argc != 2)
usage(1);
err(1, "open %s", file);
mmap_buf = mmap_file(fd, sz);
- malloc_buf = read_file(fd, sz);
+ malloc_buf = (unsigned char *) read_file(fd, sz);
close(fd);
unlink(file);
if (memcmp(malloc_buf, mmap_buf, sz) != 0) {
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
+#include <time.h>
#include <err.h>
{
int ret;
int fd;
- struct stat old_sb, new_sb, dot_sb;
fd = open("foo", O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0)
#include <unistd.h>
#include <dirent.h>
+#include <afs/stds.h>
+
#include <err.h>
+#include <fs_lib.h>
static void
kill_one(const char *filename);
#ifndef HAVE_VASNPRINTF
int vasnprintf(char **ret, size_t max_sz, const char *format, va_list args);
#endif
+#ifndef HAVE_VASPRINTF
+int vasprintf(char**ret, const char *format, va_list args);
+#endif
#ifndef min
#define min(a, b) ((a) > (b) ? (b) : (a))
hdr->dump_date = ntohl(bckhdr->c_time);
hdr->filenum = ntohl(bckhdr->c_filenum);
hdr->volid = ntohl(bckhdr->c_id);
+#ifdef NATIVE_INT64
hdr->dumplen = ntohl(bckhdr->c_length);
+#else
+ hdr->dumplen.hi = 0;
+ hdr->dumplen.lo = ntohl(bckhdr->c_length);
+#endif
hdr->level = ntohl(bckhdr->c_level);
hdr->magic = ntohl(bckhdr->c_magic);
hdr->cksum = ntohl(bckhdr->c_checksum);
bckhdr->c_filenum = htonl(hdr->filenum);
bckhdr->c_time = htonl(hdr->dump_date);
bckhdr->c_id = htonl(hdr->volid);
- bckhdr->c_length = htonl(hdr->dumplen);
+#ifdef NATIVE_INT64
+ bckhdr->c_length = htonl((afs_uint32) hdr->dumplen);
+#else
+ bckhdr->c_length = htonl(hdr->dumplen.lo);
+#endif
bckhdr->c_level = htonl(hdr->level);
bckhdr->c_magic = htonl(STAGE_MAGIC);
bckhdr->c_flags = htonl(hdr->flags);
#endif
#include <stdio.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <config.h>
#endif
+#include <grp.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#include <pwd.h>
#include <limits.h>
+#include <afs/stds.h>
+#include <afs/sys_prototypes.h>
+
#include <err.h>
#if !defined(NGROUPS) && defined(NGROUPS_MAX)
#include <pwd.h>
#include <limits.h>
+#include <afs/stds.h>
+#include <afs/sys_prototypes.h>
+
#include <err.h>
#if !defined(NGROUPS) && defined(NGROUPS_MAX)
#include <utime.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <time.h>
#include <err.h>
#include <afs/stds.h>
#include <afs/vice.h>
#include <afs/venus.h>
+#include <afs/sys_prototypes.h>
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
* SUCH DAMAGE.
*/
-#define _LARGEFILE64_SOURCE
+#ifndef _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE
+#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
{
const char *file;
size_t sz;
- char *random_buf;
- char *read_buf1;
- char *read_buf2;
int fd;
if (argc != 3)
struct ktc_principal sname;
struct ktc_token token;
struct afsconf_dir *confdir;
- afs_uint32 code, server_addr;
+ afs_uint32 code, server_addr = 0;
afs_int32 volid, date, partid = 0;
int isnum, index;
char *x, *y;