Beispiel #1
0
func (s *MountState) setSplice() {
	s.canSplice = true
	maxW := splice.MaxPipeSize() - 4096
	if !splice.Resizable() && s.opts.MaxWrite > maxW {
		s.opts.MaxWrite = maxW
	}
}
Beispiel #2
0
func doInit(state *MountState, req *request) {
	const (
		FUSE_KERNEL_VERSION   = 7
		MINIMUM_MINOR_VERSION = 13
		OUR_MINOR_VERSION     = 16
	)

	input := (*raw.InitIn)(req.inData)
	if input.Major != FUSE_KERNEL_VERSION {
		log.Printf("Major versions does not match. Given %d, want %d\n", input.Major, FUSE_KERNEL_VERSION)
		req.status = EIO
		return
	}
	if input.Minor < MINIMUM_MINOR_VERSION {
		log.Printf("Minor version is less than we support. Given %d, want at least %d\n", input.Minor, MINIMUM_MINOR_VERSION)
		req.status = EIO
		return
	}

	state.reqMu.Lock()
	state.kernelSettings = *input
	state.kernelSettings.Flags = input.Flags & (raw.CAP_ASYNC_READ | raw.CAP_BIG_WRITES | raw.CAP_FILE_OPS)
	if input.Minor >= 13 {
		state.canSplice = true
		maxW := splice.MaxPipeSize() - 4096
		if !splice.Resizable() && state.opts.MaxWrite > maxW {
			state.opts.MaxWrite = maxW
		}
	}
	state.reqMu.Unlock()

	out := &raw.InitOut{
		Major:               FUSE_KERNEL_VERSION,
		Minor:               OUR_MINOR_VERSION,
		MaxReadAhead:        input.MaxReadAhead,
		Flags:               state.kernelSettings.Flags,
		MaxWrite:            uint32(state.opts.MaxWrite),
		CongestionThreshold: uint16(state.opts.MaxBackground * 3 / 4),
		MaxBackground:       uint16(state.opts.MaxBackground),
	}
	if out.Minor > input.Minor {
		out.Minor = input.Minor
	}

	req.outData = unsafe.Pointer(out)
	req.status = OK
}
Beispiel #3
0
func (s *MountState) setSplice() {
	s.canSplice = splice.Resizable()
}
func (s *Server) setSplice() {
	s.canSplice = splice.Resizable()
}