MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lf_hash_owner

Function lf_hash_owner

freebsd/kern/kern_lockf.c:303–318  ·  view source on GitHub ↗

* Generate a hash value for a lock owner. */

Source from the content-addressed store, hash-verified

301 * Generate a hash value for a lock owner.
302 */
303static int
304lf_hash_owner(caddr_t id, struct vnode *vp, struct flock *fl, int flags)
305{
306 uint32_t h;
307
308 if (flags & F_REMOTE) {
309 h = HASHSTEP(0, fl->l_pid);
310 h = HASHSTEP(h, fl->l_sysid);
311 } else if (flags & F_FLOCK) {
312 h = ((uintptr_t) id) >> 7;
313 } else {
314 h = ((uintptr_t) vp) >> 7;
315 }
316
317 return (h % LOCK_OWNER_HASH_SIZE);
318}
319
320/*
321 * Return true if a lock owner matches the details passed to

Callers 1

lf_advlockasyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected