Zfs fixes

This commit is contained in:
Ben Sarmiento
2023-11-12 02:05:45 +01:00
parent 2657eff11c
commit 0c2cff2387
14 changed files with 79 additions and 1155 deletions

View File

@@ -58,14 +58,14 @@ func (o Object) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
dirs := []fuse.Dirent{}
switch o.objType {
case ROOT:
for _, directory := range o.fs.c.GetDirectories() {
for _, directory := range o.fs.config.GetDirectories() {
dirs = append(dirs, fuse.Dirent{
Name: directory,
Type: fuse.DT_Dir,
})
}
case DIRECTORY:
for el := o.fs.t.TorrentMap.Front(); el != nil; el = el.Next() {
for el := o.fs.tMgr.TorrentMap.Front(); el != nil; el = el.Next() {
torrent := el.Value
if torrent.InProgress {
continue
@@ -76,7 +76,7 @@ func (o Object) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
})
}
case TORRENT:
torrent, _ := o.fs.t.TorrentMap.Get(o.name)
torrent, _ := o.fs.tMgr.TorrentMap.Get(o.name)
if torrent == nil || torrent.InProgress {
return nil, syscall.ENOENT
}
@@ -100,7 +100,7 @@ func (o Object) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
func (o Object) Lookup(ctx context.Context, name string) (fs.Node, error) {
switch o.objType {
case ROOT:
for _, directory := range o.fs.c.GetDirectories() {
for _, directory := range o.fs.config.GetDirectories() {
if directory == name {
return Object{
fs: o.fs,
@@ -112,7 +112,7 @@ func (o Object) Lookup(ctx context.Context, name string) (fs.Node, error) {
}
}
case DIRECTORY:
torrent, _ := o.fs.t.TorrentMap.Get(name)
torrent, _ := o.fs.tMgr.TorrentMap.Get(name)
if torrent == nil {
return nil, syscall.ENOENT
}
@@ -125,7 +125,7 @@ func (o Object) Lookup(ctx context.Context, name string) (fs.Node, error) {
}, nil
case TORRENT:
torrent, _ := o.fs.t.TorrentMap.Get(o.name)
torrent, _ := o.fs.tMgr.TorrentMap.Get(o.name)
if torrent == nil {
return nil, syscall.ENOENT
}
@@ -155,7 +155,7 @@ func (o Object) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Open
// Read reads some bytes or the whole file
func (o Object) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
reader := universal.GetFileReader(o.torrent, o.file, req.Offset, int(req.Size), o.fs.t, o.fs.c, o.fs.log)
reader := universal.GetFileReader(o.torrent, o.file, req.Offset, int(req.Size), o.fs.tMgr, o.fs.config, o.fs.log)
if reader == nil {
return syscall.EIO
}