forked from openafs/openafs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolstub.c
101 lines (87 loc) · 2.48 KB
/
volstub.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
*
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
*/
#include <afsconfig.h>
#include <afs/param.h>
#include <sys/types.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
#include <rx/xdr.h>
#include <afs/vlserver.h> /*Misc server-side Volume Location stuff */
#include <ubik.h>
#include <afs/volser.h>
#include "bc.h"
#include <afs/volint.h>
#include <afs/volser.h>
#include <afs/volser_prototypes.h>
#include <afs/com_err.h>
extern char *whoami;
/* ********************************************************************* */
/* Volserver routines */
/* ********************************************************************* */
afs_int32
bc_GetEntryByID(struct ubik_client *uclient, afs_int32 volID,
afs_int32 volType, struct vldbentry *vldbEntryPtr)
{
afs_int32 code = 0;
code =
ubik_VL_GetEntryByID(uclient, 0, volID, volType, vldbEntryPtr);
return (code);
}
/* volImageTime
* Determine the time stamp to be recorded with the backup of this
* volume. For backup and r/o volumes this is the clone time, for
* r/w volumes, this is the current time. This timestamp is stored
* directly into the cloneDate field of the bc_volumeDump structure
* exit:
* 0 - success
* -1 - failed to get information. Sets cloneDate to 0.
*/
afs_int32
volImageTime(afs_uint32 serv, afs_int32 part, afs_uint32 volid,
afs_int32 voltype, afs_int32 *clDatePtr)
{
afs_int32 code = 0;
struct volintInfo *viptr;
if (voltype == RWVOL) {
*clDatePtr = time(0);
return (0);
}
code = UV_ListOneVolume(htonl(serv), part, volid, &viptr);
if (code) {
afs_com_err(whoami, code,
"Warning: Can't get clone time of volume %u - using 0",
volid);
*clDatePtr = 0;
return (0);
}
/* volume types from vol/voldefs.h */
switch (viptr->type) {
case RWVOL:
/* For a r/w volume there may not be any foolproof way of
* preventing anomalies in the backups. Use the current time;
*/
*clDatePtr = time(0);
break;
case ROVOL:
case BACKVOL:
*clDatePtr = viptr->creationDate; /* use the creation time */
break;
default:
afs_com_err(whoami, 0,
"Can't get clone time of volume %u - unknown volume type",
volid);
return (-1);
}
return (0);
}