aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-10-29 00:04:39 -0700
committerEric Biggers <ebiggers@google.com>2019-10-29 00:04:39 -0700
commit249259376da98d8e10e6876c80ff3905e9756bdc (patch)
treea0bd6a5f79e04f369d2e6a4732d10d5a191826dd
parenta3434e41bd482fc1b35703f66c24c9d1ec3b0be2 (diff)
filesystem: rename Mount.Filesystem to Mount.FilesystemType
Make it clear that this refers to a type of filesystem such as "ext4", rather than to a specific filesystem instance.
-rw-r--r--actions/context.go8
-rw-r--r--cmd/fscrypt/status.go9
-rw-r--r--filesystem/filesystem.go22
-rw-r--r--filesystem/mountpoint.go6
4 files changed, 23 insertions, 22 deletions
diff --git a/actions/context.go b/actions/context.go
index 4a8542b..830ad03 100644
--- a/actions/context.go
+++ b/actions/context.go
@@ -78,7 +78,7 @@ func NewContextFromPath(path string, target *user.User) (*Context, error) {
}
log.Printf("%s is on %s filesystem %q (%s)", path,
- ctx.Mount.Filesystem, ctx.Mount.Path, ctx.Mount.Device)
+ ctx.Mount.FilesystemType, ctx.Mount.Path, ctx.Mount.Device)
return ctx, nil
}
@@ -95,7 +95,7 @@ func NewContextFromMountpoint(mountpoint string, target *user.User) (*Context, e
return nil, err
}
- log.Printf("found %s filesystem %q (%s)", ctx.Mount.Filesystem,
+ log.Printf("found %s filesystem %q (%s)", ctx.Mount.FilesystemType,
ctx.Mount.Path, ctx.Mount.Device)
return ctx, nil
}
@@ -137,9 +137,9 @@ func (ctx *Context) checkContext() error {
func (ctx *Context) getService() string {
// For legacy configurations, we may need non-standard services
if ctx.Config.HasCompatibilityOption(LegacyConfig) {
- switch ctx.Mount.Filesystem {
+ switch ctx.Mount.FilesystemType {
case "ext4", "f2fs":
- return ctx.Mount.Filesystem + ":"
+ return ctx.Mount.FilesystemType + ":"
}
}
return unix.FS_KEY_DESC_PREFIX
diff --git a/cmd/fscrypt/status.go b/cmd/fscrypt/status.go
index 9959b54..375899b 100644
--- a/cmd/fscrypt/status.go
+++ b/cmd/fscrypt/status.go
@@ -91,8 +91,8 @@ func writeGlobalStatus(w io.Writer) error {
continue
}
- fmt.Fprintf(t, "%s\t%s\t%s\t%s\t%s\n", mount.Path, mount.Device, mount.Filesystem,
- supportString, yesNoString(usingFscrypt))
+ fmt.Fprintf(t, "%s\t%s\t%s\t%s\t%s\n", mount.Path, mount.Device,
+ mount.FilesystemType, supportString, yesNoString(usingFscrypt))
if supportErr == nil {
supportCount++
@@ -139,8 +139,9 @@ func writeFilesystemStatus(w io.Writer, ctx *actions.Context) error {
return err
}
- fmt.Fprintf(w, "%s filesystem %q has %s and %s\n\n", ctx.Mount.Filesystem, ctx.Mount.Path,
- pluralize(len(options), "protector"), pluralize(len(policyDescriptors), "policy"))
+ fmt.Fprintf(w, "%s filesystem %q has %s and %s\n\n", ctx.Mount.FilesystemType,
+ ctx.Mount.Path, pluralize(len(options), "protector"),
+ pluralize(len(policyDescriptors), "policy"))
if len(options) > 0 {
writeOptions(w, options)
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index ee332c8..3884e6e 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -64,10 +64,10 @@ var (
)
// Mount contains information for a specific mounted filesystem.
-// Path - Absolute path where the directory is mounted
-// Filesystem - Name of the mounted filesystem
-// Options - List of options used when mounting the filesystem
-// Device - Device for filesystem (empty string if we cannot find one)
+// Path - Absolute path where the directory is mounted
+// FilesystemType - Type of the mounted filesystem, e.g. "ext4"
+// Options - List of options used when mounting the filesystem
+// Device - Device for filesystem (empty string if we cannot find one)
//
// In order to use a Mount to store fscrypt metadata, some directories must be
// setup first. Specifically, the directories created look like:
@@ -90,10 +90,10 @@ var (
// allows login protectors to be created when the root filesystem is read-only,
// provided that "/.fscrypt" is a symlink pointing to a writable location.
type Mount struct {
- Path string
- Filesystem string
- Options []string
- Device string
+ Path string
+ FilesystemType string
+ Options []string
+ Device string
}
// PathSorter allows mounts to be sorted by Path.
@@ -123,9 +123,9 @@ const (
func (m *Mount) String() string {
return fmt.Sprintf(`%s
- Filsystem: %s
- Options: %v
- Device: %s`, m.Path, m.Filesystem, m.Options, m.Device)
+ FilesystemType: %s
+ Options: %v
+ Device: %s`, m.Path, m.FilesystemType, m.Options, m.Device)
}
// BaseDir returns the path to the base fscrypt directory for this filesystem.
diff --git a/filesystem/mountpoint.go b/filesystem/mountpoint.go
index abd8232..856447f 100644
--- a/filesystem/mountpoint.go
+++ b/filesystem/mountpoint.go
@@ -87,9 +87,9 @@ func getMountInfo() error {
// Create the Mount structure by converting types.
mnt := Mount{
- Path: C.GoString(entry.mnt_dir),
- Filesystem: C.GoString(entry.mnt_type),
- Options: strings.Split(C.GoString(entry.mnt_opts), ","),
+ Path: C.GoString(entry.mnt_dir),
+ FilesystemType: C.GoString(entry.mnt_type),
+ Options: strings.Split(C.GoString(entry.mnt_opts), ","),
}
// Skip invalid mountpoints