|
@ -36,21 +36,21 @@ func NewUidGidMapper(uidPairsStr, gidPairStr string) (*UidGidMapper, error) { |
|
|
}, nil |
|
|
}, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (m *UidGidMapper) LocalToFiler(uid, gid uint32) (uint32,uint32) { |
|
|
|
|
|
|
|
|
func (m *UidGidMapper) LocalToFiler(uid, gid uint32) (uint32, uint32) { |
|
|
return m.uidMapper.LocalToFiler(uid), m.gidMapper.LocalToFiler(gid) |
|
|
return m.uidMapper.LocalToFiler(uid), m.gidMapper.LocalToFiler(gid) |
|
|
} |
|
|
} |
|
|
func (m *UidGidMapper) FilerToLocal(uid, gid uint32) (uint32,uint32) { |
|
|
|
|
|
|
|
|
func (m *UidGidMapper) FilerToLocal(uid, gid uint32) (uint32, uint32) { |
|
|
return m.uidMapper.FilerToLocal(uid), m.gidMapper.FilerToLocal(gid) |
|
|
return m.uidMapper.FilerToLocal(uid), m.gidMapper.FilerToLocal(gid) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (m *IdMapper) LocalToFiler(id uint32) (uint32) { |
|
|
|
|
|
|
|
|
func (m *IdMapper) LocalToFiler(id uint32) uint32 { |
|
|
value, found := m.localToFiler[id] |
|
|
value, found := m.localToFiler[id] |
|
|
if found { |
|
|
if found { |
|
|
return value |
|
|
return value |
|
|
} |
|
|
} |
|
|
return id |
|
|
return id |
|
|
} |
|
|
} |
|
|
func (m *IdMapper) FilerToLocal(id uint32) (uint32) { |
|
|
|
|
|
|
|
|
func (m *IdMapper) FilerToLocal(id uint32) uint32 { |
|
|
value, found := m.filerToLocal[id] |
|
|
value, found := m.filerToLocal[id] |
|
|
if found { |
|
|
if found { |
|
|
return value |
|
|
return value |
|
@ -85,7 +85,7 @@ func parseUint32Pairs(pairsStr string) (localToFiler, filerToLocal map[uint32]ui |
|
|
localUidStr, filerUidStr := pair[0], pair[1] |
|
|
localUidStr, filerUidStr := pair[0], pair[1] |
|
|
localUid, localUidErr := strconv.Atoi(localUidStr) |
|
|
localUid, localUidErr := strconv.Atoi(localUidStr) |
|
|
if localUidErr != nil { |
|
|
if localUidErr != nil { |
|
|
err = fmt.Errorf("failed to parse local %d: %v", localUidStr, localUidErr) |
|
|
|
|
|
|
|
|
err = fmt.Errorf("failed to parse local %s: %v", localUidStr, localUidErr) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
filerUid, filerUidErr := strconv.Atoi(filerUidStr) |
|
|
filerUid, filerUidErr := strconv.Atoi(filerUidStr) |
|
|