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
This commit is contained in:
Michael Lotz 2008-04-05 22:01:05 +00:00
parent d0fc7c65c6
commit efb965d559
2 changed files with 16 additions and 0 deletions

View File

@ -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, status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
bool kernel, void **_node); bool kernel, void **_node);
status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat); 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_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, status_t vfs_entry_ref_to_path(dev_t device, ino_t inode, const char *leaf,
char *path, size_t pathLength); char *path, size_t pathLength);

View File

@ -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 status_t
vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize) vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize)
{ {