From efb965d5596e99bc2d3bd0cb6c7ee6c4a81a2637 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 5 Apr 2008 22:01:05 +0000 Subject: [PATCH] Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t and ino_t instead of a path. Supposed to work with node monitoring messages. Took the name from vfs_entry_ref_to_path() that takes the same arguments, but suggestions for a better name are welcome. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24813 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/vfs.h | 1 + src/system/kernel/fs/vfs.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index 33746cdc8c..f3920e6b93 100644 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -107,6 +107,7 @@ status_t vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size, status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path, bool kernel, void **_node); status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat); +status_t vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat); status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize); status_t vfs_entry_ref_to_path(dev_t device, ino_t inode, const char *leaf, char *path, size_t pathLength); diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index dd605b1cd9..f02a69b3d8 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -3802,6 +3802,21 @@ vfs_stat_vnode(struct vnode *vnode, struct stat *stat) } +status_t +vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat) +{ + struct vnode *vnode; + status_t status = get_vnode(device, inode, &vnode, true, false); + if (status < B_OK) + return status; + + status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, + vnode->private_node, stat); + put_vnode(vnode); + return status; +} + + status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize) {