Skip to content
This repository was archived by the owner on Mar 1, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions os_dep/osdep_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -2084,8 +2084,10 @@ static int isFileReadable(const char *path, u32 *sz)
if (IS_ERR(fp))
ret = PTR_ERR(fp);
else {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif

if (1 != readFile(fp, &buf, 1))
ret = PTR_ERR(fp);
Expand All @@ -2097,8 +2099,9 @@ static int isFileReadable(const char *path, u32 *sz)
*sz = i_size_read(fp->f_dentry->d_inode);
#endif
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs);
#endif
filp_close(fp, NULL);
}
return ret;
Expand All @@ -2121,11 +2124,14 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
ret = openFile(&fp, path, O_RDONLY, 0);
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);

#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
ret = readFile(fp, buf, sz);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs);
#endif
closeFile(fp);

RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
Expand Down Expand Up @@ -2156,11 +2162,14 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
ret = openFile(&fp, path, O_CREAT | O_WRONLY, 0666);
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);

#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
ret = writeFile(fp, buf, sz);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs);
#endif
closeFile(fp);

RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);
Expand Down