+13
-2
Documentation/filesystems/porting
+13
-2
Documentation/filesystems/porting
···
428
428
--
429
429
[mandatory]
430
430
d_alloc_root() is gone, along with a lot of bugs caused by code
431
-
misusing it. Replacement: d_make_root(inode). The difference is,
432
-
d_make_root() drops the reference to inode if dentry allocation fails.
431
+
misusing it. Replacement: d_make_root(inode). On success d_make_root(inode)
432
+
allocates and returns a new dentry instantiated with the passed in inode.
433
+
On failure NULL is returned and the passed in inode is dropped so the reference
434
+
to inode is consumed in all cases and failure handling need not do any cleanup
435
+
for the inode. If d_make_root(inode) is passed a NULL inode it returns NULL
436
+
and also requires no further error handling. Typical usage is:
437
+
438
+
inode = foofs_new_inode(....);
439
+
s->s_root = d_make_inode(inode);
440
+
if (!s->s_root)
441
+
/* Nothing needed for the inode cleanup */
442
+
return -ENOMEM;
443
+
...
433
444
434
445
--
435
446
[mandatory]