summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2019-08-19 13:04:14 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-26 23:41:49 +0000
commit09430fe59ead446115e8fb675876cf4d9117de71 (patch)
treeac9053964f8743046c661fc0fe156122c5ae240d
parentafef8d7bafad7fe588a291b03c1ffdffa129aec1 (diff)
downloadcrosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar.gz
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar.bz2
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar.lz
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar.xz
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.tar.zst
crosvm-09430fe59ead446115e8fb675876cf4d9117de71.zip
arch: fdt: replace byteorder with to_be_bytes()
Use the standard library u32 and u64 byteorder conversion functions (now
that they are stabilized) rather than the byteorder crate.

BUG=None
TEST=./build_test

Change-Id: I7d2b523c2df5f7cdf1cd7d5b760ede8e827e0517
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761150
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
-rw-r--r--Cargo.lock1
-rw-r--r--arch/Cargo.toml1
-rw-r--r--arch/src/fdt.rs9
3 files changed, 2 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8387f0e..60befe6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -22,7 +22,6 @@ dependencies = [
 name = "arch"
 version = "0.1.0"
 dependencies = [
- "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "devices 0.1.0",
  "io_jail 0.1.0",
  "kernel_cmdline 0.1.0",
diff --git a/arch/Cargo.toml b/arch/Cargo.toml
index f562fca..bf28560 100644
--- a/arch/Cargo.toml
+++ b/arch/Cargo.toml
@@ -5,7 +5,6 @@ authors = ["The Chromium OS Authors"]
 edition = "2018"
 
 [dependencies]
-byteorder = "*"
 devices = { path = "../devices" }
 io_jail = { path = "../io_jail" }
 kernel_cmdline = { path = "../kernel_cmdline" }
diff --git a/arch/src/fdt.rs b/arch/src/fdt.rs
index 71c791d..a3861d5 100644
--- a/arch/src/fdt.rs
+++ b/arch/src/fdt.rs
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-use byteorder::{BigEndian, ByteOrder};
 use libc::{c_char, c_int, c_void};
 use std::ffi::{CStr, CString};
 use std::fmt::{self, Display};
@@ -106,15 +105,11 @@ pub fn property(fdt: &mut Vec<u8>, name: &str, val: &[u8]) -> Result<()> {
 }
 
 fn cpu_to_fdt32(input: u32) -> [u8; 4] {
-    let mut buf = [0; 4];
-    BigEndian::write_u32(&mut buf, input);
-    buf
+    input.to_be_bytes()
 }
 
 fn cpu_to_fdt64(input: u64) -> [u8; 8] {
-    let mut buf = [0; 8];
-    BigEndian::write_u64(&mut buf, input);
-    buf
+    input.to_be_bytes()
 }
 
 pub fn property_u32(fdt: &mut Vec<u8>, name: &str, val: u32) -> Result<()> {