Exemple #1
0
func (fs *MultiZipFs) OpenDir(name string, context *fuse.Context) (stream []fuse.DirEntry, code fuse.Status) {
	fs.lock.RLock()
	defer fs.lock.RUnlock()

	stream = make([]fuse.DirEntry, 0, len(fs.zips)+2)
	if name == "" {
		var d fuse.DirEntry
		d.Name = "config"
		d.Mode = fuse.S_IFDIR | 0700
		stream = append(stream, fuse.DirEntry(d))
	}

	if name == "config" {
		for k := range fs.zips {
			var d fuse.DirEntry
			d.Name = k
			d.Mode = fuse.S_IFLNK
			stream = append(stream, fuse.DirEntry(d))
		}
	}

	return stream, fuse.OK
}
Exemple #2
0
func (me *MultiZipFs) OpenDir(name string) (stream chan fuse.DirEntry, code fuse.Status) {
	me.lock.RLock()
	defer me.lock.RUnlock()

	// We don't use a goroutine, since we don't want to hold the
	// lock.
	stream = make(chan fuse.DirEntry,
		len(me.pendingZips)+len(me.zips)+2)

	submode := uint32(fuse.S_IFDIR | 0700)
	if name == "config" {
		submode = fuse.S_IFREG | 0600
	}

	for k, _ := range me.zips {
		var d fuse.DirEntry
		d.Name = k
		d.Mode = submode
		stream <- fuse.DirEntry(d)
	}
	for k, _ := range me.pendingZips {
		var d fuse.DirEntry
		d.Name = k
		d.Mode = submode
		stream <- fuse.DirEntry(d)
	}

	if name == "" {
		var d fuse.DirEntry
		d.Name = "config"
		d.Mode = fuse.S_IFDIR | 0700
		stream <- fuse.DirEntry(d)
	}

	close(stream)
	return stream, fuse.OK
}
Exemple #3
0
func (me *MultiZipFs) OpenDir(name string, context *fuse.Context) (stream chan fuse.DirEntry, code fuse.Status) {
	me.lock.RLock()
	defer me.lock.RUnlock()

	stream = make(chan fuse.DirEntry, len(me.zips)+2)
	if name == "" {
		var d fuse.DirEntry
		d.Name = "config"
		d.Mode = fuse.S_IFDIR | 0700
		stream <- fuse.DirEntry(d)
	}

	if name == "config" {
		for k, _ := range me.zips {
			var d fuse.DirEntry
			d.Name = k
			d.Mode = fuse.S_IFLNK
			stream <- fuse.DirEntry(d)
		}
	}

	close(stream)
	return stream, fuse.OK
}