*: 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/erofs/compression.go b/metropolis/pkg/erofs/compression.go
index 58b2f4b..dca9946 100644
--- a/metropolis/pkg/erofs/compression.go
+++ b/metropolis/pkg/erofs/compression.go
@@ -21,8 +21,8 @@
 
 import "encoding/binary"
 
-// mapHeader is a legacy but still-used advisory structure at the start of a compressed VLE block. It contains constant
-// values as annotated.
+// mapHeader is a legacy but still-used advisory structure at the start of a
+// compressed VLE block. It contains constant values as annotated.
 type mapHeader struct {
 	Reserved      uint32 // 0
 	Advise        uint16 // 1
diff --git a/metropolis/pkg/erofs/defs.go b/metropolis/pkg/erofs/defs.go
index b547867..85898bf 100644
--- a/metropolis/pkg/erofs/defs.go
+++ b/metropolis/pkg/erofs/defs.go
@@ -16,11 +16,13 @@
 
 package erofs
 
-// This file contains definitions coming from the in-Kernel implementation of the EROFS filesystem.
-// All definitions come from @linux//fs/erofs:erofs_fs.h unless stated otherwise.
+// This file contains definitions coming from the in-Kernel implementation of
+// the EROFS filesystem.  All definitions come from @linux//fs/erofs:erofs_fs.h
+// unless stated otherwise.
 
-// Magic contains the 4 magic bytes starting at position 1024 identifying an EROFS filesystem.
-// Defined in @linux//include/uapi/linux/magic.h EROFS_SUPER_MAGIC_V1
+// Magic contains the 4 magic bytes starting at position 1024 identifying an
+// EROFS filesystem.  Defined in @linux//include/uapi/linux/magic.h
+// EROFS_SUPER_MAGIC_V1
 var Magic = [4]byte{0xe2, 0xe1, 0xf5, 0xe0}
 
 const blockSizeBits = 12
diff --git a/metropolis/pkg/erofs/defs_test.go b/metropolis/pkg/erofs/defs_test.go
index e32e155..1d31bff 100644
--- a/metropolis/pkg/erofs/defs_test.go
+++ b/metropolis/pkg/erofs/defs_test.go
@@ -24,8 +24,8 @@
 	"github.com/stretchr/testify/assert"
 )
 
-// These test that the specified structures serialize to the same number of bytes as the ones in the
-// EROFS kernel module.
+// These test that the specified structures serialize to the same number of
+// bytes as the ones in the EROFS kernel module.
 
 func TestSuperblockSize(t *testing.T) {
 	var buf bytes.Buffer
diff --git a/metropolis/pkg/erofs/erofs.go b/metropolis/pkg/erofs/erofs.go
index af6ad1c..3e4ce89 100644
--- a/metropolis/pkg/erofs/erofs.go
+++ b/metropolis/pkg/erofs/erofs.go
@@ -29,19 +29,22 @@
 // Writer writes a new EROFS filesystem.
 type Writer struct {
 	w io.WriteSeeker
-	// fixDirectoryEntry contains for each referenced path where it is referenced from. Since self-references
-	// are required anyways (for the "." and ".." entries) we let the user write files in any order and just
-	// point the directory entries to the right target nid and file type on Close().
+	// fixDirectoryEntry contains for each referenced path where it is
+	// referenced from. Since self-references are required anyways (for the "."
+	// and ".." entries) we let the user write files in any order and just
+	// point the directory entries to the right target nid and file type on
+	// Close().
 	fixDirectoryEntry map[string][]direntFixupLocation
 	pathInodeMeta     map[string]*uncompressedInodeMeta
-	// legacyInodeIndex stores the next legacy (32-bit) inode to be allocated. 64 bit inodes are automatically
-	// calculated by EROFS on mount.
+	// legacyInodeIndex stores the next legacy (32-bit) inode to be allocated.
+	// 64 bit inodes are automatically calculated by EROFS on mount.
 	legacyInodeIndex    uint32
 	blockAllocatorIndex uint32
 	metadataBlocksFree  metadataBlocksMeta
 }
 
-// NewWriter creates a new EROFS filesystem writer. The given WriteSeeker needs to be at the start.
+// NewWriter creates a new EROFS filesystem writer. The given WriteSeeker needs
+// to be at the start.
 func NewWriter(w io.WriteSeeker) (*Writer, error) {
 	erofsWriter := &Writer{
 		w:                 w,
@@ -56,17 +59,20 @@
 		return nil, fmt.Errorf("failed to write initial padding: %w", err)
 	}
 	if err := binary.Write(erofsWriter.w, binary.LittleEndian, &superblock{
-		Magic:          Magic,
-		BlockSizeBits:  blockSizeBits,
-		RootNodeNumber: 36, // 1024 (padding) + 128 (superblock) / 32, not eligible for fixup as different int size
+		Magic:         Magic,
+		BlockSizeBits: blockSizeBits,
+		// 1024 (padding) + 128 (superblock) / 32, not eligible for fixup as
+		// different int size
+		RootNodeNumber: 36,
 	}); err != nil {
 		return nil, fmt.Errorf("failed to write superblock: %w", err)
 	}
 	return erofsWriter, nil
 }
 
-// allocateMetadata allocates metadata space of size bytes with a given alignment and seeks to the first byte of the
-// newly-allocated metadata space. It also returns the position of that first byte.
+// allocateMetadata allocates metadata space of size bytes with a given
+// alignment and seeks to the first byte of the newly-allocated metadata space.
+// It also returns the position of that first byte.
 func (w *Writer) allocateMetadata(size int, alignment uint16) (int64, error) {
 	if size > BlockSize {
 		panic("cannot allocate a metadata object bigger than BlockSize bytes")
@@ -90,9 +96,10 @@
 	return pos, nil
 }
 
-// allocateBlocks allocates n new BlockSize-sized block and seeks to the beginning of the first newly-allocated block.
-// It also returns the first newly-allocated block number.  The caller is expected to write these blocks completely
-// before calling allocateBlocks again.
+// allocateBlocks allocates n new BlockSize-sized block and seeks to the
+// beginning of the first newly-allocated block.  It also returns the first
+// newly-allocated block number.  The caller is expected to write these blocks
+// completely before calling allocateBlocks again.
 func (w *Writer) allocateBlocks(n uint32) (uint32, error) {
 	if _, err := w.w.Seek(int64(w.blockAllocatorIndex)*BlockSize, io.SeekStart); err != nil {
 		return 0, fmt.Errorf("cannot seek to end of last block, check write alignment: %w", err)
@@ -113,18 +120,20 @@
 	return i
 }
 
-// CreateFile adds a new file to the EROFS. It returns a WriteCloser to which the file contents should be written and
-// which then needs to be closed. The last writer obtained by calling CreateFile() needs to be closed first before
-// opening a new one. The given pathname needs to be referenced by a directory created using Create(), otherwise it will
-// not be accessible.
+// CreateFile adds a new file to the EROFS. It returns a WriteCloser to which
+// the file contents should be written and which then needs to be closed. The
+// last writer obtained by calling CreateFile() needs to be closed first before
+// opening a new one. The given pathname needs to be referenced by a directory
+// created using Create(), otherwise it will not be accessible.
 func (w *Writer) CreateFile(pathname string, meta *FileMeta) io.WriteCloser {
 	return w.create(pathname, meta)
 }
 
-// Create adds a new non-file inode to the EROFS. This includes directories, device nodes, symlinks and FIFOs.
-// The first call to Create() needs to be with pathname "." and a directory inode.
-// The given pathname needs to be referenced by a directory, otherwise it will not be accessible (with the exception of
-// the directory ".").
+// Create adds a new non-file inode to the EROFS. This includes directories,
+// device nodes, symlinks and FIFOs.  The first call to Create() needs to be
+// with pathname "." and a directory inode.  The given pathname needs to be
+// referenced by a directory, otherwise it will not be accessible (with the
+// exception of the directory ".").
 func (w *Writer) Create(pathname string, inode Inode) error {
 	iw := w.create(pathname, inode)
 	switch i := inode.(type) {
@@ -140,8 +149,9 @@
 	return iw.Close()
 }
 
-// Close finishes writing an EROFS filesystem. Errors by this function need to be handled as they indicate if the
-// written filesystem is consistent (i.e. there are no directory entries pointing to nonexistent inodes).
+// Close finishes writing an EROFS filesystem. Errors by this function need to
+// be handled as they indicate if the written filesystem is consistent (i.e.
+// there are no directory entries pointing to nonexistent inodes).
 func (w *Writer) Close() error {
 	for targetPath, entries := range w.fixDirectoryEntry {
 		for _, entry := range entries {
@@ -157,8 +167,9 @@
 	return nil
 }
 
-// uncompressedInodeMeta tracks enough metadata about a written inode to be able to point dirents to it and to provide
-// a WriteSeeker into the inode itself.
+// uncompressedInodeMeta tracks enough metadata about a written inode to be
+// able to point dirents to it and to provide a WriteSeeker into the inode
+// itself.
 type uncompressedInodeMeta struct {
 	nid   uint64
 	ftype uint8
@@ -188,8 +199,9 @@
 
 func (a *uncompressedInodeMeta) Write(p []byte) (int, error) {
 	if a.currentOffset < a.blockLength {
-		// TODO(lorenz): Handle the special case where a directory inode is spread across multiple
-		// blocks (depending on other factors this occurs around ~200 direct children).
+		// TODO(lorenz): Handle the special case where a directory inode is
+		// spread across multiple blocks (depending on other factors this
+		// occurs around ~200 direct children).
 		return 0, errors.New("relocating dirents in multi-block directory inodes is unimplemented")
 	}
 	if _, err := a.writer.w.Seek(a.inlineStart+a.currentOffset, io.SeekStart); err != nil {
@@ -204,8 +216,9 @@
 	entryIndex uint16
 }
 
-// direntFixup overrides nid and file type from the path the dirent is pointing to. The given iw is expected to be at
-// the start of the dirent inode to be fixed up.
+// direntFixup overrides nid and file type from the path the dirent is pointing
+// to. The given iw is expected to be at the start of the dirent inode to be
+// fixed up.
 func direntFixup(iw io.WriteSeeker, entryIndex int64, meta *uncompressedInodeMeta) error {
 	if _, err := iw.Seek(entryIndex*12, io.SeekStart); err != nil {
 		return fmt.Errorf("failed to seek to dirent: %w", err)
@@ -227,12 +240,14 @@
 	freeBytes   uint16
 }
 
-// metadataBlocksMeta contains metadata about all metadata blocks, most importantly the amount of free
-// bytes in each block. This is not a map for reproducibility (map ordering).
+// metadataBlocksMeta contains metadata about all metadata blocks, most
+// importantly the amount of free bytes in each block. This is not a map for
+// reproducibility (map ordering).
 type metadataBlocksMeta []metadataBlockMeta
 
-// findBlock returns the absolute position where `size` bytes with the specified alignment can still fit.
-// If there is not enough space in any metadata block it returns false as the second return value.
+// findBlock returns the absolute position where `size` bytes with the
+// specified alignment can still fit.  If there is not enough space in any
+// metadata block it returns false as the second return value.
 func (m metadataBlocksMeta) findBlock(size uint16, alignment uint16) (int64, bool) {
 	for i, blockMeta := range m {
 		freeBytesAligned := blockMeta.freeBytes - (blockMeta.freeBytes % alignment)
diff --git a/metropolis/pkg/erofs/inode_types.go b/metropolis/pkg/erofs/inode_types.go
index 05b0f54..bac29c5 100644
--- a/metropolis/pkg/erofs/inode_types.go
+++ b/metropolis/pkg/erofs/inode_types.go
@@ -28,12 +28,14 @@
 	"golang.org/x/sys/unix"
 )
 
-// Inode specifies an interface that all inodes that can be written to an EROFS filesystem implement.
+// Inode specifies an interface that all inodes that can be written to an EROFS
+// filesystem implement.
 type Inode interface {
 	inode() *inodeCompact
 }
 
-// Base contains generic inode metadata independent from the specific inode type.
+// Base contains generic inode metadata independent from the specific inode
+// type.
 type Base struct {
 	Permissions uint16
 	UID, GID    uint16
@@ -47,8 +49,8 @@
 	}
 }
 
-// Directory represents a directory inode. The Children property contains the directories' direct children (just the
-// name, not the full path).
+// Directory represents a directory inode. The Children property contains the
+// directories' direct children (just the name, not the full path).
 type Directory struct {
 	Base
 	Children []string
@@ -59,7 +61,8 @@
 }
 
 func (d *Directory) writeTo(w *uncompressedInodeWriter) error {
-	// children is d.Children with appended backrefs (. and ..), copied to not pollute source
+	// children is d.Children with appended backrefs (. and ..), copied to not
+	// pollute source
 	children := make([]string, len(d.Children))
 	copy(children, d.Children)
 	children = append(children, ".", "..")
@@ -97,7 +100,8 @@
 	return nil
 }
 
-// CharacterDevice represents a Unix character device inode with major and minor numbers.
+// CharacterDevice represents a Unix character device inode with major and
+// minor numbers.
 type CharacterDevice struct {
 	Base
 	Major uint32
@@ -110,7 +114,8 @@
 	return i
 }
 
-// CharacterDevice represents a Unix block device inode with major and minor numbers.
+// CharacterDevice represents a Unix block device inode with major and minor
+// numbers.
 type BlockDevice struct {
 	Base
 	Major uint32
@@ -141,7 +146,8 @@
 	return s.baseInode(unix.S_IFSOCK)
 }
 
-// SymbolicLink represents a symbolic link/symlink to another inode. Target is the literal string target of the symlink.
+// SymbolicLink represents a symbolic link/symlink to another inode. Target is
+// the literal string target of the symlink.
 type SymbolicLink struct {
 	Base
 	Target string
@@ -156,8 +162,9 @@
 	return err
 }
 
-// FileMeta represents the metadata of a regular file. In this case the contents are written to a Writer returned by the
-// CreateFile function on the EROFS Writer and not included in the structure itself.
+// FileMeta represents the metadata of a regular file. In this case the
+// contents are written to a Writer returned by the CreateFile function on the
+// EROFS Writer and not included in the structure itself.
 type FileMeta struct {
 	Base
 }
diff --git a/metropolis/pkg/erofs/uncompressed_inode_writer.go b/metropolis/pkg/erofs/uncompressed_inode_writer.go
index df89fec..97aefc0 100644
--- a/metropolis/pkg/erofs/uncompressed_inode_writer.go
+++ b/metropolis/pkg/erofs/uncompressed_inode_writer.go
@@ -24,9 +24,10 @@
 	"math"
 )
 
-// uncompressedInodeWriter exposes a io.Write-style interface for a single uncompressed inode. It splits the Write-calls
-// into blocks and writes both the blocks and inode metadata. It is required to call Close() to ensure everything is
-// properly written down before writing another inode.
+// uncompressedInodeWriter exposes a io.Write-style interface for a single
+// uncompressed inode. It splits the Write-calls into blocks and writes both
+// the blocks and inode metadata. It is required to call Close() to ensure
+// everything is properly written down before writing another inode.
 type uncompressedInodeWriter struct {
 	buf               bytes.Buffer
 	writer            *Writer