Skip to content

Commit 8240462

Browse files
committed
9p: file table - simplify offset arithmetic
1 parent de7fafd commit 8240462

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/filesystem/9p/table.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@ func (ft *fileTableSync) to9Ents(offset uint64, count uint32) (p9.Dirents, error
8181
names, files = ft.flatten(offset, count)
8282
ents = make(p9.Dirents, len(names))
8383
)
84-
84+
offset++
8585
for i, name := range names {
8686
q, _, _, err := files[i].GetAttr(p9.AttrMask{})
8787
if err != nil {
8888
return nil, err
8989
}
9090
ents[i] = p9.Dirent{
9191
QID: q,
92-
Offset: offset + uint64(i) + 1,
92+
Offset: offset,
9393
Type: q.Type,
9494
Name: name,
9595
}
96+
offset++
9697
}
9798
return ents, nil
9899
}

0 commit comments

Comments
 (0)