~ubuntu-branches/ubuntu/oneiric/openafs/oneiric-201305130334

« back to all changes in this revision

Viewing changes to src/volser/dumpstuff.c

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-09-22 19:07:02 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080922190702-59m13d7kn6gkw32d
Tags: 1.4.7.dfsg1-6
* Apply upstream patch to free /proc entries in the correct order.
  Thanks, Marc Dionne.  (Closes: #493914)
* Apply upstream deltas to support 2.6.27 kernels and to stop using
  COMMON_KERN_CFLAGS for all 2.6 kernels uniformly, which fixes
  problems on amd64 with newer kernels.  Thanks, Björn Torkelsson.
  (LP: #267504)
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #493120)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include <afs/param.h>
12
12
 
13
13
RCSID
14
 
    ("$Header: /cvs/openafs/src/volser/dumpstuff.c,v 1.25.2.5 2006/10/13 12:46:03 shadow Exp $");
 
14
    ("$Header: /cvs/openafs/src/volser/dumpstuff.c,v 1.25.2.10 2008/01/21 14:11:20 shadow Exp $");
15
15
 
16
16
#include <sys/types.h>
17
17
#include <ctype.h>
18
18
#include <stdio.h>
19
19
#include <errno.h>
 
20
#include <string.h>
20
21
#ifdef AFS_NT40_ENV
21
22
#include <fcntl.h>
22
23
#else
26
27
#include <netinet/in.h>
27
28
#include <unistd.h>
28
29
#endif
29
 
#ifdef HAVE_STRING_H
30
 
#include <string.h>
31
 
#else
32
 
#ifdef HAVE_STRINGS_H
33
 
#include <strings.h>
34
 
#endif
35
 
#endif
36
30
#include <sys/stat.h>
37
31
#ifdef AFS_PTHREAD_ENV
38
32
#include <assert.h>
990
984
            if (Buf == NULL) {
991
985
                STREAM_CLOSE(afile);
992
986
                FDH_CLOSE(fdP);
993
 
                return 1;
 
987
                return -1;
994
988
            }
995
989
            memset((char *)Buf, 0, nVnodes * sizeof(afs_int32));
996
990
            STREAM_SEEK(afile, offset = vcp->diskSize, 0);
1027
1021
    struct iod iod;
1028
1022
    register struct iod *iodp = &iod;
1029
1023
    afs_int32 *b1 = NULL, *b2 = NULL;
1030
 
    int s1 = 0, s2 = 0, delo = incremental, tdelo;
 
1024
    int s1 = 0, s2 = 0, delo = 0, tdelo;
1031
1025
    int tag;
1032
1026
 
1033
1027
    iod_Init(iodp, call);
1034
1028
 
1035
1029
    vp = avp;
 
1030
 
1036
1031
    if (!ReadDumpHeader(iodp, &header)) {
1037
1032
        Log("1 Volser: RestoreVolume: Error reading header file for dump; aborted\n");
1038
1033
        return VOLSERREAD_DUMPERROR;
1048
1043
        delo = ProcessIndex(vp, vLarge, &b1, &s1, 0);
1049
1044
    if (!delo)
1050
1045
        delo = ProcessIndex(vp, vSmall, &b2, &s2, 0);
1051
 
    if (delo) {
1052
 
        if (b1)
1053
 
            free((char *)b1);
1054
 
        if (b2)
1055
 
            free((char *)b2);
1056
 
        b1 = b2 = NULL;
1057
 
        s1 = s2 = 0;
 
1046
    if (delo < 0) {
 
1047
        Log("1 Volser: RestoreVolume: ProcessIndex failed; not restored\n");
 
1048
        error = VOLSERREAD_DUMPERROR;
 
1049
        goto out;
1058
1050
    }
1059
1051
 
1060
1052
    strncpy(vol.name, cookie->name, VOLSER_OLDMAXVOLNAME);
1062
1054
    vol.cloneId = cookie->clone;
1063
1055
    vol.parentId = cookie->parent;
1064
1056
 
1065
 
 
1066
1057
    tdelo = delo;
1067
1058
    while (1) {
1068
1059
        if (ReadVnodes(iodp, vp, 0, b1, s1, b2, s2, tdelo)) {
1095
1086
    if (!delo) {
1096
1087
        delo = ProcessIndex(vp, vLarge, &b1, &s1, 1);
1097
1088
        if (!delo)
1098
 
            ProcessIndex(vp, vSmall, &b2, &s2, 1);
1099
 
        if (delo) {
 
1089
            delo = ProcessIndex(vp, vSmall, &b2, &s2, 1);
 
1090
        if (delo < 0) {
1100
1091
            error = VOLSERREAD_DUMPERROR;
1101
1092
            goto clean;
1102
1093
        }