func (d *DirectoryInode) IsRoot() bool {
	return d.parent == nil
}
IsRoot returns true if the DirectoryInode has no parent
package iso9660
import (
	"errors"
	"os"
	"time"
	"github.com/badgerodon/collections/queue"
	"github.com/emirpasic/gods/maps/treemap"
	"github.com/NVIDIA/vdisc/pkg/iso9660/susp"
)
type dirEntry struct {
	name  string
	child Inode
}
type DirectoryInode struct {
	ino           InodeNumber
	perm          os.FileMode
	created       time.Time
	modified      time.Time
	parent        *DirectoryInode
	start         LogicalBlockAddress
	idAlloc       *IdentifierAllocator
	names         map[string]string  
	children      *treemap.Map       
	size          uint32
	nameValidator NameValidator
}
func NewDirectoryInode(ia InodeAllocator, validator NameValidator) (*DirectoryInode, error) {
	ino, err := ia.Next()
	if err != nil {
		return nil, err
	}
	return &DirectoryInode{
		ino:           ino,
		perm:          0555,
		created:       time.Unix(0, 0).UTC(),
		modified:      time.Unix(0, 0).UTC(),
		idAlloc:       NewIdentifierAllocator(),
		names:         make(map[string]string),
		children:      treemap.NewWithStringComparator(),
		nameValidator: validator,
	}, nil
}
func (d *DirectoryInode) Type() InodeType {
	return InodeTypeDirectory
}
func (d *DirectoryInode) InodeNumber() InodeNumber {
	return d.ino
}
func (d *DirectoryInode) Perm() os.FileMode {
	return d.perm
}
func (d *DirectoryInode) SetPerm(perm os.FileMode) {
	d.perm = perm & os.ModePerm
}
func (d *DirectoryInode) Created() time.Time {
	return d.created
}
func (d *DirectoryInode) SetCreated(created time.Time) {
	d.created = created
}
func (d *DirectoryInode) Modified() time.Time {
	return d.modified
}
func (d *DirectoryInode) SetModified(modified time.Time) {
	d.modified = modified
}
func (d *DirectoryInode) AddChild(name string, child Inode) error {
	if len(name) < 1 {
		return errors.New("Inode names may not be empty")
	}
	if err := d.nameValidator.IsValid(name); err != nil {
		return errors.New("AddChild: " + err.Error())
	}
	if name == "." || name == ".." {
		return errors.New("Inode names '.' and '..' are reserved")
	}
	if _, ok := d.names[name]; ok {
		return errors.New("Directory entry collision")
	}
	ident := d.idAlloc.Next()
	if child.Type() != InodeTypeDirectory {
		ident += ";1"
	}
	d.names[name] = ident
	d.children.Put(ident, &dirEntry{name, child})
	child.AddParent(d)
	return nil
}
func (d *DirectoryInode) GetChild(name string) (Inode, bool) {
	ident, ok := d.names[name]
	if ok {
		dent, ok := d.children.Get(ident)
		if ok {
			return dent.(*dirEntry).child, true
		}
	}
	return nil, false
}
func (d *DirectoryInode) AddParent(parent *DirectoryInode) {
	if d.parent != nil {
		panic("Directories can only have one parent")
	}
	if d != parent {
		d.parent = parent
	}
}
func (d *DirectoryInode) Nlink() uint32 {
	nlink := uint32(2)
	it := d.children.Iterator()
	for it.Next() {
		dent := it.Value().(*dirEntry)
		if dent.child.Type() == InodeTypeDirectory {
			nlink++
		}
	}
	return nlink
}