* Retrieve the full filesystem path that correspond to a vnode from the name * cache (if available) */
| 2955 | * cache (if available) |
| 2956 | */ |
| 2957 | int |
| 2958 | vn_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 |
no test coverage detected