使用 Clion 查看 DRBD(Kernel Module)代码
因为内核里有很多编译参数,所以需要配置下。 可以参考 http://ybin.cc/tools/clion-for-linux-driver-developer/ 我的最终配置是: … include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/include) include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/include/linux) include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/mm) include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/arch/x86/include) include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/include/uapi) include_directories(../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/arch/x86/include/uapi) include_directories(.) include_directories(drbd) include_directories(drbd/compat) include_directories(drbd/linux) add_definitions(-imacros ../kernel-3.10.0-327.36.1.el7/linux-3.10.0-327.36.1.el7/include/linux/kconfig.h) add_definitions(-D__KERNEL__) add_definitions(-DKBUILD_MODNAME) add_definitions(-DCONFIG_BLOCK) add_definitions(-DCONFIG_HZ) add_definitions(-DMODULE) add_definitions(-std=gnu89) …