Пример #1
0
func scanSymlink(symlink *filesystem.Symlink, fileSystem *FileSystem,
	parentName string) error {
	myPathName := path.Join(parentName, symlink.Name)
	target, err := os.Readlink(path.Join(fileSystem.rootDirectoryName,
		myPathName))
	if err != nil {
		return err
	}
	symlink.Inode().Symlink = target
	return nil
}
Пример #2
0
func compareSymlink(request *subproto.UpdateRequest, state *state,
	subEntry interface{}, requiredSymlink *filesystem.Symlink,
	parentName string) {
	debugFilename := path.Join(parentName, requiredSymlink.Name)
	if subSymlink, ok := subEntry.(*filesystem.Symlink); ok {
		if requiredInode, ok :=
			state.subInodeToRequiredInode[subSymlink.InodeNumber]; ok {
			if requiredInode != requiredSymlink.InodeNumber {
				fmt.Printf("Different links: %s...\n", debugFilename) // HACK
			}
		} else {
			state.subInodeToRequiredInode[subSymlink.InodeNumber] =
				requiredSymlink.InodeNumber
		}
		if filesystem.CompareSymlinkInodes(subSymlink.Inode(),
			requiredSymlink.Inode(), os.Stdout) {
			return
		}
		fmt.Printf("Different symlink: %s...\n", debugFilename) // HACK
	} else {
		fmt.Printf("Add symlink: %s...\n", debugFilename) // HACK
	}
	// TODO(rgooch): Delete entry and replace.
}