switch.go 282 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package fadvise

import (
	"os"

	"linkfog.com/public/option"
)

// 可以实现通过option.Fadvise开关控制所有fadvise的启停
func Switch(f *os.File) (err error) {
	if option.Fadvise {
		if err = Fadvise(f); err != nil {
			return err
		}
	}
	return nil
}