8 /* for relative path searching */
11 DIR *opendir(const char *path
)
16 inode
= namei(path
, 0);
17 if (IS_ERR_OR_NULL(inode
))
18 return inode
? ERR_CAST(inode
) : ERR_PTR(-ENOENT
);
20 dir
= malloc(sizeof(*dir
));
22 return ERR_PTR(-ENOMEM
);
23 dir
->dd_dir
= malloc(sizeof(struct file
));
26 return ERR_PTR(-ENOMEM
);
28 dir
->dd_dir
->inode
= inode
;
29 dir
->dd_dir
->fs
= inode
->i_fs
;
30 dir
->dd_dir
->offset
= 0;
31 dir
->dd_dir
->f_op
= inode
->i_fop
;