Commit 1fadef3c authored by Sergei Datsenko's avatar Sergei Datsenko Committed by Commit Bot

cros-disks: Don't set "default" mount options.

Default parameters are determined by the CrosDisks, it's not up to
the client to decide which ones are the "default" so it ignores those
anyway.

BUG=chromium:831491

Change-Id: Ibb8cc66b318282b15bfcb361a6428e37028dcf37
Reviewed-on: https://chromium-review.googlesource.com/1053343
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558174}
parent e7023f8c
......@@ -34,15 +34,11 @@ namespace chromeos {
namespace {
const char* kDefaultMountOptions[] = {
"nodev", "noexec", "nosuid",
};
const char kReadOnlyOption[] = "ro";
const char kReadWriteOption[] = "rw";
const char kRemountOption[] = "remount";
const char kMountLabelOption[] = "mountlabel";
const char kLazyUnmountOption[] = "lazy";
constexpr char kReadOnlyOption[] = "ro";
constexpr char kReadWriteOption[] = "rw";
constexpr char kRemountOption[] = "remount";
constexpr char kMountLabelOption[] = "mountlabel";
constexpr char kLazyUnmountOption[] = "lazy";
// Checks if retrieved media type is in boundaries of DeviceMediaType.
bool IsValidMediaType(uint32_t type) {
......@@ -680,8 +676,6 @@ std::vector<std::string> CrosDisksClient::ComposeMountOptions(
MountAccessMode access_mode,
RemountOption remount) {
std::vector<std::string> mount_options = options;
mount_options.insert(mount_options.end(), kDefaultMountOptions,
kDefaultMountOptions + base::size(kDefaultMountOptions));
switch (access_mode) {
case MOUNT_ACCESS_MODE_READ_ONLY:
mount_options.push_back(kReadOnlyOption);
......
......@@ -166,48 +166,36 @@ TEST(CrosDisksClientTest, ComposeMountOptions) {
CrosDisksClient::ComposeMountOptions({}, kMountLabel,
MOUNT_ACCESS_MODE_READ_WRITE,
REMOUNT_OPTION_MOUNT_NEW_DEVICE);
ASSERT_EQ(5U, rw_mount_options.size());
EXPECT_EQ("nodev", rw_mount_options[0]);
EXPECT_EQ("noexec", rw_mount_options[1]);
EXPECT_EQ("nosuid", rw_mount_options[2]);
EXPECT_EQ("rw", rw_mount_options[3]);
EXPECT_EQ(kExpectedMountLabelOption, rw_mount_options[4]);
ASSERT_EQ(2U, rw_mount_options.size());
EXPECT_EQ("rw", rw_mount_options[0]);
EXPECT_EQ(kExpectedMountLabelOption, rw_mount_options[1]);
std::vector<std::string> ro_mount_options =
CrosDisksClient::ComposeMountOptions({}, kMountLabel,
MOUNT_ACCESS_MODE_READ_ONLY,
REMOUNT_OPTION_MOUNT_NEW_DEVICE);
ASSERT_EQ(5U, ro_mount_options.size());
EXPECT_EQ("nodev", ro_mount_options[0]);
EXPECT_EQ("noexec", ro_mount_options[1]);
EXPECT_EQ("nosuid", ro_mount_options[2]);
EXPECT_EQ("ro", ro_mount_options[3]);
EXPECT_EQ(kExpectedMountLabelOption, ro_mount_options[4]);
ASSERT_EQ(2U, ro_mount_options.size());
EXPECT_EQ("ro", ro_mount_options[0]);
EXPECT_EQ(kExpectedMountLabelOption, ro_mount_options[1]);
std::vector<std::string> remount_mount_options =
CrosDisksClient::ComposeMountOptions(
{}, kMountLabel, MOUNT_ACCESS_MODE_READ_WRITE,
REMOUNT_OPTION_REMOUNT_EXISTING_DEVICE);
ASSERT_EQ(6U, remount_mount_options.size());
EXPECT_EQ("nodev", remount_mount_options[0]);
EXPECT_EQ("noexec", remount_mount_options[1]);
EXPECT_EQ("nosuid", remount_mount_options[2]);
EXPECT_EQ("rw", remount_mount_options[3]);
EXPECT_EQ("remount", remount_mount_options[4]);
EXPECT_EQ(kExpectedMountLabelOption, remount_mount_options[5]);
ASSERT_EQ(3U, remount_mount_options.size());
EXPECT_EQ("rw", remount_mount_options[0]);
EXPECT_EQ("remount", remount_mount_options[1]);
EXPECT_EQ(kExpectedMountLabelOption, remount_mount_options[2]);
std::vector<std::string> custom_mount_options =
CrosDisksClient::ComposeMountOptions({"foo", "bar=baz"}, kMountLabel,
MOUNT_ACCESS_MODE_READ_WRITE,
REMOUNT_OPTION_MOUNT_NEW_DEVICE);
ASSERT_EQ(7U, custom_mount_options.size());
ASSERT_EQ(4U, custom_mount_options.size());
EXPECT_EQ("foo", custom_mount_options[0]);
EXPECT_EQ("bar=baz", custom_mount_options[1]);
EXPECT_EQ("nodev", custom_mount_options[2]);
EXPECT_EQ("noexec", custom_mount_options[3]);
EXPECT_EQ("nosuid", custom_mount_options[4]);
EXPECT_EQ("rw", custom_mount_options[5]);
EXPECT_EQ(kExpectedMountLabelOption, custom_mount_options[6]);
EXPECT_EQ("rw", custom_mount_options[2]);
EXPECT_EQ(kExpectedMountLabelOption, custom_mount_options[3]);
}
} // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment