標籤:錯誤 val header ror 修改 poi 個數 vmware 模組
inux上安裝vmware,啟動時提示異常
提示查看記錄檔
/tmp/vmware-root/vmware-19482.log
發現是編譯vmnet.o模組時出錯,錯誤資訊如下
/tmp/modconfig-4UP6CG/vmnet-only/userif.c:117:43: error: passing argument 5 of ‘get_user_pages’ from incompatible pointer type [-Werror=incompatible-pointer-types]retval = get_user_pages(addr, 1, 1, 0, &page, NULL);^In file included from /usr/src/linux-headers-4.9.0-deepin4-common/include/linux/highmem.h:7:0,from /tmp/modconfig-4UP6CG/vmnet-only/userif.c:26:
查看userif.c檔案
發現錯誤位置代碼如下
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)retval = get_user_pages(addr, 1, 1, 0, &page, NULL);#elseretval = get_user_pages(current, current->mm, addr,1, 1, 0, &page, NULL);
在
/usr/src/linux-headers-4.9.0-deepin4-common/include/linux/mm.h
中找到get_user_pages的定義
long get_user_pages(unsigned long start, unsigned long nr_pages,unsigned int gup_flags, struct page **pages,struct vm_area_struct **vmas);
參數個數果然和userif.c裡面的不一致
難道是linux核心修改了?
根據userif.c裡文法的意思,下載了4.6的標頭檔查看mm.h
發現其定義如下
long get_user_pages(unsigned long start, unsigned long nr_pages,int write, int force, struct page **pages,struct vm_area_struct **vmas);
果然是改了函數定義
上github看了下變更資訊,發現是在4.9中將write與force合并成一個參數了
增加了宏
#define FOLL_WRITE0x01
#define FOLL_FORCE0x10
來用與運算得到這兩個參數
所以修改userif.c中的相關語句為
#if LINUX_VERSION_CODE>= KERNEL_VERSION(4, 9, 0) retval = get_user_pages(addr, 1, 1, &page, NULL);#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) retval = get_user_pages(addr, 1, 1, 0, &page, NULL);#else retval = get_user_pages(current, current->mm, addr, 1, 1, 0, &page, NULL);#endif
再次編譯後執行vmware
成功執行!
linux 核心 4.9安裝vmware12報錯的解決方案