Skip to content

Commit

Permalink
*: add go-proto package
Browse files Browse the repository at this point in the history
This is just a simple "go generate" with a few helpers that I added for
umoci's use because it turns out that it's quite handy to have those
constants and helpers defined.

Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Sep 3, 2018
1 parent 09acece commit d8f70b1
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ This project (in particular the `rootlesscontainers.proto` file and generated
sources) are all licensed under the Apache License 2.0.

```
rootlesscontainers.proto
Copyright (C) 2018 Rootless Containers authors
rootlesscontainers-proto: persistent rootless filesystem emulation
Copyright (C) 2018 Rootless Containers Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
80 changes: 80 additions & 0 deletions go-proto/rootlesscontainers.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go-proto/rootlesscontainers.proto
37 changes: 37 additions & 0 deletions go-proto/rootlesscontainers_generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* rootlesscontainers-proto: persistent rootless filesystem emulation
* Copyright (C) 2018 Rootless Containers Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package rootlesscontainers

// Generate everything for our protobuf.
//go:generate protoc --go_out=import_path=rootlesscontainers:. rootlesscontainers.proto

// Keyname is the official xattr key used to store rootlesscontainers.proto
// blobs, and is the only key we will treat in this special way.
const Keyname = "user.rootlesscontainers"

// NoopID is the uint32 that represents the "noop" id for uid/gid values. It is
// equal to uint32(-1) but since we cannot write that in Go we have to
// explicitly write the wrapped value.
var NoopID uint32 = 0xFFFFFFFF

// IsDefault returns whether the given Resource is the default. If a Resource
// is equal to the default Resource then it is not necesary to include it on
// the filesystem.
func IsDefault(r Resource) bool {
return r.Uid == NoopID && r.Gid == NoopID
}
4 changes: 2 additions & 2 deletions rootlesscontainers.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rootlesscontainers.proto
// Copyright (C) 2018 Rootless Containers authors
// rootlesscontainers-proto: persistent rootless filesystem emulation
// Copyright (C) 2018 Rootless Containers Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down

0 comments on commit d8f70b1

Please sign in to comment.