1DPNS_LISTREPLICA(3) DPNS Library Functions DPNS_LISTREPLICA(3)
2
3
4
6 dpns_listreplica - list replica entries for a given file
7
9 #include <sys/types.h>
10 #include "dpns_api.h"
11
12 struct dpns_filereplica *dpns_listreplica (const char *path, const char
13 *guid, int flags, dpns_list *listp)
14
16 dpns_listreplica lists replica entries for a given file. This routine
17 returns a pointer to a structure containing the current replica entry.
18
19 struct dpns_filereplica {
20 u_signed64 fileid;
21 u_signed64 nbaccesses;
22 time_t atime; /* last access to replica */
23 time_t ptime; /* replica pin time */
24 char status;
25 char f_type; /* 'V' for Volatile, 'P' for Permanent */
26 char poolname[CA_MAXPOOLNAMELEN+1];
27 char host[CA_MAXHOSTNAMELEN+1];
28 char fs[80];
29 char sfn[CA_MAXSFNLEN+1];
30 };
31
32 path specifies the logical pathname.
33
34 guid specifies the Grid Unique IDentifier.
35
36 flags may be one of the following constant:
37
38 CNS_LIST_BEGIN
39 the first call must have this flag set to allocate buf‐
40 fers and initialize pointers.
41
42 CNS_LIST_CONTINUE
43 all the following calls must have this flag set.
44
45 CNS_LIST_END
46 final call to terminate the list and free resources.
47
49 This routine returns a pointer to a structure containing the current
50 replica entry if the operation was successful or NULL if all entries
51 have been returned or if the operation failed. In the latter case, ser‐
52 rno is set appropriately.
53
55 A C program listing the replicas fo a given sfn could look like:
56
57 int flags;
58 dpns_list list;
59 struct dpns_filereplica *lp;
60
61 flags = CNS_LIST_BEGIN;
62 while ((lp = dpns_listreplica (sfn, NULL, flags, &list)) != NULL) {
63 flags = CNS_LIST_CONTINUE;
64 /* process the entry */
65 .....
66 }
67 (void) dpns_listreplica (sfn, NULL, CNS_LIST_END, &list);
68
70 ENOENT The named file does not exist.
71
72 EACCES Search permission is denied on a component of the parent
73 directory.
74
75 ENOMEM Memory could not be allocated for the output buffer.
76
77 EFAULT path and guid are NULL pointers or listp is a NULL
78 pointer.
79
80 ENOTDIR A component of path prefix is not a directory.
81
82 EINVAL The length of guid exceeds CA_MAXGUIDLEN or path and guid
83 are both given and they point at a different file.
84
85 ENAMETOOLONG The length of path exceeds CA_MAXPATHNAMELEN.
86
87 SENOSHOST Host unknown.
88
89 SENOSSERV Service unknown.
90
91 SECOMERR Communication error.
92
93 ENSNACT Name server is not running or is being shutdown.
94
96 Castor_limits(4), dpns_addreplica(3)
97
98
99
100DPNS $Date: 2010-09-14 13:37:49 +0200 (Tue, 14 Sep 2D0P1N0S)_L$ISTREPLICA(3)