ANDROID: fs: Add read_comp_algo_dictionary() to read compression dictionaries
Partner zram driver reads a file to populate its compression dictionary. To support this while restricting kernel_read_file_from_path() usage, introduce read_comp_algo_dictionary(). This function wraps kernel_read_file_from_path() and is GPL-exported. It allows zram and similar users to load dictionaries while keeping direct usage of kernel_read_file_from_path() controlled. Bug: 407663651 Change-Id: I013330e270dc6a7529e83ef4efc1472c198fcc92 Signed-off-by: Donghyeok Choe <d7271.choe@samsung.com>
This commit is contained in:
committed by
Treehugger Robot
parent
f1a9a2c1ac
commit
b9f02b7e52
@@ -187,3 +187,13 @@ out:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kernel_read_file_from_fd);
|
||||
|
||||
ssize_t read_comp_algo_dictionary(void **dict, const char *dict_path)
|
||||
{
|
||||
return kernel_read_file_from_path(dict_path, 0,
|
||||
dict,
|
||||
INT_MAX,
|
||||
NULL,
|
||||
READING_POLICY);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(read_comp_algo_dictionary);
|
||||
|
||||
@@ -52,4 +52,6 @@ ssize_t kernel_read_file_from_fd(int fd, loff_t offset,
|
||||
size_t *file_size,
|
||||
enum kernel_read_file_id id);
|
||||
|
||||
ssize_t read_comp_algo_dictionary(void **dict, const char *dict_path);
|
||||
|
||||
#endif /* _LINUX_KERNEL_READ_FILE_H */
|
||||
|
||||
Reference in New Issue
Block a user