Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * V9FS FID Management
0004  *
0005  *  Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
0006  */
0007 #ifndef FS_9P_FID_H
0008 #define FS_9P_FID_H
0009 #include <linux/list.h>
0010 
0011 struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
0012 static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
0013 {
0014     return v9fs_fid_lookup(dentry->d_parent);
0015 }
0016 void v9fs_fid_add(struct dentry *dentry, struct p9_fid **fid);
0017 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
0018 void v9fs_open_fid_add(struct inode *inode, struct p9_fid **fid);
0019 static inline struct p9_fid *clone_fid(struct p9_fid *fid)
0020 {
0021     return IS_ERR(fid) ? fid :  p9_client_walk(fid, 0, NULL, 1);
0022 }
0023 static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
0024 {
0025     struct p9_fid *fid, *nfid;
0026 
0027     fid = v9fs_fid_lookup(dentry);
0028     if (!fid || IS_ERR(fid))
0029         return fid;
0030 
0031     nfid = clone_fid(fid);
0032     p9_fid_put(fid);
0033     return nfid;
0034 }
0035 #endif