1DPNS_READDIRXP(3) DPNS Library Functions DPNS_READDIRXP(3)
2
3
4
6 dpns_readdirxp - read DPNS directory opened by dpns_opendir in the name
7 server
8
10 #include <sys/types.h>
11 #include "dpns_api.h"
12
13 struct dpns_direnrep *dpns_readdirxp (dpns_DIR *dirp, char *pattern,
14 char *se)
15
17 dpns_readdirxp reads the DPNS directory opened by dpns_opendir in the
18 name server. It does restricted pattern matching on basename. This
19 routine returns a pointer to a structure containing the current direc‐
20 tory entry (basename, guid and filesize) and the replica information.
21
22 struct dpns_rep_info {
23 u_signed64 fileid;
24 char status;
25 char *host;
26 char *sfn;
27 };
28
29 struct dpns_direnrep {
30 u_signed64 fileid;
31 char guid[CA_MAXGUIDLEN+1];
32 mode_t filemode;
33 u_signed64 filesize;
34 int nbreplicas;
35 struct dpns_rep_info *rep; /* array of replica info structures */
36 unsigned short d_reclen; /* length of this entry */
37 char d_name[1]; /* basename in variable length */
38 };
39
40 dpns_readdirxp caches a variable number of such entries, depending on
41 the filename size, to minimize the number of requests to the name
42 server.
43
44 dirp specifies the pointer value returned by dpns_opendir.
45
46 pattern
47 allows to restrict the listing to entries having the basename
48 starting with this pattern.
49
50 se allows to restrict the replica entries to a given SE.
51
53 This routine returns a pointer to a structure containing the current
54 directory entry if the operation was successful or NULL if the end of
55 the directory was reached or if the operation failed. When the end of
56 the directory is encountered, serrno is not changed. If the operation
57 failed, serrno is set appropriately.
58
59 As dpns_readdirxp returns a null pointer both at the end of the direc‐
60 tory and on error, an application wishing to check for error situations
61 should set serrno to 0, then call dpns_readdirxp, then check serrno and
62 if it is non-zero, assume an error has occurred.
63
65 EBADF File descriptor in DIR structure is invalid.
66
67 ENOMEM Memory could not be allocated for unmarshalling the reply.
68
69 EFAULT dirp is a NULL pointer.
70
71 EINVAL The length of pattern exceeds CA_MAXNAMELEN or the length
72 of se exceeds CA_MAXHOSTNAMELEN.
73
74 SENOSHOST Host unknown.
75
76 SENOSSERV Service unknown.
77
78 SECOMERR Communication error.
79
80 ENSNACT Name server is not running or is being shutdown.
81
83 dpns_closedir(3), dpns_opendir(3), dpns_rewinddir(3)
84
86 LCG Grid Deployment Team
87
88
89
90DPNS $Date: 2007/12/13 11:59:47 $ DPNS_READDIRXP(3)