forked from Elara6331/itd
Used switch instead of if
This commit is contained in:
parent
3a8888c003
commit
b820d6a674
@ -18,7 +18,8 @@ var _ = (fs.NodeReaddirer)((*ITNode)(nil))
|
|||||||
|
|
||||||
// Readdir is part of the NodeReaddirer interface
|
// Readdir is part of the NodeReaddirer interface
|
||||||
func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
||||||
if n.kind == 0 {
|
switch n.kind {
|
||||||
|
case 0:
|
||||||
// root folder
|
// root folder
|
||||||
r := make([]fuse.DirEntry, 2)
|
r := make([]fuse.DirEntry, 2)
|
||||||
r[0] = fuse.DirEntry{
|
r[0] = fuse.DirEntry{
|
||||||
@ -39,7 +40,9 @@ func (n *ITNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) {
|
|||||||
|
|
||||||
var _ = (fs.NodeLookuper)((*ITNode)(nil))
|
var _ = (fs.NodeLookuper)((*ITNode)(nil))
|
||||||
func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
func (n *ITNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno) {
|
||||||
if n.kind == 0 {
|
switch n.kind {
|
||||||
|
case 0:
|
||||||
|
// root folder
|
||||||
if name == "device" {
|
if name == "device" {
|
||||||
stable := fs.StableAttr{
|
stable := fs.StableAttr{
|
||||||
Mode: fuse.S_IFDIR,
|
Mode: fuse.S_IFDIR,
|
||||||
|
Loading…
Reference in New Issue
Block a user