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

Function vn_fullpath

freebsd/kern/vfs_cache.c:2957–2984  ·  view source on GitHub ↗

* Retrieve the full filesystem path that correspond to a vnode from the name * cache (if available) */

Source from the content-addressed store, hash-verified

2955 * cache (if available)
2956 */
2957int
2958vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf)
2959{
2960 struct pwd *pwd;
2961 char *buf;
2962 size_t buflen;
2963 int error;
2964
2965 if (__predict_false(vp == NULL))
2966 return (EINVAL);
2967
2968 buflen = MAXPATHLEN;
2969 buf = malloc(buflen, M_TEMP, M_WAITOK);
2970 vfs_smr_enter();
2971 pwd = pwd_get_smr();
2972 error = vn_fullpath_any_smr(vp, pwd->pwd_rdir, buf, retbuf, &buflen, 0);
2973 VFS_SMR_ASSERT_NOT_ENTERED();
2974 if (error < 0) {
2975 pwd = pwd_hold(curthread);
2976 error = vn_fullpath_any(vp, pwd->pwd_rdir, buf, retbuf, &buflen);
2977 pwd_drop(pwd);
2978 }
2979 if (error == 0)
2980 *freebuf = buf;
2981 else
2982 free(buf, M_TEMP);
2983 return (error);
2984}
2985
2986/*
2987 * This function is similar to vn_fullpath, but it attempts to lookup the

Callers 7

sysctl_kern_proc_ovmmapFunction · 0.70
kern_proc_vmmap_outFunction · 0.70
vn_fill_kinfo_vnodeFunction · 0.70
ptrace_vm_entryFunction · 0.70
do_execveFunction · 0.70
sysctl_vm_object_listFunction · 0.50

Calls 6

mallocFunction · 0.85
vn_fullpath_any_smrFunction · 0.85
pwd_holdFunction · 0.85
vn_fullpath_anyFunction · 0.85
pwd_dropFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected