X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=Documentation%2Ffilesystems%2Fporting;h=6b7a41cfcaed05f9847553afb169181419599a85;hb=d6788eb7d0dcac9ce4084f7b87884812ebf5d941;hp=2813a19389fe2b226fa7c9b475f0d616e7ae2774;hpb=fa121bb3fed6313b1f0af23952301e06cf6d32ed;p=tomoyo%2Ftomoyo-test1.git diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 2813a19389fe..6b7a41cfcaed 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting @@ -428,8 +428,19 @@ release it yourself. -- [mandatory] d_alloc_root() is gone, along with a lot of bugs caused by code -misusing it. Replacement: d_make_root(inode). The difference is, -d_make_root() drops the reference to inode if dentry allocation fails. +misusing it. Replacement: d_make_root(inode). On success d_make_root(inode) +allocates and returns a new dentry instantiated with the passed in inode. +On failure NULL is returned and the passed in inode is dropped so the reference +to inode is consumed in all cases and failure handling need not do any cleanup +for the inode. If d_make_root(inode) is passed a NULL inode it returns NULL +and also requires no further error handling. Typical usage is: + + inode = foofs_new_inode(....); + s->s_root = d_make_root(inode); + if (!s->s_root) + /* Nothing needed for the inode cleanup */ + return -ENOMEM; + ... -- [mandatory]