From: SangYoun Kwak Date: Wed, 6 Apr 2022 06:58:55 +0000 (+0900) Subject: Add description for the declaration of the file utils X-Git-Tag: submit/tizen/20220525.001052~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6ecf79fba84a09feecd7314a150f07f374f530c;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git Add description for the declaration of the file utils Change-Id: Ia8367863a59fd3f31738fa62db1d0618c4e8ba5a Signed-off-by: SangYoun Kwak --- diff --git a/src/libcommon/file.h b/src/libcommon/file.h index 31df8fa..7154494 100644 --- a/src/libcommon/file.h +++ b/src/libcommon/file.h @@ -20,12 +20,76 @@ #include +/** + * @brief Open file, read and close + * + * @param[in] file File name + * @param[in] len Length of buffer + * @param[out] buf Buffer that stores read data + * + * @return read length if read was successful else negative error value + */ int sys_read_buf(char *file, char *buf, int len); + +/** + * @brief Open file, write and close + * + * @param[in] file File name + * @param[out] buf Buffer that stores data to write + * + * @return zero on success otherwise negative error value + */ int sys_write_buf(char *file, char *buf); + +/** + * @brief Read integer from file + * + * @param[in] fname File name + * @param[out] val integer value that read from file + * + * @return read length if reading integer was successful else negative error value + */ int sys_get_int(char *fname, int *val); + +/** + * @brief Read string from file + * + * @param[in] fname File name + * @param[in] len String length + * @param[out] str Buffer + * + * @return zero on success otherwise negative error value + */ int sys_get_str(char *fname, char *str, int len); + +/** + * @brief Write integer to file + * + * @param[in] fname File name + * @param[in] val Integer value to write + * + * @return zero on success otherwise negative error value + */ int sys_set_int(char *fname, int val); + +/** + * @brief Write string to file + * + * @param[in] fname File name + * @param[out] val String to write + * + * @return zero on success otherwise negative error value + */ int sys_set_str(char *fname, char *val); + +/** + * @brief Parse format from /proc/cmdline + * + * @param[in] format Format string + * @param[out] ... Variable argument + * + * @return zero if cannot read else the number of matched and assigned items + */ int libsys_parse_cmdline_scanf(const char *format, ...); #endif /* __LIBCOMMON_FILE_H__ */