summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorngkaho1234 <ngkaho1234@gmail.com>2016-01-30 23:26:22 +0800
committerngkaho1234 <ngkaho1234@gmail.com>2016-01-30 23:26:22 +0800
commit8929c98e42e81dce0b00d03a1c7b2f45ee85fe87 (patch)
tree4105a1ca03e0c61983402e087d600e973e43faa9 /include
parent9b40d089d6cf5912b558dd3e0ca1a246baa6750a (diff)
ext4: add read_only parameter to ext4_mount routine.
Now users can mount a filesystem as read-only mode explicitly.
Diffstat (limited to 'include')
-rw-r--r--include/ext4.h5
-rw-r--r--include/ext4_fs.h4
-rw-r--r--include/ext4_types.h2
3 files changed, 9 insertions, 2 deletions
diff --git a/include/ext4.h b/include/ext4.h
index 4bf31ac..bf6e101 100644
--- a/include/ext4.h
+++ b/include/ext4.h
@@ -122,9 +122,12 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
* - /
* - /my_partition/
* - /my_second_partition/
+ * @param read_only mount as read-only mode.
*
* @return standard error code */
-int ext4_mount(const char *dev_name, const char *mount_point);
+int ext4_mount(const char *dev_name,
+ const char *mount_point,
+ bool read_only);
/**@brief Umount operation.
* @param mount_point mount name
diff --git a/include/ext4_fs.h b/include/ext4_fs.h
index 97e1d1d..473929d 100644
--- a/include/ext4_fs.h
+++ b/include/ext4_fs.h
@@ -93,9 +93,11 @@ static inline ext4_fsblk_t ext4_fs_first_bg_block_no(struct ext4_sblock *s,
/**@brief Initialize filesystem and read all needed data.
* @param fs Filesystem instance to be initialized
* @param bdev Identifier if device with the filesystem
+ * @param read_only Mark the filesystem as read-only.
* @return Error code
*/
-int ext4_fs_init(struct ext4_fs *fs, struct ext4_blockdev *bdev);
+int ext4_fs_init(struct ext4_fs *fs, struct ext4_blockdev *bdev,
+ bool read_only);
/**@brief Destroy filesystem instance (used by unmount operation).
* @param fs Filesystem to be destroyed
diff --git a/include/ext4_types.h b/include/ext4_types.h
index 41cb33f..ca3a8c2 100644
--- a/include/ext4_types.h
+++ b/include/ext4_types.h
@@ -303,6 +303,8 @@ struct ext4_sblock {
#endif
struct ext4_fs {
+ bool read_only;
+
struct ext4_blockdev *bdev;
struct ext4_sblock sb;