XRootD
Loading...
Searching...
No Matches
XrdCmsPList_Anchor Class Reference

#include <XrdCmsPList.hh>

+ Collaboration diagram for XrdCmsPList_Anchor:

Public Member Functions

 XrdCmsPList_Anchor ()
 
 ~XrdCmsPList_Anchor ()
 
int Add (const char *pname, XrdCmsPInfo *pinfo)
 
void Empty (XrdCmsPList *newlist=0)
 
int Find (const char *pname, XrdCmsPInfo &masks)
 
XrdCmsPListFirst ()
 
SMask_t Insert (const char *pname, XrdCmsPInfo *pinfo)
 
void Lock ()
 
int NotEmpty ()
 
void Remove (SMask_t mask)
 
const char * Type (const char *pname)
 
void UnLock ()
 
XrdCmsPListZorch (XrdCmsPList *newlist=0)
 

Detailed Description

Definition at line 95 of file XrdCmsPList.hh.

Constructor & Destructor Documentation

◆ XrdCmsPList_Anchor()

XrdCmsPList_Anchor::XrdCmsPList_Anchor ( )
inline

Definition at line 132 of file XrdCmsPList.hh.

132{next = 0;}

◆ ~XrdCmsPList_Anchor()

XrdCmsPList_Anchor::~XrdCmsPList_Anchor ( )
inline

Definition at line 134 of file XrdCmsPList.hh.

134{Empty();}
void Empty(XrdCmsPList *newlist=0)

References Empty().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add()

int XrdCmsPList_Anchor::Add ( const char *  pname,
XrdCmsPInfo pinfo 
)

Definition at line 41 of file XrdCmsPList.cc.

42{
43 int plen = strlen(pname);
44 XrdCmsPList *p, *pp;
45
46// Set up the search
47//
48 Lock();
49 p = next;
50 pp = 0;
51
52// Find the proper insertion point. Paths are sorted in decreasin length order.
53//
54 while(p && p->pathlen >= plen)
55 {if (p->pathlen == plen && !strcmp(p->pathname,pname))
56 {UnLock(); return 0;}
57 pp = p;
58 p = p->next;
59 }
60
61// Insert a new element
62//
63 p = new XrdCmsPList(pname, pinfo);
64 if (pp) { p->next = pp->next; pp->next = p;}
65 else { p->next = next; next = p;}
66
67// All done
68//
69 UnLock();
70 return 1;
71}

References Lock(), and UnLock().

+ Here is the call graph for this function:

◆ Empty()

void XrdCmsPList_Anchor::Empty ( XrdCmsPList newlist = 0)
inline

Definition at line 104 of file XrdCmsPList.hh.

105 {Lock();
106 XrdCmsPList *p = next;
107 while(p) {next = p->next; delete p; p = next;}
108 next = newlist;
109 UnLock();
110 }

References Lock(), and UnLock().

Referenced by ~XrdCmsPList_Anchor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Find()

int XrdCmsPList_Anchor::Find ( const char *  pname,
XrdCmsPInfo masks 
)

Definition at line 77 of file XrdCmsPList.cc.

78{
79 int plen = strlen(pname);
80
81// Lock the anchor and setup for search
82//
83 Lock();
84 XrdCmsPList *p = next;
85
86// Find matching entry
87//
88 while(p) if (p->pathlen <= plen && !strncmp(p->pathname, pname, p->pathlen))
89 {pinfo = p->pathmask; break;}
90 else p = p->next;
91
92// All done
93//
94 UnLock();
95 return p != 0;
96}

References Lock(), and UnLock().

Referenced by XrdCmsNode::do_Have(), XrdCmsNode::do_StateFWD(), XrdCmsNode::do_StatFS(), XrdCmsCluster::Locate(), and XrdCmsCluster::Select().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ First()

XrdCmsPList * XrdCmsPList_Anchor::First ( )
inline

Definition at line 114 of file XrdCmsPList.hh.

114{return next;}

◆ Insert()

SMask_t XrdCmsPList_Anchor::Insert ( const char *  pname,
XrdCmsPInfo pinfo 
)

Definition at line 102 of file XrdCmsPList.cc.

103{
104 int rc, plen = strlen(pname);
105 XrdCmsPList *p, *pp;
106 SMask_t newmask;
107
108// Set up the search
109//
110 Lock();
111 p = next;
112 pp = 0;
113
114// Find the proper insertion point. Paths are sorted in decreasin length
115// order. We must merge in the incoming mask with all subset paths.
116//
117 rc = 1;
118 while(p && p->pathlen >= plen)
119 {if (p->pathlen == plen && !(rc = strcmp(p->pathname,pname))) break;
120 else if (!strncmp(p->pathname,pname,plen)
121 && !(p->pathmask.rovec & pinfo->rovec))
122 {p->pathmask.And(~(pinfo->rovec)); p->pathmask.Or(pinfo);}
123 pp = p;
124 p = p->next;
125 }
126
127// Either merge the path masks or insert a new path. For a new path, add to
128// it masks of all superset paths that may follow it in the chain of paths.
129//
130 if (!rc) {p->pathmask.And(~(pinfo->rovec)); p->pathmask.Or(pinfo);}
131 else { p = new XrdCmsPList(pname, pinfo);
132 if (pp)
133 { p->next = pp->next;
134 pp->next = p;
135 } else {
136 p->next = next;
137 next = p;
138 }
139 pp = p->next;
140 while(pp) {if (pp->pathlen < plen
141 && !strncmp(pp->pathname,pname,pp->pathlen))
142 p->pathmask.Or(&(pp->pathmask));
143 pp = pp->next;
144 }
145 }
146
147// All done
148//
149 newmask = p->pathmask.rovec | p->pathmask.rwvec;
150 UnLock();
151 return newmask;
152}
unsigned long long SMask_t
int And(const SMask_t mask)
SMask_t rovec
SMask_t rwvec
void Or(const XrdCmsPInfo *pi)

References XrdCmsPInfo::And(), Lock(), XrdCmsPInfo::Or(), XrdCmsPInfo::rovec, XrdCmsPInfo::rwvec, and UnLock().

+ Here is the call graph for this function:

◆ Lock()

void XrdCmsPList_Anchor::Lock ( )
inline

Definition at line 99 of file XrdCmsPList.hh.

99{mutex.Lock();}

References XrdSysMutex::Lock().

Referenced by Add(), Empty(), Find(), Insert(), Remove(), Type(), and Zorch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotEmpty()

int XrdCmsPList_Anchor::NotEmpty ( )
inline

Definition at line 118 of file XrdCmsPList.hh.

118{return next != 0;}

◆ Remove()

void XrdCmsPList_Anchor::Remove ( SMask_t  mask)

Definition at line 158 of file XrdCmsPList.cc.

159{
160 SMask_t zmask(~mask);
161 XrdCmsPList *pp = next, *prevp = 0;
162
163// Lock the list
164//
165 Lock();
166
167// Remove bit from mask. If mask is zero, remove the entry
168//
169 while(pp)
170 {if (!pp->pathmask.And(zmask))
171 {if (prevp) {prevp->next = pp->next; delete pp; pp = prevp->next;}
172 else { next = pp->next; delete pp; pp = next;}
173 }
174 else {prevp = pp; pp = pp->next;}
175 }
176
177// All done
178//
179 UnLock();
180}

References XrdCmsPInfo::And(), Lock(), and UnLock().

Referenced by XrdCmsCache::Drop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Type()

const char * XrdCmsPList_Anchor::Type ( const char *  pname)

Definition at line 186 of file XrdCmsPList.cc.

187{
188 int isrw = 0, plen = strlen(pname);
189
190// Lock the anchor and setup for search
191//
192 Lock();
193 XrdCmsPList *p = next;
194
195// Find matching entry
196//
197 while(p) if (p->pathlen <= plen && !strncmp(p->pathname, pname, p->pathlen))
198 {isrw = (p->pathmask.rwvec != 0); break;}
199 else p = p->next;
200
201// All done
202//
203 UnLock();
204 if (p) return (isrw ? "w" : "r");
205 return "?";
206}

References Lock(), XrdCmsPInfo::rwvec, and UnLock().

+ Here is the call graph for this function:

◆ UnLock()

void XrdCmsPList_Anchor::UnLock ( )
inline

Definition at line 100 of file XrdCmsPList.hh.

100{mutex.UnLock();}

References XrdSysMutex::UnLock().

Referenced by Add(), Empty(), Find(), Insert(), Remove(), Type(), and Zorch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Zorch()

XrdCmsPList * XrdCmsPList_Anchor::Zorch ( XrdCmsPList newlist = 0)
inline

Definition at line 124 of file XrdCmsPList.hh.

125 {Lock();
126 XrdCmsPList *p = next;
127 next = newlist;
128 UnLock();
129 return p;
130 }

References Lock(), and UnLock().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: