linux dentry目录项遍历实现tree命令

  struct list_head*plist
    list_for_each(l,&(root_dentry->d_subdirs))
    {
            struct dentry* temp=list_entry(plist,struct dentry,d_child);
            if(temp)
            if(temp->d_inode)
            if(d_count(temp))
            {       
                        printf("%s",temp->d_name.name);
            }       
    }

采用如上方式遍历dentry目录结构,怎么dev与proc的子目录不能打印呢?
发现两个目录的d_subdirs 结构的next与prev指针都指向自己。
怎么使用dentry结构实现tree命令呢?

proc是虚拟目录。它的dentry结构可能不能这么处理。