remove staticInoChan, as it's redundant

This commit is contained in:
Massaki Archambault 2024-08-09 16:17:47 -04:00
parent 3e84321e85
commit 2dc97f1672
2 changed files with 3 additions and 19 deletions

View File

@ -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,
}
}

View File

@ -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
@ -36,7 +32,6 @@ type FSParam struct {
GitForge GitForge
logger *slog.Logger
staticInoChan chan uint64
}
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 {