|
@@ -827,7 +827,7 @@ This describes how a filesystem can overload the standard dentry
|
|
|
operations. Dentries and the dcache are the domain of the VFS and the
|
|
|
individual filesystem implementations. Device drivers have no business
|
|
|
here. These methods may be set to NULL, as they are either optional or
|
|
|
-the VFS uses a default. As of kernel 2.6.13, the following members are
|
|
|
+the VFS uses a default. As of kernel 2.6.22, the following members are
|
|
|
defined:
|
|
|
|
|
|
struct dentry_operations {
|
|
@@ -837,6 +837,7 @@ struct dentry_operations {
|
|
|
int (*d_delete)(struct dentry *);
|
|
|
void (*d_release)(struct dentry *);
|
|
|
void (*d_iput)(struct dentry *, struct inode *);
|
|
|
+ char *(*d_dname)(struct dentry *, char *, int);
|
|
|
};
|
|
|
|
|
|
d_revalidate: called when the VFS needs to revalidate a dentry. This
|
|
@@ -859,6 +860,26 @@ struct dentry_operations {
|
|
|
VFS calls iput(). If you define this method, you must call
|
|
|
iput() yourself
|
|
|
|
|
|
+ d_dname: called when the pathname of a dentry should be generated.
|
|
|
+ Usefull for some pseudo filesystems (sockfs, pipefs, ...) to delay
|
|
|
+ pathname generation. (Instead of doing it when dentry is created,
|
|
|
+ its done only when the path is needed.). Real filesystems probably
|
|
|
+ dont want to use it, because their dentries are present in global
|
|
|
+ dcache hash, so their hash should be an invariant. As no lock is
|
|
|
+ held, d_dname() should not try to modify the dentry itself, unless
|
|
|
+ appropriate SMP safety is used. CAUTION : d_path() logic is quite
|
|
|
+ tricky. The correct way to return for example "Hello" is to put it
|
|
|
+ at the end of the buffer, and returns a pointer to the first char.
|
|
|
+ dynamic_dname() helper function is provided to take care of this.
|
|
|
+
|
|
|
+Example :
|
|
|
+
|
|
|
+static char *pipefs_dname(struct dentry *dent, char *buffer, int buflen)
|
|
|
+{
|
|
|
+ return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
|
|
|
+ dentry->d_inode->i_ino);
|
|
|
+}
|
|
|
+
|
|
|
Each dentry has a pointer to its parent dentry, as well as a hash list
|
|
|
of child dentries. Child dentries are basically like files in a
|
|
|
directory.
|