*
*/
int
-build_path_with_parent(vnode_t first_vp, vnode_t parent_vp, char *buff, int buflen, int *outlen, int flags, vfs_context_t ctx)
+build_path_with_parent(vnode_t first_vp, vnode_t parent_vp, char *buff, int buflen,
+ int *outlen, size_t *mntpt_outlen, int flags, vfs_context_t ctx)
{
vnode_t vp, tvp;
vnode_t vp_with_iocount;
vnode_t proc_root_dir_vp;
char *end;
+ char *mntpt_end;
const char *str;
int len;
int ret = 0;
end = &buff[buflen - 1];
*end = '\0';
+ mntpt_end = NULL;
/*
* holding the NAME_CACHE_LOCK in shared mode is
goto out_unlock;
} else {
vp = vp->v_mount->mnt_vnodecovered;
+ if (!mntpt_end && vp) {
+ mntpt_end = end;
+ }
}
}
}
tvp = NULL;
} else {
tvp = tvp->v_mount->mnt_vnodecovered;
+ if (!mntpt_end && tvp) {
+ mntpt_end = end;
+ }
}
}
if (tvp == NULLVP) {
/*
* length includes the trailing zero byte
*/
- *outlen = &buff[buflen] - end;
+ *outlen = (int)(&buff[buflen] - end);
+ if (mntpt_outlen && mntpt_end) {
+ *mntpt_outlen = (size_t)*outlen - (size_t)(&buff[buflen] - mntpt_end);
+ }
/* One of the parents was moved during path reconstruction.
* The caller is interested in knowing whether any of the
int
build_path(vnode_t first_vp, char *buff, int buflen, int *outlen, int flags, vfs_context_t ctx)
{
- return build_path_with_parent(first_vp, NULL, buff, buflen, outlen, flags, ctx);
+ return build_path_with_parent(first_vp, NULL, buff, buflen, outlen, NULL, flags, ctx);
}
/*