Exemple #1
0
func (m *MemMapFs) lockfreeMkdir(name string, perm os.FileMode) error {
	name = normalizePath(name)
	x, ok := m.getData()[name]
	if ok {
		// Only return ErrFileExists if it's a file, not a directory.
		i := mem.FileInfo{x}
		if !i.IsDir() {
			return ErrFileExists
		}
	} else {
		item := mem.CreateDir(name)
		m.getData()[name] = item
		m.registerWithParent(item)
	}
	return nil
}
Exemple #2
0
func (m *MemMapFs) List() {
	for _, x := range m.data {
		y := mem.FileInfo{x}
		fmt.Println(x.Name(), y.Size())
	}
}