do not expose unexported objectid type to the user

This commit is contained in:
Denys Smirnov 2019-05-17 20:57:02 +03:00
parent a46fd0364e
commit d917b30ff0
2 changed files with 9 additions and 9 deletions

10
send.go
View File

@ -77,7 +77,7 @@ func Send(w io.Writer, parent string, subvols ...string) error {
if err != nil {
return fmt.Errorf("cannot find subvolume %s: %v", rel, err)
}
rootID = si.RootID
rootID = objectID(si.RootID)
parentID, err = findGoodParent(mfs.f, rootID, cloneSrc)
if err != nil {
return fmt.Errorf("cannot find good parent for %v: %v", rel, err)
@ -205,8 +205,8 @@ func findGoodParent(mnt *os.File, rootID objectID, cloneSrc []objectID) (objectI
return 0, fmt.Errorf("get parent failed: %v", err)
}
for _, id := range cloneSrc {
if id == parent.RootID {
return parent.RootID, nil
if id == objectID(parent.RootID) {
return objectID(parent.RootID), nil
}
}
var (
@ -236,10 +236,10 @@ func findGoodParent(mnt *os.File, rootID objectID, cloneSrc []objectID) (objectI
}
}
if bestParent != nil {
return bestParent.RootID, nil
return objectID(bestParent.RootID), nil
}
if !parent.ParentUUID.IsZero() {
return findGoodParent(mnt, parent.RootID, cloneSrc)
return findGoodParent(mnt, objectID(parent.RootID), cloneSrc)
}
return 0, ErrNotFound
}

View File

@ -204,7 +204,7 @@ func listSubVolumes(f *os.File, filter func(SubvolInfo) bool) (map[objectID]Subv
// m[obj.ObjectID] = o
case rootItemKey:
o := m[obj.ObjectID]
o.RootID = obj.ObjectID
o.RootID = uint64(obj.ObjectID)
robj := asRootItem(obj.Data).Decode()
o.fillFromItem(&robj)
m[obj.ObjectID] = o
@ -251,7 +251,7 @@ func listSubVolumes(f *os.File, filter func(SubvolInfo) bool) (map[objectID]Subv
}
type SubvolInfo struct {
RootID objectID
RootID uint64
UUID UUID
ParentUUID UUID
@ -368,12 +368,12 @@ func subvolSearchByRootID(mnt *os.File, rootID objectID, path string) (*SubvolIn
return nil, err
}
info := &SubvolInfo{
RootID: rootID,
RootID: uint64(rootID),
Path: path,
}
info.fillFromItem(robj)
if path == "" {
info.Path, err = subvolidResolve(mnt, info.RootID)
info.Path, err = subvolidResolve(mnt, objectID(info.RootID))
}
return info, err
}