update_engine: Remove unused utils.
These functions are not currently used, and looks like they have
never been used.
BUG=chromium:368971
TEST=Unittests still pass. grep says we are not using them.
Change-Id: I2ea9878920d177529c0a504adff94303c2471565
Reviewed-on: https://chromium-review.googlesource.com/228195
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/test_utils.cc b/test_utils.cc
index 3619e5a..251ed78 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -40,108 +40,6 @@
return utils::WriteFile(path.c_str(), data.data(), data.size());
}
-string Readlink(const string& path) {
- vector<char> buf(PATH_MAX + 1);
- ssize_t r = readlink(path.c_str(), &buf[0], buf.size());
- if (r < 0)
- return "";
- CHECK_LT(r, static_cast<ssize_t>(buf.size()));
- buf.resize(r);
- string ret;
- ret.insert(ret.begin(), buf.begin(), buf.end());
- return ret;
-}
-
-vector<char> GzipCompressData(const vector<char>& data) {
- const char fname[] = "/tmp/GzipCompressDataTemp";
- if (!WriteFileVector(fname, data)) {
- EXPECT_EQ(0, system((string("rm ") + fname).c_str()));
- return vector<char>();
- }
- EXPECT_EQ(0, system((string("cat ") + fname + "|gzip>" +
- fname + ".gz").c_str()));
- EXPECT_EQ(0, system((string("rm ") + fname).c_str()));
- vector<char> ret;
- EXPECT_TRUE(utils::ReadFile(string(fname) + ".gz", &ret));
- EXPECT_EQ(0, system((string("rm ") + fname + ".gz").c_str()));
- return ret;
-}
-
-vector<char> GenerateSampleMbr() {
- // This is the actual MBR from my dev machine. Partition 1 (the first)
- // is currently marked bootable
- unsigned char mbr[512] = {
- 0xeb, 0x48, 0x90, 0x10, 0x8e, 0xd0, 0xbc, 0x00,
- 0xb0, 0xb8, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0,
- 0xfb, 0xbe, 0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9,
- 0x00, 0x02, 0xf3, 0xa4, 0xea, 0x21, 0x06, 0x00,
- 0x00, 0xbe, 0xbe, 0x07, 0x38, 0x04, 0x75, 0x0b,
- 0x83, 0xc6, 0x10, 0x81, 0xfe, 0xfe, 0x07, 0x75,
- 0xf3, 0xeb, 0x16, 0xb4, 0x02, 0xb0, 0x01, 0xbb,
- 0x00, 0x7c, 0xb2, 0x80, 0x8a, 0x74, 0x03, 0x02,
- 0xff, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x02, 0xfa, 0x90, 0x90, 0xf6, 0xc2, 0x80,
- 0x75, 0x02, 0xb2, 0x80, 0xea, 0x59, 0x7c, 0x00,
- 0x00, 0x31, 0xc0, 0x8e, 0xd8, 0x8e, 0xd0, 0xbc,
- 0x00, 0x20, 0xfb, 0xa0, 0x40, 0x7c, 0x3c, 0xff,
- 0x74, 0x02, 0x88, 0xc2, 0x52, 0xbe, 0x7f, 0x7d,
- 0xe8, 0x34, 0x01, 0xf6, 0xc2, 0x80, 0x74, 0x54,
- 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0xcd, 0x13, 0x5a,
- 0x52, 0x72, 0x49, 0x81, 0xfb, 0x55, 0xaa, 0x75,
- 0x43, 0xa0, 0x41, 0x7c, 0x84, 0xc0, 0x75, 0x05,
- 0x83, 0xe1, 0x01, 0x74, 0x37, 0x66, 0x8b, 0x4c,
- 0x10, 0xbe, 0x05, 0x7c, 0xc6, 0x44, 0xff, 0x01,
- 0x66, 0x8b, 0x1e, 0x44, 0x7c, 0xc7, 0x04, 0x10,
- 0x00, 0xc7, 0x44, 0x02, 0x01, 0x00, 0x66, 0x89,
- 0x5c, 0x08, 0xc7, 0x44, 0x06, 0x00, 0x70, 0x66,
- 0x31, 0xc0, 0x89, 0x44, 0x04, 0x66, 0x89, 0x44,
- 0x0c, 0xb4, 0x42, 0xcd, 0x13, 0x72, 0x05, 0xbb,
- 0x00, 0x70, 0xeb, 0x7d, 0xb4, 0x08, 0xcd, 0x13,
- 0x73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0x20, 0x00, 0x47, 0x65, 0x6f,
- 0x6d, 0x00, 0x48, 0x61, 0x72, 0x64, 0x20, 0x44,
- 0x69, 0x73, 0x6b, 0x00, 0x52, 0x65, 0x61, 0x64,
- 0x00, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x00,
- 0xbb, 0x01, 0x00, 0xb4, 0x0e, 0xcd, 0x10, 0xac,
- 0x3c, 0x00, 0x75, 0xf4, 0xc3, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x50, 0xc1, 0x04, 0x00, 0x00, 0x00, 0x80, 0x01,
- 0x01, 0x00, 0x83, 0xfe, 0xff, 0xff, 0x3f, 0x00,
- 0x00, 0x00, 0x09, 0x7f, 0x32, 0x06, 0x00, 0xfe,
- 0xff, 0xff, 0x05, 0xfe, 0xff, 0xff, 0x48, 0x7f,
- 0x32, 0x06, 0x79, 0x59, 0x2d, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
- };
- vector<char> ret;
- ret.insert(ret.begin(), reinterpret_cast<char *>(mbr),
- reinterpret_cast<char *>(mbr + sizeof(mbr)));
- return ret;
-}
-
// Binds provided |filename| to an unused loopback device, whose name is written
// to the string pointed to by |lo_dev_name_p|. Returns true on success, false
// otherwise (along with corresponding test failures), in which case the content
diff --git a/test_utils.h b/test_utils.h
index cf6cb96..73f29c6 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -31,17 +31,6 @@
bool WriteFileVector(const std::string& path, const std::vector<char>& data);
bool WriteFileString(const std::string& path, const std::string& data);
-// Reads a symlink from disk. Returns empty string on failure.
-std::string Readlink(const std::string& path);
-
-// Gzip compresses the data passed using the gzip command line program.
-// Returns compressed data back.
-std::vector<char> GzipCompressData(const std::vector<char>& data);
-
-// Gives back a 512-bytes length array that contains an MBR with
-// the first partition is marked bootable.
-std::vector<char> GenerateSampleMbr();
-
bool BindToUnusedLoopDevice(const std::string &filename,
std::string* lo_dev_name_ptr);
diff --git a/utils.cc b/utils.cc
index eb4ccd2..33df1b5 100644
--- a/utils.cc
+++ b/utils.cc
@@ -820,12 +820,6 @@
return "data";
}
-bool GetBootloader(BootLoader* out_bootloader) {
- // For now, hardcode to syslinux.
- *out_bootloader = BootLoader_SYSLINUX;
- return true;
-}
-
namespace {
// Do the actual trigger. We do it as a main-loop callback to (try to) get a
// consistent stack trace.
diff --git a/utils.h b/utils.h
index f9b3c28..56bd22e 100644
--- a/utils.h
+++ b/utils.h
@@ -223,14 +223,6 @@
// Returns a string representation of the given enum.
std::string ToString(PayloadType payload_type);
-enum BootLoader {
- BootLoader_SYSLINUX = 0,
- BootLoader_CHROME_FIRMWARE = 1
-};
-// Detects which bootloader this system uses and returns it via the out
-// param. Returns true on success.
-bool GetBootloader(BootLoader* out_bootloader);
-
// Schedules a Main Loop callback to trigger the crash reporter to perform an
// upload as if this process had crashed.
void ScheduleCrashReporterUpload();