MCPcopy Create free account
hub / github.com/ceph/ceph / get_random_sub

Method get_random_sub

src/client/SyntheticClient.h:147–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145 }
146 filepath n2;
147 const char *get_random_sub() {
148 ceph_assert(!contents.empty());
149 int r = ((rand() % contents.size()) + (rand() % contents.size())) / 2; // non-uniform distn
150 if (cwd.depth() && cwd.last_dentry().length())
151 r += cwd.last_dentry().c_str()[0]; // slightly permuted
152 r %= contents.size();
153
154 std::map<std::string,struct stat*>::iterator it = contents.begin();
155 while (r--) ++it;
156
157 n2 = cwd;
158 n2.push_dentry( it->first );
159 return n2.get_path().c_str();
160 }
161
162 filepath sub;
163 char sub_s[50];

Callers

nothing calls this directly

Calls 8

depthMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
beginMethod · 0.45
push_dentryMethod · 0.45
get_pathMethod · 0.45

Tested by

no test coverage detected