解析linux patch
patch 文件的结构
补丁头
补丁头是分别由 —/+++ 开头的两行,用来表示要打补丁的文件。 — 开头表示旧文件, +++ 开头表示新文件。
一个补丁文件中的多个补丁
一个补丁文件中可能包含以 —/+++ 开头的很多节,每一节用来打一个补丁。所以在一个补丁文件中可以包含好多个补丁。
块
块是补丁中要修改的地方。它通常由一部分不用修改的东西开始和结束。他们只是用来表示要修改的位置。他们通常以 @@ 开始,结束于另一个块的开始或者一个新的补丁头。
块的缩进
块会缩进一列,而这一列是用来表示这一行是要增加还是要删除的。
块的第一列
+ 号表示这一行是要加上的。
– 号表示这一行是要删除的。
没有加号也没有减号表示这里只是引用的而不需要修改,用来定位。
diff --git a/include/linux/fb.h b/include/linux/fb.h 【这儿表示一个小段的开始】 index c10163b..1296af4 --- a/include/linux/fb.h (一般表示原文件,a是原文件对应的目录) +++ b/include/linux/fb.h (一般表示改动过的文件,b是其目录名,所以可以直接看他们的下层目录来找) @@ -403,6 +403,7 @@ struct fb_cursor { 第一段不同的地方,旧文件从403行开始,共6行;新文件从403行开始,共7行 #include
#include
#include
+#include
【+表示增加一行】
#include
struct vm_area_struct; @@ -862,10 +863,22 @@ struct fb_info { 【@@ -862... 此处表示对应该文件的多少行多少列】 /* we need the PCI or similiar aperture base/size not smem_start/size as smem_start may just be an object allocated inside the aperture so may not actually overlap */ - resource_size_t aperture_base; - resource_size_t aperture_size; 【-表示删除改行】 + struct apertures_struct { + unsigned int count; + struct aperture { + resource_size_t base; + resource_size_t size; + } ranges[0]; + } *apertures; }; +static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { + struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) + + max_num * sizeof(struct aperture), GFP_KERNEL); + a->count = max_num; + return a; +} + #ifdef MODULE #define FBINFO_DEFAULT FBINFO_MODULE #else
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/201958.html原文链接:https://javaforall.net
