]> git.baikalelectronics.ru Git - kernel.git/commit
modpost: add read_text_file() and get_line() helpers
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 1 Jun 2020 05:57:17 +0000 (14:57 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sat, 6 Jun 2020 14:38:12 +0000 (23:38 +0900)
commita0ce110029342ef869ace750d2210e4b5c0c5765
treeffedf7989d74b9cbba21ddc043576fb35a659cbd
parent4c2e714b0e808469422952d88e255505a16fbcb3
modpost: add read_text_file() and get_line() helpers

modpost uses grab_file() to open a file, but it is not suitable for
a text file because the mmap'ed file is not terminated by null byte.
Actually, I see some issues for the use of grab_file().

The new helper, read_text_file() loads the whole file content into a
malloc'ed buffer, and appends a null byte. Then, get_line() reads
each line.

To handle text files, I intend to replace as follows:

  grab_file()    -> read_text_file()
  get_new_line() -> get_line()

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mod/modpost.c
scripts/mod/modpost.h