remove staticInoChan, as it's redundant
This commit is contained in:
parent
3e84321e85
commit
2dc97f1672
|
@ -23,7 +23,7 @@ var _ = (fs.NodeOpener)((*refreshNode)(nil))
|
|||
|
||||
func newRefreshNode(source GroupSource, param *FSParam) *refreshNode {
|
||||
return &refreshNode{
|
||||
ino: <-param.staticInoChan,
|
||||
ino: 0,
|
||||
source: source,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,6 @@ import (
|
|||
"github.com/hanwen/go-fuse/v2/fuse"
|
||||
)
|
||||
|
||||
const (
|
||||
staticInodeStart = uint64(int(^(uint(0))>>1)) + 1
|
||||
)
|
||||
|
||||
type staticNode interface {
|
||||
fs.InodeEmbedder
|
||||
Ino() uint64
|
||||
|
@ -35,8 +31,7 @@ type FSParam struct {
|
|||
GitClient GitClient
|
||||
GitForge GitForge
|
||||
|
||||
logger *slog.Logger
|
||||
staticInoChan chan uint64
|
||||
logger *slog.Logger
|
||||
}
|
||||
|
||||
type rootNode struct {
|
||||
|
@ -54,13 +49,10 @@ func Start(logger *slog.Logger, mountpoint string, mountoptions []string, param
|
|||
opts.Debug = debug
|
||||
|
||||
param.logger = logger
|
||||
param.staticInoChan = make(chan uint64)
|
||||
root := &rootNode{
|
||||
param: param,
|
||||
}
|
||||
|
||||
go staticInoGenerator(root.param.staticInoChan)
|
||||
|
||||
server, err := fs.Mount(mountpoint, root, opts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("mount failed: %v", err)
|
||||
|
@ -88,7 +80,7 @@ func (n *rootNode) OnAdd(ctx context.Context) {
|
|||
ctx,
|
||||
groupNode,
|
||||
fs.StableAttr{
|
||||
Ino: <-n.param.staticInoChan,
|
||||
Ino: 0,
|
||||
Mode: fuse.S_IFDIR,
|
||||
},
|
||||
)
|
||||
|
@ -98,14 +90,6 @@ func (n *rootNode) OnAdd(ctx context.Context) {
|
|||
n.param.logger.Info("Mounted and ready to use")
|
||||
}
|
||||
|
||||
func staticInoGenerator(staticInoChan chan<- uint64) {
|
||||
i := staticInodeStart
|
||||
for {
|
||||
staticInoChan <- i
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
func signalHandler(logger *slog.Logger, signalChan <-chan os.Signal, server *fuse.Server) {
|
||||
err := server.WaitMount()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue