*: reflow comments to 80 characters
This reformats the entire Metropolis codebase to have comments no longer
than 80 characters, implementing CR/66.
This has been done half manually, as we don't have a good integration
between commentwrap/Bazel, but that can be implemented if we decide to
go for this tool/limit.
Change-Id: If1fff0b093ef806f5dc00551c11506e8290379d0
diff --git a/metropolis/pkg/fsquota/fsquota.go b/metropolis/pkg/fsquota/fsquota.go
index 3c0c578..263dd48 100644
--- a/metropolis/pkg/fsquota/fsquota.go
+++ b/metropolis/pkg/fsquota/fsquota.go
@@ -14,11 +14,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package fsquota provides a simplified interface to interact with Linux's filesystem qouta API.
-// It only supports setting quotas on directories, not groups or users.
-// Quotas need to be already enabled on the filesystem to be able to use them using this package.
-// See the quotactl package if you intend to use this on a filesystem where quotas need to be
-// enabled manually.
+// Package fsquota provides a simplified interface to interact with Linux's
+// filesystem qouta API. It only supports setting quotas on directories, not
+// groups or users. Quotas need to be already enabled on the filesystem to be
+// able to use them using this package. See the quotactl package if you intend
+// to use this on a filesystem where quotas need to be enabled manually.
package fsquota
import (
@@ -32,10 +32,11 @@
"source.monogon.dev/metropolis/pkg/fsquota/quotactl"
)
-// SetQuota sets the quota of bytes and/or inodes in a given path. To not set a limit, set the
-// corresponding argument to zero. Setting both arguments to zero removes the quota entirely.
-// This function can only be called on an empty directory. It can't be used to create a quota
-// below a directory which already has a quota since Linux doesn't offer hierarchical quotas.
+// SetQuota sets the quota of bytes and/or inodes in a given path. To not set a
+// limit, set the corresponding argument to zero. Setting both arguments to
+// zero removes the quota entirely. This function can only be called on an
+// empty directory. It can't be used to create a quota below a directory which
+// already has a quota since Linux doesn't offer hierarchical quotas.
func SetQuota(path string, maxBytes uint64, maxInodes uint64) error {
dir, err := os.Open(path)
if err != nil {
@@ -61,10 +62,12 @@
var lastID uint32 = attrs.ProjectID
if lastID == 0 {
- // No project/quota exists for this directory, assign a new project quota
- // TODO(lorenz): This is racy, but the kernel does not support atomically assigning
- // quotas. So this needs to be added to the kernels setquota interface. Due to the short
- // time window and infrequent calls this should not be an immediate issue.
+ // No project/quota exists for this directory, assign a new project
+ // quota.
+ // TODO(lorenz): This is racy, but the kernel does not support
+ // atomically assigning quotas. So this needs to be added to the
+ // kernels setquota interface. Due to the short time window and
+ // infrequent calls this should not be an immediate issue.
for {
quota, err := quotactl.GetNextQuota(source, quotactl.QuotaTypeProject, lastID)
if err == unix.ENOENT || err == unix.ESRCH {
@@ -115,7 +118,8 @@
InodesUsed uint64
}
-// GetQuota returns the current active quota and its utilization at the given path
+// GetQuota returns the current active quota and its utilization at the given
+// path
func GetQuota(path string) (*Quota, error) {
dir, err := os.Open(path)
if err != nil {