From 23429d3d782f7506fb4747356974294cce08ac47 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 30 Apr 2012 11:33:13 -0700 Subject: Let cgpt open devices in read-only mode when possible. BUG=chromium-os:12430 TEST=manual Running "make; make runtests" in src/platform/vboot_refererence will test this change. Tests for use on a Chromebook are described in the bug report, but will require a USB or SD card that has a physical write-protect switch. Change-Id: I16a67bad3b59bec0981f4064f51fb1a29da65a90 Reviewed-on: https://gerrit.chromium.org/gerrit/21474 Tested-by: Bill Richardson Commit-Ready: Bill Richardson Reviewed-by: Richard Barnette Reviewed-by: Che-Liang Chiou --- cgpt/cgpt.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cgpt/cgpt.h') diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h index 1c809161..6851ded7 100644 --- a/cgpt/cgpt.h +++ b/cgpt/cgpt.h @@ -10,6 +10,7 @@ #endif #define _FILE_OFFSET_BITS 64 +#include #include #include #include @@ -61,7 +62,8 @@ struct drive { }; -int DriveOpen(const char *drive_path, struct drive *drive); +/* mode should be O_RDONLY or O_RDWR */ +int DriveOpen(const char *drive_path, struct drive *drive, int mode); int DriveClose(struct drive *drive, int update_as_needed); int CheckValid(const struct drive *drive); -- cgit v1.2.1