1 /* 2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: Thin filesystem API abstractions 21 */ 22 23 #ifndef __QDF_FILE_H 24 #define __QDF_FILE_H 25 26 #include "qdf_status.h" 27 28 /** 29 * qdf_file_read() - read the entire contents of a file 30 * @path: the full path of the file to read 31 * @out_buf: double pointer for referring to the file contents buffer 32 * 33 * This API allocates a new, null-terminated buffer containing the contents of 34 * the file at @path. On success, @out_buf points to this new buffer, otherwise 35 * @out_buf is set to NULL. 36 * 37 * Consumers must free the allocated buffer by calling qdf_file_buf_free(). 38 * 39 * Return: QDF_STATUS 40 */ 41 QDF_STATUS qdf_file_read(const char *path, char **out_buf); 42 43 /** 44 * qdf_file_buf_free() - free a previously allocated file buffer 45 * @file_buf: pointer to the file buffer to free 46 * 47 * This API is used in conjunction with qdf_file_read(). 48 * 49 * Return: None 50 */ 51 void qdf_file_buf_free(char *file_buf); 52 53 #endif /* __QDF_FILE_H */ 54 55