diff options
| author | ebiggers <ebiggers@google.com> | 2019-09-08 19:46:59 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey@google.com> | 2019-09-08 19:46:59 -0700 |
| commit | 6445dad7d66fa6a1867090fcd9602c98863649f6 (patch) | |
| tree | c0e5209f018a50ee8b0a1277cc7b06266eff18c1 /filesystem | |
| parent | 28b29d1c97ffd97671186b5e1fae37b64424f9ee (diff) | |
Fix various typos and grammatical errors (#141)
These were found by a combination of manual review and a custom script
that checks for common errors.
Also removed an outdated sentence from the comment for setupBefore().
Diffstat (limited to 'filesystem')
| -rw-r--r-- | filesystem/filesystem.go | 12 | ||||
| -rw-r--r-- | filesystem/mountpoint.go | 18 | ||||
| -rw-r--r-- | filesystem/path.go | 8 |
3 files changed, 19 insertions, 19 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 86c168a..f4f9201 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -1,5 +1,5 @@ /* - * filesystem.go - Contains the a functionality for a specific filesystem. This + * filesystem.go - Contains the functionality for a specific filesystem. This * includes the commands to setup the filesystem, apply policies, and locate * metadata. * @@ -207,9 +207,9 @@ func (m *Mount) makeDirectories() error { return os.Mkdir(m.ProtectorDir(), dirPermissions) } -// Setup sets up the filesystem for use with fscrypt, note that this merely +// Setup sets up the filesystem for use with fscrypt. Note that this merely // creates the appropriate files on the filesystem. It does not actually modify -// the filesystem's feature flags. This operation is atomic, it either succeeds +// the filesystem's feature flags. This operation is atomic; it either succeeds // or no files in the baseDir are created. func (m *Mount) Setup() error { if m.CheckSetup() == nil { @@ -231,7 +231,7 @@ func (m *Mount) Setup() error { } // RemoveAllMetadata removes all the policy and protector metadata from the -// filesystem. This operation is atomic, it either succeeds or no files in the +// filesystem. This operation is atomic; it either succeeds or no files in the // baseDir are removed. // WARNING: Will cause data loss if the metadata is used to encrypt // directories (this could include directories on other filesystems). @@ -274,7 +274,7 @@ func (m *Mount) writeDataAtomic(path string, data []byte) error { } // addMetadata writes the metadata structure to the file with the specified -// path this will overwrite any existing data. The operation is atomic. +// path. This will overwrite any existing data. The operation is atomic. func (m *Mount) addMetadata(path string, md metadata.Metadata) error { if err := md.CheckValidity(); err != nil { return errors.Wrap(ErrInvalidMetadata, err.Error()) @@ -411,7 +411,7 @@ func (m *Mount) GetProtector(descriptor string) (*Mount, *metadata.ProtectorData return nil, nil, m.err(errors.Wrapf(ErrLinkExpired, "protector %s", descriptor)) } -// RemoveProtector deletes the protector metadata (or an link to another +// RemoveProtector deletes the protector metadata (or a link to another // filesystem's metadata) from the filesystem storage. func (m *Mount) RemoveProtector(descriptor string) error { if err := m.CheckSetup(); err != nil { diff --git a/filesystem/mountpoint.go b/filesystem/mountpoint.go index 7ef91ce..abd8232 100644 --- a/filesystem/mountpoint.go +++ b/filesystem/mountpoint.go @@ -94,7 +94,7 @@ func getMountInfo() error { // Skip invalid mountpoints var err error - if mnt.Path, err = cannonicalizePath(mnt.Path); err != nil { + if mnt.Path, err = canonicalizePath(mnt.Path); err != nil { log.Printf("getting mnt_dir: %v", err) continue } @@ -109,7 +109,7 @@ func getMountInfo() error { // filesystems are listed in mount order. mountsByPath[mnt.Path] = &mnt - deviceName, err := cannonicalizePath(C.GoString(entry.mnt_fsname)) + deviceName, err := canonicalizePath(C.GoString(entry.mnt_fsname)) // Only use real valid devices (unlike cgroups, tmpfs, ...) if err == nil && isDevice(deviceName) { mnt.Device = deviceName @@ -152,7 +152,7 @@ func UpdateMountInfo() error { // been updated since the last call to one of the mount functions, run // UpdateMountInfo to see changes. func FindMount(path string) (*Mount, error) { - path, err := cannonicalizePath(path) + path, err := canonicalizePath(path) if err != nil { return nil, err } @@ -183,7 +183,7 @@ func FindMount(path string) (*Mount, error) { // a filesystem has been updated since the last call to one of the mount // functions, run UpdateMountInfo to see changes. func GetMount(mountpoint string) (*Mount, error) { - mountpoint, err := cannonicalizePath(mountpoint) + mountpoint, err := canonicalizePath(mountpoint) if err != nil { return nil, err } @@ -202,8 +202,8 @@ func GetMount(mountpoint string) (*Mount, error) { } // getMountsFromLink returns the Mount objects which match the provided link. -// This link if formatted as a tag (e.g. <token>=<value>) similar to how they -// apprear in "/etc/fstab". Currently, only "UUID" tokens are supported. Note +// This link is formatted as a tag (e.g. <token>=<value>) similar to how they +// appear in "/etc/fstab". Currently, only "UUID" tokens are supported. Note // that this can match multiple Mounts (due to the existence of bind mounts). An // error is returned if the link is invalid or we cannot load the required mount // data. If a filesystem has been updated since the last call to one of the @@ -212,7 +212,7 @@ func getMountsFromLink(link string) ([]*Mount, error) { // Parse the link linkComponents := strings.Split(link, "=") if len(linkComponents) != 2 { - return nil, errors.Wrapf(ErrFollowLink, "link %q format in invalid", link) + return nil, errors.Wrapf(ErrFollowLink, "link %q format is invalid", link) } token := linkComponents[0] value := linkComponents[1] @@ -225,7 +225,7 @@ func getMountsFromLink(link string) ([]*Mount, error) { if filepath.Base(searchPath) != value { return nil, errors.Wrapf(ErrFollowLink, "value %q is not a UUID", value) } - devicePath, err := cannonicalizePath(searchPath) + devicePath, err := canonicalizePath(searchPath) if err != nil { return nil, errors.Wrapf(ErrFollowLink, "no device with UUID %q", value) } @@ -263,7 +263,7 @@ func makeLink(mnt *Mount, token string) (string, error) { continue // Only interested in UUID symlinks } uuid := fileInfo.Name() - devicePath, err := cannonicalizePath(filepath.Join(uuidDirectory, uuid)) + devicePath, err := canonicalizePath(filepath.Join(uuidDirectory, uuid)) if err != nil { log.Print(err) continue diff --git a/filesystem/path.go b/filesystem/path.go index d788a6b..5fd3fdf 100644 --- a/filesystem/path.go +++ b/filesystem/path.go @@ -30,8 +30,8 @@ import ( // We only check the unix permissions and the sticky bit const permMask = os.ModeSticky | os.ModePerm -// cannonicalizePath turns path into an absolute path without symlinks. -func cannonicalizePath(path string) (string, error) { +// canonicalizePath turns path into an absolute path without symlinks. +func canonicalizePath(path string) (string, error) { path, err := filepath.Abs(path) if err != nil { return "", err @@ -62,14 +62,14 @@ func isDir(path string) bool { return err == nil && info.IsDir() } -// isDevice returns true if the path exists and is that of a directory. +// isDevice returns true if the path exists and is that of a device. func isDevice(path string) bool { info, err := loggedStat(path) return err == nil && info.Mode()&os.ModeDevice != 0 } // isDirCheckPerm returns true if the path exists and is a directory. If the -// specified permissions and sticky bit of mode do not match the path, and error +// specified permissions and sticky bit of mode do not match the path, an error // is logged. func isDirCheckPerm(path string, mode os.FileMode) bool { info, err := loggedStat(path) |