qdf_file.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * DOC: Thin filesystem API abstractions
  20. */
  21. #ifndef __QDF_FILE_H
  22. #define __QDF_FILE_H
  23. #include "qdf_status.h"
  24. /**
  25. * qdf_file_read() - read the entire contents of a file
  26. * @path: the full path of the file to read
  27. * @out_buf: double pointer for referring to the file contents buffer
  28. *
  29. * This API allocates a new, null-terminated buffer containing the contents of
  30. * the file at @path. On success, @out_buf points to this new buffer, otherwise
  31. * @out_buf is set to NULL.
  32. *
  33. * Consumers must free the allocated buffer by calling qdf_file_buf_free().
  34. *
  35. * Return: QDF_STATUS
  36. */
  37. QDF_STATUS qdf_file_read(const char *path, char **out_buf);
  38. /**
  39. * qdf_file_buf_free() - free a previously allocated file buffer
  40. * @file_buf: pointer to the file buffer to free
  41. *
  42. * This API is used in conjunction with qdf_file_read().
  43. *
  44. * Return: None
  45. */
  46. void qdf_file_buf_free(char *file_buf);
  47. #endif /* __QDF_FILE_H */