当前位置: 首页>>代码示例>>Golang>>正文


Golang DirectoryInode.EntryList方法代码示例

本文整理汇总了Golang中github.com/Symantec/Dominator/lib/filesystem.DirectoryInode.EntryList方法的典型用法代码示例。如果您正苦于以下问题:Golang DirectoryInode.EntryList方法的具体用法?Golang DirectoryInode.EntryList怎么用?Golang DirectoryInode.EntryList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/Symantec/Dominator/lib/filesystem.DirectoryInode的用法示例。


在下文中一共展示了DirectoryInode.EntryList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: addEntry

func (decoderData *decoderData) addEntry(parent *filesystem.DirectoryInode,
	fullName, name string, inode filesystem.GenericInode) {
	var newEntry filesystem.DirectoryEntry
	newEntry.Name = name
	newEntry.InodeNumber = decoderData.nextInodeNumber
	newEntry.SetInode(inode)
	parent.EntryList = append(parent.EntryList, &newEntry)
	decoderData.addInode(fullName, inode)
}
开发者ID:keep94,项目名称:Dominator,代码行数:9,代码来源:decode.go

示例2: sortDirectory

func sortDirectory(directory *filesystem.DirectoryInode) {
	var entryList directoryEntryList
	entryList = directory.EntryList
	sort.Sort(entryList)
	directory.EntryList = entryList
	// Recurse through directories.
	for _, dirent := range directory.EntryList {
		if inode, ok := dirent.Inode().(*filesystem.DirectoryInode); ok {
			sortDirectory(inode)
		}
	}
}
开发者ID:datatonic,项目名称:Dominator,代码行数:12,代码来源:sort.go

示例3: addHardlink

func (decoderData *decoderData) addHardlink(header *tar.Header,
	parent *filesystem.DirectoryInode, name string) error {
	header.Linkname = normaliseFilename(header.Linkname)
	if inum, ok := decoderData.inodeTable[header.Linkname]; ok {
		var newEntry filesystem.DirectoryEntry
		newEntry.Name = name
		newEntry.InodeNumber = inum
		parent.EntryList = append(parent.EntryList, &newEntry)
	} else {
		return errors.New(fmt.Sprintf("missing hardlink target: %s",
			header.Linkname))
	}
	return nil
}
开发者ID:keep94,项目名称:Dominator,代码行数:14,代码来源:decode.go

示例4: scanDirectory

func scanDirectory(directory, oldDirectory *filesystem.DirectoryInode,
	fileSystem, oldFS *FileSystem, myPathName string) (error, bool) {
	file, err := os.Open(path.Join(fileSystem.rootDirectoryName, myPathName))
	if err != nil {
		return err, false
	}
	names, err := file.Readdirnames(-1)
	file.Close()
	if err != nil {
		return err, false
	}
	sort.Strings(names)
	entryList := make([]*filesystem.DirectoryEntry, 0, len(names))
	var copiedDirents int
	for _, name := range names {
		if directory == &fileSystem.DirectoryInode && name == ".subd" {
			continue
		}
		filename := path.Join(myPathName, name)
		if fileSystem.configuration.ScanFilter.Match(filename) {
			continue
		}
		var stat syscall.Stat_t
		err := syscall.Lstat(path.Join(fileSystem.rootDirectoryName, filename),
			&stat)
		if err != nil {
			if err == syscall.ENOENT {
				continue
			}
			return err, false
		}
		if stat.Dev != fileSystem.dev {
			continue
		}
		if checkScanDisableRequest() {
			return errors.New("DisableScan"), false
		}
		myGC()
		dirent := new(filesystem.DirectoryEntry)
		dirent.Name = name
		dirent.InodeNumber = stat.Ino
		var oldDirent *filesystem.DirectoryEntry
		if oldDirectory != nil {
			index := len(entryList)
			if len(oldDirectory.EntryList) > index &&
				oldDirectory.EntryList[index].Name == name {
				oldDirent = oldDirectory.EntryList[index]
			}
		}
		if stat.Mode&syscall.S_IFMT == syscall.S_IFDIR {
			err = addDirectory(dirent, oldDirent, fileSystem, oldFS, myPathName,
				&stat)
		} else if stat.Mode&syscall.S_IFMT == syscall.S_IFREG {
			err = addRegularFile(dirent, fileSystem, oldFS, myPathName, &stat)
		} else if stat.Mode&syscall.S_IFMT == syscall.S_IFLNK {
			err = addSymlink(dirent, fileSystem, oldFS, myPathName, &stat)
		} else if stat.Mode&syscall.S_IFMT == syscall.S_IFSOCK {
			continue
		} else {
			err = addSpecialFile(dirent, fileSystem, oldFS, &stat)
		}
		if err != nil {
			if err == syscall.ENOENT {
				continue
			}
			return err, false
		}
		if oldDirent != nil && *dirent == *oldDirent {
			dirent = oldDirent
			copiedDirents++
		}
		entryList = append(entryList, dirent)
	}
	if oldDirectory != nil && len(entryList) == copiedDirents &&
		len(entryList) == len(oldDirectory.EntryList) {
		directory.EntryList = oldDirectory.EntryList
		return nil, true
	} else {
		directory.EntryList = entryList
		return nil, false
	}
}
开发者ID:datatonic,项目名称:Dominator,代码行数:82,代码来源:walk.go


注:本文中的github.com/Symantec/Dominator/lib/filesystem.DirectoryInode.EntryList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。