From 515c87cad45e324286b36b6c2f3d7f8319092a1e Mon Sep 17 00:00:00 2001
From: DBJ <974658390@qq.com>
Date: Fri, 13 Aug 2021 02:20:28 -0700
Subject: [PATCH 1/8] fix spelling errors in project

---
 address_space/src/address_space.rs                        | 2 +-
 boot_loader/src/x86_64/standard_boot/elf.rs               | 2 +-
 cpu/src/lib.rs                                            | 8 ++++----
 devices/src/interrupt_controller/aarch64/state.rs         | 2 +-
 devices/src/legacy/fwcfg.rs                               | 6 +++---
 devices/src/legacy/pl011.rs                               | 2 +-
 devices/src/legacy/rtc.rs                                 | 6 +++---
 docs/config_guidebook.md                                  | 6 +++---
 docs/design.md                                            | 2 +-
 docs/interconnect_with_libvirt.md                         | 2 +-
 hypervisor/src/kvm/interrupt.rs                           | 2 +-
 machine/src/micro_vm/mod.rs                               | 4 ++--
 machine/src/standard_vm/aarch64/mod.rs                    | 2 +-
 migration/src/manager.rs                                  | 4 ++--
 migration/src/snapshot.rs                                 | 4 ++--
 ozone/src/syscall.rs                                      | 2 +-
 tests/hydropper/monitor/monitor_thread.py                 | 2 +-
 .../microvm/functional/test_microvm_concurrency.py        | 4 ++--
 tests/hydropper/utils/session.py                          | 2 +-
 tests/hydropper/utils/utils_qmp.py                        | 2 +-
 vfio/src/vfio_dev.rs                                      | 8 ++++----
 virtio/src/queue.rs                                       | 2 +-
 virtio/src/virtio_mmio.rs                                 | 2 +-
 23 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/address_space/src/address_space.rs b/address_space/src/address_space.rs
index c182281..85bf71f 100644
--- a/address_space/src/address_space.rs
+++ b/address_space/src/address_space.rs
@@ -307,7 +307,7 @@ impl AddressSpace {
         })
     }
 
-    /// Return the end address fo memory  according to all Ram regions in AddressSpace.
+    /// Return the end address of memory  according to all Ram regions in AddressSpace.
     pub fn memory_end_address(&self) -> GuestAddress {
         self.flat_view
             .load()
diff --git a/boot_loader/src/x86_64/standard_boot/elf.rs b/boot_loader/src/x86_64/standard_boot/elf.rs
index 481b876..a76e789 100644
--- a/boot_loader/src/x86_64/standard_boot/elf.rs
+++ b/boot_loader/src/x86_64/standard_boot/elf.rs
@@ -79,7 +79,7 @@ impl Elf64Header {
             bail!("Invalid magic in ELF header");
         }
         if self.e_ident[EI_DATA] != ELFDATA2LSB {
-            bail!("Big endian ELF file is not suppored");
+            bail!("Big endian ELF file is not supported");
         }
         if self.e_ident[EI_CLASS] != ELFCLASS64 {
             bail!("Only 64-bit ELF image is supported");
diff --git a/cpu/src/lib.rs b/cpu/src/lib.rs
index 41e143f..cb1a41b 100644
--- a/cpu/src/lib.rs
+++ b/cpu/src/lib.rs
@@ -494,7 +494,7 @@ impl CPUInterface for CPU {
                             .chain_err(|| "Some error occurred in guest shutdown")?;
                     } else {
                         error!(
-                            "Vcpu{} recevied unexpected system event with type 0x{:x}, flags 0x{:x}",
+                            "Vcpu{} received unexpected system event with type 0x{:x}, flags 0x{:x}",
                             self.id(),
                             event,
                             flags
@@ -569,11 +569,11 @@ impl CPUThreadWorker {
         }
 
         register_signal_handler(VCPU_EXIT_SIGNAL, handle_signal)
-            .chain_err(|| "Failed to registe VCPU_EXIT_SIGNAL signal.")?;
+            .chain_err(|| "Failed to register VCPU_EXIT_SIGNAL signal.")?;
         register_signal_handler(VCPU_PAUSE_SIGNAL, handle_signal)
-            .chain_err(|| "Failed to registe VCPU_PAUSE_SIGNAL signal.")?;
+            .chain_err(|| "Failed to register VCPU_PAUSE_SIGNAL signal.")?;
         register_signal_handler(VCPU_TASK_SIGNAL, handle_signal)
-            .chain_err(|| "Failed to registe VCPU_TASK_SIGNAL signal.")?;
+            .chain_err(|| "Failed to register VCPU_TASK_SIGNAL signal.")?;
 
         Ok(())
     }
diff --git a/devices/src/interrupt_controller/aarch64/state.rs b/devices/src/interrupt_controller/aarch64/state.rs
index e1b05b6..d4da00b 100644
--- a/devices/src/interrupt_controller/aarch64/state.rs
+++ b/devices/src/interrupt_controller/aarch64/state.rs
@@ -75,7 +75,7 @@ const ICC_CTLR_EL1: u64 = 0xc664;
 const ICC_SRE_EL1: u64 = 0xc665;
 const ICC_IGRPEN0_EL1: u64 = 0xc666;
 const ICC_IGRPEN1_EL1: u64 = 0xc667;
-/// GICv3 CPU interface control regiter pribits[8:10]
+/// GICv3 CPU interface control register pribits[8:10]
 const ICC_CTLR_EL1_PRIBITS_MASK: u64 = 0x700;
 const ICC_CTLR_EL1_PRIBITS_SHIFT: u64 = 0x8;
 
diff --git a/devices/src/legacy/fwcfg.rs b/devices/src/legacy/fwcfg.rs
index ed41581..34c1375 100644
--- a/devices/src/legacy/fwcfg.rs
+++ b/devices/src/legacy/fwcfg.rs
@@ -365,7 +365,7 @@ impl FwCfgCommon {
             );
         };
 
-        // unwrap is safe bacause the count of arch_entries and entries is initialized
+        // unwrap is safe because the count of arch_entries and entries is initialized
         // as `FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS_DFLT`, which is equal to the return
         // value of `max_entry` function.
         if self.is_arch_local() {
@@ -1402,7 +1402,7 @@ mod test {
         fwcfg_dev.lock().unwrap().read(&mut read_data, base, offset);
         assert_eq!(read_data, sig_entry_data);
 
-        // Failed to write beacuse of offset overflow.
+        // Failed to write because of offset overflow.
         let write_data = vec![0x0_u8];
         let offset = 0x18;
         let f_back = fwcfg_dev.lock().unwrap().write(&write_data, base, offset);
@@ -1442,7 +1442,7 @@ mod test {
         fwcfg_dev.lock().unwrap().read(&mut read_data, base, offset);
         assert_eq!(read_data, sig_entry_data);
 
-        // Failed to write beacuse of offset overflow.
+        // Failed to write because of offset overflow.
         let write_data = vec![0x0_u8];
         let offset = 0x0c;
         let f_back = fwcfg_dev.lock().unwrap().write(&write_data, base, offset);
diff --git a/devices/src/legacy/pl011.rs b/devices/src/legacy/pl011.rs
index fa063c3..133487e 100644
--- a/devices/src/legacy/pl011.rs
+++ b/devices/src/legacy/pl011.rs
@@ -74,7 +74,7 @@ pub struct PL011State {
     ibrd: u32,
     /// Fractional Baud Rate Register.
     fbrd: u32,
-    /// Interrut FIFO Level Select Register.
+    /// Interrupt FIFO Level Select Register.
     ifl: u32,
     /// Identifier Register. Length is 8.
     id: [u8; 8],
diff --git a/devices/src/legacy/rtc.rs b/devices/src/legacy/rtc.rs
index 0b5e4aa..6241e68 100644
--- a/devices/src/legacy/rtc.rs
+++ b/devices/src/legacy/rtc.rs
@@ -36,7 +36,7 @@ const RTC_MINUTES: u8 = 0x02;
 const RTC_MINUTES_ALARM: u8 = 0x03;
 const RTC_HOURS: u8 = 0x04;
 const RTC_HOURS_ARARM: u8 = 0x05;
-const RTC_DAY_OF_WEAK: u8 = 0x06;
+const RTC_DAY_OF_WEEK: u8 = 0x06;
 const RTC_DAY_OF_MONTH: u8 = 0x07;
 const RTC_MONTH: u8 = 0x08;
 const RTC_YEAR: u8 = 0x09;
@@ -61,7 +61,7 @@ const CMOS_MEM_ABOVE_4GB: (u8, u8, u8) = (0x5B, 0x5C, 0x5D);
 fn get_utc_time() -> libc::tm {
     let time_val: libc::time_t = 0_i64;
 
-    // Safe bacause `libc::time` only get time.
+    // Safe because `libc::time` only get time.
     unsafe { libc::time(time_val as *mut i64) };
 
     let mut dest_tm = libc::tm {
@@ -177,7 +177,7 @@ impl RTC {
             RTC_HOURS => {
                 data[0] = bin_to_bcd(tm.tm_hour as u8);
             }
-            RTC_DAY_OF_WEAK => {
+            RTC_DAY_OF_WEEK => {
                 data[0] = bin_to_bcd((tm.tm_wday + 1) as u8);
             }
             RTC_DAY_OF_MONTH => {
diff --git a/docs/config_guidebook.md b/docs/config_guidebook.md
index 6d118ec..6a5cda7 100644
--- a/docs/config_guidebook.md
+++ b/docs/config_guidebook.md
@@ -124,7 +124,7 @@ If you want to use initrd as rootfs, `root=/dev/ram` and `rdinit=/bin/sh` must b
 ## 2. Device Configuration
 
 For machine type "microvm", only virtio-mmio and legacy devices are supported.
-Maximum number of user createable devices is 11 on x86_64 and 160 on aarch64.
+Maximum number of user creatable devices is 11 on x86_64 and 160 on aarch64.
 
 For standard VM (machine type "q35" on x86_64, and "virt" on aarch64) , virtio-pci devices are supported instead of virtio-mmio
 devices. As for now pci bridges are not implemented yet, there is currently only one
@@ -829,7 +829,7 @@ About the arguments:
 * `netns` : path to a existed network namespace.
 * `source` : path to the source file, such as `rootfs` and `vmlinux`.
 * `clean-resource` : a flag to clean resource.
-* `--` : these two dashes are used to splite args, the args followed are used to launched StratoVirt.
+* `--` : these two dashes are used to split args, the args followed are used to launched StratoVirt.
 
 ### 5.2 Example
 As ozone uses a directory to mount as a root directory, after ozone is launched, the directory "/srv/zozne/{exec_file}/{name}" will be created. (Where, `exec_file` is the executable binary file, usually it is `stratovirt`, while `name` is the name of ozone, it is given by users, but the length of it should be no more than 255 bytes.) In order to run ozone normally, please make sure that the directory "/srv/zozne/{exec_file}/{name}" does not exists before launching ozone.
@@ -874,7 +874,7 @@ $ ./ozone \
 ```
 
 ## 6. Libvirt
-Libvirt launchs StratoVirt by creating cmdlines. But some of these commands
+Libvirt launches StratoVirt by creating cmdlines. But some of these commands
 such as: cpu, overcommit, uuid, no-user-config, nodefaults, sandbox, msg, rtc, no-shutdown,
 nographic, realtime, display, usb, mem-prealloc and boot, are not supported by StratoVirt.
 To launch StratoVirt from libvirt successfully, StratoVirt needs to put these arguments into
diff --git a/docs/design.md b/docs/design.md
index 4ffdd16..537d256 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -45,6 +45,6 @@ The following figure shows StratoVirt's core architecture which consist of three
 
 - Only the Linux operating system is supported; The recommended kernel version is 4.19;
 - Only Linux is supported as the client operating system, and the recommended kernel version is 4.19;
-- StratoVirt is fullly tested on openEuler;
+- StratoVirt is fully tested on openEuler;
 - Supports a maximum of 254 CPUs;
 
diff --git a/docs/interconnect_with_libvirt.md b/docs/interconnect_with_libvirt.md
index a448bb5..d5205ed 100644
--- a/docs/interconnect_with_libvirt.md
+++ b/docs/interconnect_with_libvirt.md
@@ -20,7 +20,7 @@ CPU topology is not supported, please configure the number of VCPUs only.
 ```
 <vcpu>4</vcpu>
 ```
-- Archtecture:
+- Architecture:
 
 Optional value of `arch` are: `aarch64` and `x86_64`. On X86 platform, supported machine is `q35`; on aarch 64 platform, supported machine is `virt`.
 ```
diff --git a/hypervisor/src/kvm/interrupt.rs b/hypervisor/src/kvm/interrupt.rs
index 45799f9..675d25c 100644
--- a/hypervisor/src/kvm/interrupt.rs
+++ b/hypervisor/src/kvm/interrupt.rs
@@ -103,7 +103,7 @@ impl IrqRouteTable {
     #[cfg(target_arch = "x86_64")]
     pub fn init_irq_route_table(&mut self) {
         // On x86, use `kvm_create_irqchip` to create an interrupt
-        // controller module in the kernel. It creates a virual PIC, a virtual ioapic,
+        // controller module in the kernel. It creates a virtual PIC, a virtual ioapic,
         // and sets up future vcpus to have a local APIC. IRQ routing for GSIs 0-15 is set
         // to both PIC and IOAPIC. GSI 16-23 only go to the IOAPIC.
         for i in 0..IOAPIC_NUM_PINS {
diff --git a/machine/src/micro_vm/mod.rs b/machine/src/micro_vm/mod.rs
index ea92164..f48a6dc 100644
--- a/machine/src/micro_vm/mod.rs
+++ b/machine/src/micro_vm/mod.rs
@@ -659,7 +659,7 @@ impl MachineOps for LightMachine {
             let index = MMIO_REPLACEABLE_BLK_NR + self.replaceable_info.net_count;
             if index >= MMIO_REPLACEABLE_BLK_NR + MMIO_REPLACEABLE_NET_NR {
                 bail!(
-                    "A maximum of {} net replaceble devices are supported.",
+                    "A maximum of {} net replaceable devices are supported.",
                     MMIO_REPLACEABLE_NET_NR
                 );
             }
@@ -677,7 +677,7 @@ impl MachineOps for LightMachine {
         let device_cfg = parse_blk(vm_config, cfg_args)?;
         if self.replaceable_info.block_count >= MMIO_REPLACEABLE_BLK_NR {
             bail!(
-                "A maximum of {} block replaceble devices are supported.",
+                "A maximum of {} block replaceable devices are supported.",
                 MMIO_REPLACEABLE_BLK_NR
             );
         }
diff --git a/machine/src/standard_vm/aarch64/mod.rs b/machine/src/standard_vm/aarch64/mod.rs
index ee66bc9..54c103c 100644
--- a/machine/src/standard_vm/aarch64/mod.rs
+++ b/machine/src/standard_vm/aarch64/mod.rs
@@ -179,7 +179,7 @@ impl StdMachineOps for StdMachine {
         let pcihost_root = PciHostRoot::new(root_bus);
         pcihost_root
             .realize()
-            .chain_err(|| "Faile to realize pcihost root device.")?;
+            .chain_err(|| "Failed to realize pcihost root device.")?;
 
         Ok(())
     }
diff --git a/migration/src/manager.rs b/migration/src/manager.rs
index 35ed975..480b59b 100644
--- a/migration/src/manager.rs
+++ b/migration/src/manager.rs
@@ -21,7 +21,7 @@ use super::status::MigrationStatus;
 use util::byte_code::ByteCode;
 
 lazy_static! {
-    /// Glocal MigrationMananger to manage all migration combined interface.
+    /// Glocal MigrationManager to manage all migration combined interface.
     pub(crate) static ref MIGRATION_MANAGER: Arc<MigrationManager> = Arc::new(MigrationManager {
         entry: Arc::new(RwLock::new(BTreeMap::<u64, MigrationEntry>::new())),
         desc_db: Arc::new(RwLock::new(HashMap::<String, DeviceStateDesc>::new())),
@@ -135,7 +135,7 @@ pub enum MigrationEntry {
 /// This structure is to manage all resource during migration.
 /// It is also the only way to call on `MIGRATION_MANAGER`.
 pub struct MigrationManager {
-    /// The map offers the deivce_id and combined migratable device entry.
+    /// The map offers the device_id and combined migratable device entry.
     pub(crate) entry: Arc<RwLock<BTreeMap<u64, MigrationEntry>>>,
     /// The map offers the device type and its device state describe structure.
     pub(crate) desc_db: Arc<RwLock<HashMap<String, DeviceStateDesc>>>,
diff --git a/migration/src/snapshot.rs b/migration/src/snapshot.rs
index 470ea63..edea8ce 100644
--- a/migration/src/snapshot.rs
+++ b/migration/src/snapshot.rs
@@ -94,7 +94,7 @@ impl MigrationManager {
     /// # Notes
     ///
     /// Offers a interface for restore snapshot functions. This function will make VM
-    /// back to the state restored in snapshot file incluing both device and memory.
+    /// back to the state restored in snapshot file including both device and memory.
     ///
     /// # Argument
     ///
@@ -126,7 +126,7 @@ impl MigrationManager {
             bail!("Invalid device state snapshot file");
         }
 
-        Self::load_memory(&mut memory_file).chain_err(|| "Failed to load snpashot memory")?;
+        Self::load_memory(&mut memory_file).chain_err(|| "Failed to load snapshot memory")?;
         let snapshot_desc_db =
             Self::load_descriptor_db(&mut device_state_file, device_state_header.desc_len)
                 .chain_err(|| "Failed to load device descriptor db")?;
diff --git a/ozone/src/syscall.rs b/ozone/src/syscall.rs
index 2627642..936661f 100644
--- a/ozone/src/syscall.rs
+++ b/ozone/src/syscall.rs
@@ -140,7 +140,7 @@ pub fn set_host_name(host_name: &str) -> Result<()> {
 ///
 /// # Arguments
 ///
-/// * `fd` - File descriptor refering to one of magic links in a /proc/[pid]/ns/ directory.
+/// * `fd` - File descriptor referring to one of magic links in a /proc/[pid]/ns/ directory.
 /// * `nstype` - Namespace type.
 pub fn setns(fd: i32, nstype: i32) -> Result<()> {
     SyscallResult {
diff --git a/tests/hydropper/monitor/monitor_thread.py b/tests/hydropper/monitor/monitor_thread.py
index daad97d..5921ecf 100644
--- a/tests/hydropper/monitor/monitor_thread.py
+++ b/tests/hydropper/monitor/monitor_thread.py
@@ -25,7 +25,7 @@ class MonitorThread(threading.Thread):
     items = dict()
 
     def __init__(self):
-        """Construtor"""
+        """Constructor"""
         super(MonitorThread, self).__init__()
         self.state_lock = threading.Lock()
         self._state = 'init'
diff --git a/tests/hydropper/testcases/microvm/functional/test_microvm_concurrency.py b/tests/hydropper/testcases/microvm/functional/test_microvm_concurrency.py
index ded87ad..73de004 100644
--- a/tests/hydropper/testcases/microvm/functional/test_microvm_concurrency.py
+++ b/tests/hydropper/testcases/microvm/functional/test_microvm_concurrency.py
@@ -20,10 +20,10 @@ def test_microvm_concurrency(microvms):
     """
     Test multi microvms start:
 
-    1) Set each VM vcpu_count = 4, then launch it and comfirm vcpu count is 4.
+    1) Set each VM vcpu_count = 4, then launch it and confirm vcpu count is 4.
     And increase _succ_sum.
     2) Execute step 1 concurrency by threads.
-    3) Comfirm each VM is execute successffully by _succ_sum
+    3) Confirm each VM is execute successffully by _succ_sum
 
     Note: You can modify CONCURRENT_QUANTITY tag in config/config.ini to set vm quantity.
     """
diff --git a/tests/hydropper/utils/session.py b/tests/hydropper/utils/session.py
index 1eb3bad..bb9036f 100644
--- a/tests/hydropper/utils/session.py
+++ b/tests/hydropper/utils/session.py
@@ -152,7 +152,7 @@ class ConsoleManager():
                         LOG.debug("Got 'Warning added RSA to known host list")
                     continue
             except aexpect.ExpectTimeoutError as err:
-                # send a empty line to avoid unexpect login timeout
+                # send a empty line to avoid unexpected login timeout
                 # because some message from linux kernel maybe impact match
                 if not last_chance:
                     time.sleep(0.5)
diff --git a/tests/hydropper/utils/utils_qmp.py b/tests/hydropper/utils/utils_qmp.py
index 8acefed..7d0527d 100644
--- a/tests/hydropper/utils/utils_qmp.py
+++ b/tests/hydropper/utils/utils_qmp.py
@@ -9,7 +9,7 @@
 # KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 # NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 # See the Mulan PSL v2 for more details.
-"""Some qmp fuctions"""
+"""Some qmp functions"""
 
 import re
 from utils.exception import QMPError
diff --git a/vfio/src/vfio_dev.rs b/vfio/src/vfio_dev.rs
index 0603d49..30f7d5a 100644
--- a/vfio/src/vfio_dev.rs
+++ b/vfio/src/vfio_dev.rs
@@ -464,13 +464,13 @@ impl VfioDevice {
             .iter()
             .collect::<PathBuf>()
             .read_link()
-            .chain_err(|| "Invaild iommu group path")?;
+            .chain_err(|| "Invalid iommu group path")?;
         let group_name = iommu_group
             .file_name()
-            .chain_err(|| "Invaild iommu group name")?;
+            .chain_err(|| "Invalid iommu group name")?;
         let mut group_id = 0;
         if let Some(n) = group_name.to_str() {
-            group_id = n.parse::<u32>().chain_err(|| "Invaild iommu group id")?;
+            group_id = n.parse::<u32>().chain_err(|| "Invalid iommu group id")?;
         }
 
         let mut groups = container.groups.lock().unwrap();
@@ -489,7 +489,7 @@ impl VfioDevice {
     fn vfio_get_device(group: &VfioGroup, name: &Path) -> Result<File> {
         let mut dev_name: &str = "";
         if let Some(n) = name.file_name() {
-            dev_name = n.to_str().chain_err(|| "Invaild device path")?;
+            dev_name = n.to_str().chain_err(|| "Invalid device path")?;
         }
         let path: CString = CString::new(dev_name.as_bytes())
             .chain_err(|| "Failed to convert device name to CString type of data")?;
diff --git a/virtio/src/queue.rs b/virtio/src/queue.rs
index 9979b5c..6ac137c 100644
--- a/virtio/src/queue.rs
+++ b/virtio/src/queue.rs
@@ -68,7 +68,7 @@ pub struct QueueConfig {
     pub ready: bool,
     /// Interrupt vector index of the queue for msix
     pub vector: u16,
-    /// The next index which can be poped in the available vring.
+    /// The next index which can be popped in the available vring.
     next_avail: u16,
     /// The next index which can be pushed in the used vring.
     next_used: u16,
diff --git a/virtio/src/virtio_mmio.rs b/virtio/src/virtio_mmio.rs
index 099015f..ad9b32a 100644
--- a/virtio/src/virtio_mmio.rs
+++ b/virtio/src/virtio_mmio.rs
@@ -80,7 +80,7 @@ const VENDOR_ID: u32 = 0;
 const MMIO_MAGIC_VALUE: u32 = 0x7472_6976;
 const MMIO_VERSION: u32 = 2;
 
-/// The maximun of virtio queue within a virtio device.
+/// The maximum of virtio queue within a virtio device.
 const MAXIMUM_NR_QUEUES: usize = 8;
 
 /// HostNotifyInfo includes the info needed for notifying backend from guest.
-- 
2.25.1

