理解并尝试为fuse文件系统应用git补丁

理解并尝试为fuse文件系统应用git补丁,git,fuse,git-apply,Git,Fuse,Git Apply,我有一个基于fuse的文件系统,为了改进它,我需要实现这种方法 我知道我应该git应用,问题是我不知道这个补丁应该应用在哪里 修补程序正在尝试修改多个文件,例如: a/fs/fuse/Makefile a/fs/fuse/dev.c b/fs/fuse/dev.c a/fs/fuse/dir.c b/fs/fuse/dir.c etc.. 我用locate命令找不到它,也尝试丢失'a'和'b'前缀,只找到了makefile 注意:已安装libfuse dev 这是Linux内核的补丁。如果

我有一个基于fuse的文件系统,为了改进它,我需要实现这种方法

我知道我应该
git应用
,问题是我不知道这个补丁应该应用在哪里

修补程序正在尝试修改多个文件,例如:

a/fs/fuse/Makefile
a/fs/fuse/dev.c
b/fs/fuse/dev.c
a/fs/fuse/dir.c
b/fs/fuse/dir.c
etc..
我用
locate
命令找不到它,也尝试丢失'a'和'b'前缀,只找到了makefile

  • 注意:已安装libfuse dev

这是Linux内核的补丁。如果您还没有Linux内核源代码,则需要从Linux内核源代码的克隆开始:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
然后你需要下载补丁。请勿尝试从web浏览器复制和粘贴它。您可以从下载内核补丁;您引用的修补程序似乎是。从下载该修补程序的
mbox
版本,该版本将保存到名为

v5保险丝添加对直通读写的支持。修补程序
。然后,您可以通过在linux源目录中运行
git am
命令来应用此修补程序:

$ cd linux
$ git am /path/to/v5-fuse-Add-support-for-passthrough-read-write.patch
但是看看补丁,它是从2016年2月开始的,所以它可能不会完全适用于当前版本的内核。“可能”,我的意思是“它不适用”;上述命令将导致:

Applying: fuse: Add support for passthrough read/write
error: patch failed: fs/fuse/Makefile:5
error: fs/fuse/Makefile: patch does not apply
error: patch failed: fs/fuse/file.c:252
error: fs/fuse/file.c: patch does not apply
error: patch failed: fs/fuse/fuse_i.h:531
error: fs/fuse/fuse_i.h: patch does not apply
error: fs/fuse/fuse_passthrough.h: already exists in working directory
error: patch failed: fs/fuse/inode.c:898
error: fs/fuse/inode.c: patch does not apply
error: fs/fuse/passthrough.c: already exists in working directory
error: patch failed: include/uapi/linux/fuse.h:250
error: include/uapi/linux/fuse.h: patch does not apply
Patch failed at 0001 fuse: Add support for passthrough read/write
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
因此,我们需要做的是将内核源代码回滚到2016年的样子。首先,我们需要中止正在进行的
git am
操作:

$ git am --abort
然后将来源回滚到2016年2月1日或前后:

$ git checkout $(git rev-list -1 --before=2016-02-02 --first-parent master)
现在,该修补程序可以干净地应用:

$ git am /path/to/v5-fuse-Add-support-for-passthrough-read-write.patch
Applying: fuse: Add support for passthrough read/write
应用补丁后,您将需要编译并安装一个新的内核和模块,这超出了本答案的范围,但是已经有了很好的文档


要问你自己的问题是,考虑到这个补丁已经有一年多的历史了,而且从未被内核接受过,你确定你需要它吗?此后是否有其他可能提供类似改进的更改?

如果您的应用程序需要修补过的内核,则它(或其功能的该区域)会只能在安装补丁内核时使用。他可能不会在2016-02-01:-)
git rev list-1--before=2016-02-02--first parent master
。。。公平地说,这是一个非常简单的合并,有一些关于位掩码的争论,但没有什么太难的。@jthill是的,这就是我使用本地工作目录而不签出新副本所得到的:)。修复。非常感谢,这对我帮助很大!!