Skip to content

Commit a73447d

Browse files
authored
Fix to build with Linux version 6.5 and later (#9)
* account for modify get_user_pages prototype for linux version 6.5 and later
1 parent a09d215 commit a73447d

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

u3v_stream.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,22 +1355,20 @@ static struct page **lock_user_pages(struct u3v_stream *stream,
13551355
#else
13561356
down_read(&current->mm->mmap_lock);
13571357
#endif
1358-
/* will store a page locked array of physical pages in pages var */
1359-
ret = get_user_pages(
1358+
1359+
/* will store a page locked array of physical pages in pages var */
13601360
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
1361-
current,
1362-
current->mm,
1363-
#endif
1364-
uaddr,
1365-
num_pages,
1366-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
1367-
WRITE,
1368-
0, /* Don't force */
1361+
ret = get_user_pages(current, current->mm, uaddr, num_pages, WRITE, 0, pages, NULL);
1362+
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
1363+
ret = get_user_pages(uaddr, num_pages, WRITE, 0, pages, NULL);
1364+
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0)
1365+
// replace get_user_pages() write/force parameters with gup_flags in Commit 768ae30
1366+
ret = get_user_pages(uaddr, num_pages, FOLL_WRITE, pages, NULL);
13691367
#else
1370-
FOLL_WRITE,
1368+
// vmas parameter removed from get_user_pages() in Commit 54d0206
1369+
ret = get_user_pages(uaddr, num_pages, FOLL_WRITE, pages);
13711370
#endif
1372-
pages,
1373-
NULL);
1371+
13741372
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
13751373
up_read(&current->mm->mmap_sem);
13761374
#else

0 commit comments

Comments
 (0)