summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_subr.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-02-08 19:18:33 +0000
committerkib <kib@FreeBSD.org>2009-02-08 19:18:33 +0000
commit8571ced24c174eea12d164f46470290a8ed9cec6 (patch)
tree7dfcb5eedc4540a1aa55fa41015be168102928ea /sys/fs/tmpfs/tmpfs_subr.c
parent185bd48df413b2f290b4b5ccd6fb5af7310ec8a3 (diff)
downloadFreeBSD-src-8571ced24c174eea12d164f46470290a8ed9cec6.zip
FreeBSD-src-8571ced24c174eea12d164f46470290a8ed9cec6.tar.gz
Lookup up the directory entry for the tmpfs node that are deleted by
both node pointer and name component. This does the right thing for hardlinks to the same node in the same directory. Submitted by: Yoshihiro Ota <ota j email ne jp> PR: kern/131356 MFC after: 2 weeks
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index c0c6b50..3e5adf7 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -571,7 +571,8 @@ tmpfs_dir_detach(struct vnode *vp, struct tmpfs_dirent *de)
* Returns a pointer to the entry when found, otherwise NULL.
*/
struct tmpfs_dirent *
-tmpfs_dir_lookup(struct tmpfs_node *node, struct componentname *cnp)
+tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f,
+ struct componentname *cnp)
{
boolean_t found;
struct tmpfs_dirent *de;
@@ -583,6 +584,8 @@ tmpfs_dir_lookup(struct tmpfs_node *node, struct componentname *cnp)
found = 0;
TAILQ_FOREACH(de, &node->tn_dir.tn_dirhead, td_entries) {
+ if (f != NULL && de->td_node != f)
+ continue;
MPASS(cnp->cn_namelen < 0xffff);
if (de->td_namelen == (uint16_t)cnp->cn_namelen &&
bcmp(de->td_name, cnp->cn_nameptr, de->td_namelen) == 0) {
@@ -595,20 +598,6 @@ tmpfs_dir_lookup(struct tmpfs_node *node, struct componentname *cnp)
return found ? de : NULL;
}
-struct tmpfs_dirent *
-tmpfs_dir_search(struct tmpfs_node *node, struct tmpfs_node *f)
-{
- struct tmpfs_dirent *de;
-
- TMPFS_VALIDATE_DIR(node);
- node->tn_status |= TMPFS_NODE_ACCESSED;
- TAILQ_FOREACH(de, &node->tn_dir.tn_dirhead, td_entries) {
- if (de->td_node == f)
- return (de);
- }
- return (NULL);
-}
-
/* --------------------------------------------------------------------- */
/*
OpenPOWER on IntegriCloud