summaryrefslogtreecommitdiff
path: root/cgpt/drive.h
diff options
context:
space:
mode:
Diffstat (limited to 'cgpt/drive.h')
-rw-r--r--cgpt/drive.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/cgpt/drive.h b/cgpt/drive.h
new file mode 100644
index 00000000..d03bfe74
--- /dev/null
+++ b/cgpt/drive.h
@@ -0,0 +1,29 @@
+/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef VBOOT_REFERENCE_UTILITY_CGPT_DRIVE_H_
+#define VBOOT_REFERENCE_UTILITY_CGPT_DRIVE_H_
+
+struct drive;
+typedef off_t (*DriveSeekFunc)(struct drive*, off_t offset, int whence);
+typedef ssize_t (*DriveReadFunc)(struct drive*, void* buf, size_t count);
+typedef ssize_t (*DriveWriteFunc)(struct drive*, const void* buf, size_t count);
+typedef int (*DriveCloseFunc)(struct drive*);
+typedef int (*DriveSyncFunc)(struct drive*);
+
+off_t FileSeek(struct drive* drive, off_t offset, int whence);
+ssize_t FileRead(struct drive* drive, void* buf, size_t count);
+ssize_t FileWrite(struct drive* drive, const void* buf, size_t count);
+int FileSync(struct drive* drive);
+int FileClose(struct drive* drive);
+
+int FlashInit(struct drive* drive);
+off_t FlashSeek(struct drive* drive, off_t offset, int whence);
+ssize_t FlashRead(struct drive* drive, void* buf, size_t count);
+ssize_t FlashWrite(struct drive* drive, const void* buf, size_t count);
+int FlashSync(struct drive* drive);
+int FlashClose(struct drive* drive);
+
+#endif // VBOOT_REFERENCE_UTILITY_CGPT_DRIVE_H_