ext4: remove read-only check in get atime/mtime/ctime/mode/own methods
[lwext4.git] / include / ext4.h
index 78e8647245e8787a02b6760087ae0bb765843005..ec74689f574eadb12e25ad81f5e279ac7f801b9c 100644 (file)
@@ -234,6 +234,14 @@ int ext4_get_sblock(const char *mount_point, struct ext4_sblock **sb);
  * @return  standard error code */
 int ext4_cache_write_back(const char *path, bool on);
 
+
+/**@brief   Force cache flush.
+ *
+ * @param   path mount point path
+ *
+ * @return  standard error code */
+int ext4_cache_flush(const char *path);
+
 /********************************FILE OPERATIONS*****************************/
 
 /**@brief   Remove file by path.
@@ -340,32 +348,64 @@ uint64_t ext4_fsize(ext4_file *f);
  * @param path to file/dir/link
  * @param mode new mode bits (for example 0777)
  * @return  standard error code*/
-int ext4_chmod(const char *path, uint32_t mode);
+int ext4_mode_set(const char *path, uint32_t mode);
+
+
+/**@brief Get file/directory/link mode bits
+ * @param path to file/dir/link
+ * @param mode new mode bits (for example 0777)
+ * @return  standard error code*/
+int ext4_mode_get(const char *path, uint32_t *mode);
 
 /**@brief Change file owner and group
  * @param path to file/dir/link
  * @param uid user id
  * @param gid group id
  * @return  standard error code*/
-int ext4_chown(const char *path, uint32_t uid, uint32_t gid);
+int ext4_owner_set(const char *path, uint32_t uid, uint32_t gid);
+
+/**@brief Get file/directory/link owner and group
+ * @param path to file/dir/link
+ * @param uid user id
+ * @param gid group id
+ * @return  standard error code*/
+int ext4_owner_get(const char *path, uint32_t *uid, uint32_t *gid);
 
-/**@brief Set file access time
+/**@brief Set file/directory/link access time
  * @param path to file/dir/link
  * @param atime access timestamp
  * @return  standard error code*/
-int ext4_file_set_atime(const char *path, uint32_t atime);
+int ext4_atime_set(const char *path, uint32_t atime);
 
-/**@brief Set file modify time
+/**@brief Set file/directory/link modify time
  * @param path to file/dir/link
  * @param mtime modify timestamp
  * @return  standard error code*/
-int ext4_file_set_mtime(const char *path, uint32_t mtime);
+int ext4_mtime_set(const char *path, uint32_t mtime);
 
-/**@brief Set file change time
+/**@brief Set file/directory/link change time
  * @param path to file/dir/link
  * @param ctime change timestamp
  * @return  standard error code*/
-int ext4_file_set_ctime(const char *path, uint32_t ctime);
+int ext4_ctime_set(const char *path, uint32_t ctime);
+
+/**@brief Get file/directory/link access time
+ * @param path to file/dir/link
+ * @param atime access timestamp
+ * @return  standard error code*/
+int ext4_atime_get(const char *path, uint32_t *atime);
+
+/**@brief Get file/directory/link modify time
+ * @param path to file/dir/link
+ * @param mtime modify timestamp
+ * @return  standard error code*/
+int ext4_mtime_get(const char *path, uint32_t *mtime);
+
+/**@brief Get file/directory/link change time
+ * @param path to file/dir/link
+ * @param ctime change timestamp
+ * @return  standard error code*/
+int ext4_ctime_get(const char *path, uint32_t *ctime);
 
 /**@brief Create symbolic link
  * @param target destination path
@@ -373,6 +413,14 @@ int ext4_file_set_ctime(const char *path, uint32_t ctime);
  * @return standard error code*/
 int ext4_fsymlink(const char *target, const char *path);
 
+/**@brief Create special file
+ * @param path path to new file
+ * @param filetype The filetype of the new special file
+ *       (that must not be regular file, directory, or unknown type)
+ * @param dev if filetype is char device or block device,
+ *       the device number will become the payload in the inode
+ * @return standard error code*/
+int ext4_mknod(const char *path, int filetype, uint32_t dev);
 
 /**@brief Read symbolic link payload
  * @param path to symlink
@@ -388,7 +436,7 @@ int ext4_readlink(const char *path, char *buf, size_t bufsize, size_t *rcnt);
  * @param name_len length of @name in bytes
  * @param data data of the entry to add
  * @param data_size size of data to add
- * @param replace whether existing entries should be replaced
+ * @param replace this boolean is deprecated.
  * @return standard error code*/
 int ext4_setxattr(const char *path, const char *name, size_t name_len,
                  const void *data, size_t data_size, bool replace);
@@ -426,6 +474,12 @@ int ext4_removexattr(const char *path, const char *name, size_t name_len);
  * @return  standard error code*/
 int ext4_dir_rm(const char *path);
 
+/**@brief Rename/move directory
+ * @param path source
+ * @param new_path destination
+ * @return  standard error code */
+int ext4_dir_mv(const char *path, const char *new_path);
+
 /**@brief   Create new directory.
  * @param   name new directory name
  * @return  standard error code*/