Skip to content

Commit

Permalink
Migrate //chromeos/ash/components/cros_disks to namespace ash [4/N]
Browse files Browse the repository at this point in the history
This CL migrates enum RenameError, FormatError, PartitionError from
chromeos to namespace ash and changes to enum class.

This CL is part of the Chrome OS source code directory migration:
https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE.

Change-Id: I6e25612d67619618f0ba9ae61fca98f323559f70
Bug: 1164001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3805087
Commit-Queue: Yeunjoo Choi <ychoi@igalia.com>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Owners-Override: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032411}
  • Loading branch information
duswnchl authored and Chromium LUCI CQ committed Aug 8, 2022
1 parent 9f22cfd commit d38fd33
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 240 deletions.
42 changes: 21 additions & 21 deletions ash/components/disks/disk_mount_manager.cc
Expand Up @@ -156,7 +156,7 @@ class DiskMountManagerImpl : public DiskMountManager,
LOG(ERROR) << "Cannot find mount point '" << mount_path << "'";
// We can't call OnFormatCompleted until |pending_format_changes_| has
// been populated.
NotifyFormatStatusUpdate(FORMAT_COMPLETED, FORMAT_ERROR_UNKNOWN,
NotifyFormatStatusUpdate(FORMAT_COMPLETED, FormatError::kUnknown,
mount_path, label);
return;
}
Expand All @@ -168,18 +168,18 @@ class DiskMountManagerImpl : public DiskMountManager,
DiskMap::const_iterator disk = disks_.find(device_path);
if (disk == disks_.end()) {
LOG(ERROR) << "Cannot find device '" << device_path << "'";
OnFormatCompleted(FORMAT_ERROR_UNKNOWN, device_path);
OnFormatCompleted(FormatError::kUnknown, device_path);
return;
}
if (disk->second->is_read_only()) {
LOG(ERROR) << "Device '" << device_path << "' is read-only";
OnFormatCompleted(FORMAT_ERROR_DEVICE_NOT_ALLOWED, device_path);
OnFormatCompleted(FormatError::kDeviceNotAllowed, device_path);
return;
}

if (filesystem == FormatFileSystemType::kUnknown) {
LOG(ERROR) << "Unknown filesystem passed to FormatMountedDevice";
OnFormatCompleted(FORMAT_ERROR_UNSUPPORTED_FILESYSTEM, device_path);
OnFormatCompleted(FormatError::kUnsupportedFilesystem, device_path);
return;
}

Expand All @@ -197,7 +197,7 @@ class DiskMountManagerImpl : public DiskMountManager,
if (disk_iter == disks_.end()) {
LOG(ERROR) << "Cannot find device '" << device_path << "'";
OnPartitionCompleted(device_path, filesystem, label,
PARTITION_ERROR_INVALID_DEVICE_PATH);
PartitionError::kInvalidDevicePath);
return;
}

Expand All @@ -215,7 +215,7 @@ class DiskMountManagerImpl : public DiskMountManager,
LOG(ERROR) << "Cannot find mount point '" << mount_path << "'";
// We can't call OnRenameCompleted until |pending_rename_changes_| has
// been populated.
NotifyRenameStatusUpdate(RENAME_COMPLETED, RENAME_ERROR_UNKNOWN,
NotifyRenameStatusUpdate(RENAME_COMPLETED, RenameError::kUnknown,
mount_path, volume_name);
return;
}
Expand All @@ -226,13 +226,13 @@ class DiskMountManagerImpl : public DiskMountManager,
DiskMap::const_iterator iter = disks_.find(device_path);
if (iter == disks_.end()) {
LOG(ERROR) << "Cannot find device '" << device_path << "'";
OnRenameCompleted(RENAME_ERROR_UNKNOWN, device_path);
OnRenameCompleted(RenameError::kUnknown, device_path);
return;
}

if (iter->second->is_read_only()) {
LOG(ERROR) << "Device '" << device_path << "' is read-only";
OnRenameCompleted(RENAME_ERROR_DEVICE_NOT_ALLOWED, device_path);
OnRenameCompleted(RenameError::kDeviceNotAllowed, device_path);
return;
}

Expand Down Expand Up @@ -565,7 +565,7 @@ class DiskMountManagerImpl : public DiskMountManager,
disks_.find(device_path) != disks_.end()) {
FormatUnmountedDevice(device_path, filesystem, label);
} else {
OnFormatCompleted(FORMAT_ERROR_UNKNOWN, device_path);
OnFormatCompleted(FormatError::kUnknown, device_path);
}
}

Expand All @@ -576,7 +576,7 @@ class DiskMountManagerImpl : public DiskMountManager,
if (error_code != MountError::kNone ||
disks_.find(device_path) == disks_.end()) {
OnPartitionCompleted(device_path, filesystem, label,
PARTITION_ERROR_UNKNOWN);
PartitionError::kUnknown);
return;
}

Expand Down Expand Up @@ -604,11 +604,11 @@ class DiskMountManagerImpl : public DiskMountManager,
const std::string& device_label,
bool success) {
if (!success) {
OnFormatCompleted(FORMAT_ERROR_UNKNOWN, device_path);
OnFormatCompleted(FormatError::kUnknown, device_path);
return;
}

NotifyFormatStatusUpdate(FORMAT_STARTED, FORMAT_ERROR_NONE, device_path,
NotifyFormatStatusUpdate(FORMAT_STARTED, FormatError::kNone, device_path,
device_label);
}

Expand All @@ -629,7 +629,7 @@ class DiskMountManagerImpl : public DiskMountManager,
DCHECK(disk);

if (pending_change != pending_format_changes_.end() &&
error_code == FORMAT_ERROR_NONE) {
error_code == FormatError::kNone) {
disk->set_device_label(pending_change->second.volume_name);
disk->set_file_system_type(pending_change->second.file_system_type);
}
Expand All @@ -651,7 +651,7 @@ class DiskMountManagerImpl : public DiskMountManager,

pending_partitioning_disks_.insert(disk->second->device_path());

NotifyPartitionStatusUpdate(PARTITION_STARTED, PARTITION_ERROR_NONE,
NotifyPartitionStatusUpdate(PARTITION_STARTED, PartitionError::kNone,
device_path, label);

cros_disks_client_->SinglePartitionFormat(
Expand All @@ -672,7 +672,7 @@ class DiskMountManagerImpl : public DiskMountManager,
Disk* disk = iter->second.get();
DCHECK(disk);

if (error_code == PARTITION_ERROR_NONE) {
if (error_code == PartitionError::kNone) {
EnsureMountInfoRefreshed(
BindOnce(&DiskMountManagerImpl::OnRefreshAfterPartition,
weak_ptr_factory_.GetWeakPtr(), device_path, filesystem,
Expand All @@ -698,7 +698,7 @@ class DiskMountManagerImpl : public DiskMountManager,
LOG(ERROR) << "Device not found, maybe ejected";
pending_partitioning_disks_.erase(device_path);
NotifyPartitionStatusUpdate(PARTITION_COMPLETED,
PARTITION_ERROR_INVALID_DEVICE_PATH,
PartitionError::kInvalidDevicePath,
device_path, label);
return;
}
Expand All @@ -719,7 +719,7 @@ class DiskMountManagerImpl : public DiskMountManager,
LOG(ERROR) << "New partition couldn't be found";
pending_partitioning_disks_.erase(device_path);
NotifyPartitionStatusUpdate(PARTITION_COMPLETED,
PARTITION_ERROR_INVALID_DEVICE_PATH,
PartitionError::kInvalidDevicePath,
device_path, label);
return;
}
Expand All @@ -745,7 +745,7 @@ class DiskMountManagerImpl : public DiskMountManager,
MountError error_code) {
if (error_code != MountError::kNone ||
disks_.find(device_path) == disks_.end()) {
OnRenameCompleted(RENAME_ERROR_UNKNOWN, device_path);
OnRenameCompleted(RenameError::kUnknown, device_path);
return;
}

Expand All @@ -769,11 +769,11 @@ class DiskMountManagerImpl : public DiskMountManager,
const std::string& volume_name,
bool success) {
if (!success) {
OnRenameCompleted(RENAME_ERROR_UNKNOWN, device_path);
OnRenameCompleted(RenameError::kUnknown, device_path);
return;
}

NotifyRenameStatusUpdate(RENAME_STARTED, RENAME_ERROR_NONE, device_path,
NotifyRenameStatusUpdate(RENAME_STARTED, RenameError::kNone, device_path,
volume_name);
}

Expand All @@ -794,7 +794,7 @@ class DiskMountManagerImpl : public DiskMountManager,
DCHECK(disk);

if (pending_change != pending_rename_changes_.end() &&
error_code == RENAME_ERROR_NONE)
error_code == RenameError::kNone)
disk->set_device_label(pending_change->second);
}

Expand Down

0 comments on commit d38fd33

Please sign in to comment.