mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-06-06 08:22:03 +08:00
ksmbd: fix build with kernel 6.12
This commit is contained in:
parent
af098a176f
commit
32dc417ef8
@ -1,13 +1,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ksmbd
|
||||
PKG_VERSION:=2023.12.22
|
||||
PKG_VERSION:=2024.10.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/cifsd-team/ksmbd
|
||||
PKG_SOURCE_VERSION:=0590dfae7a6e0a50eda6584286b2c6215aaddea1
|
||||
PKG_MIRROR_HASH:=95415120722db35ca599ab6ca36fd6310fc11ca50acf7d6235d4b0f397c46dd4
|
||||
PKG_SOURCE_URL:=https://github.com/namjaejeon/ksmbd.git
|
||||
PKG_SOURCE_VERSION:=0ee56e8d7da200ba5ddaa63d71fc6903919e6f99
|
||||
PKG_MIRROR_HASH:=7b244dcc78515be0d2dd4a4d2b6ec27582d8addc34654ce4ff74db4d17760aca
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
@ -15,9 +15,6 @@ PKG_LICENSE_FILES:=COPYING
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_OPTIONS+= --strip-components 1
|
||||
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
||||
|
||||
define KernelPackage/fs-ksmbd
|
||||
SUBMENU:=Filesystems
|
||||
TITLE:=SMB kernel server support
|
||||
@ -45,29 +42,8 @@ endef
|
||||
# The last two DEPENDS are hacks in order to get CONFIG_ASN1 and CONFIG_OID_REGISTRY
|
||||
# which it seems can't be selected independently. Some bug in either base or upstream.
|
||||
|
||||
define KernelPackage/fs-ksmbd/description
|
||||
Ksmbd is an In-kernel SMBv(1)2/3 fileserver.
|
||||
It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network.
|
||||
endef
|
||||
|
||||
define KernelPackage/fs-ksmbd/config
|
||||
config KSMBD_SMB_INSECURE_SERVER
|
||||
bool "Support for insecure SMB1/CIFS and SMB2.0 protocols"
|
||||
depends on PACKAGE_kmod-fs-ksmbd
|
||||
help
|
||||
This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0.
|
||||
default y
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y)
|
||||
PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y
|
||||
EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
$(PKG_EXTRA_KCONFIG) \
|
||||
CONFIG_SMB_SERVER=m \
|
||||
modules
|
||||
endef
|
||||
|
@ -0,0 +1,15 @@
|
||||
--- a/unicode.c
|
||||
+++ b/unicode.c
|
||||
@@ -8,7 +8,12 @@
|
||||
*/
|
||||
#include <linux/fs.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/version.h>
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
|
||||
#include <asm/unaligned.h>
|
||||
+#else
|
||||
+#include <linux/unaligned.h>
|
||||
+#endif
|
||||
#include "glob.h"
|
||||
#include "unicode.h"
|
||||
#include "uniupr.h"
|
@ -1,121 +0,0 @@
|
||||
From ab78eb9095c3b508dc1dceaf5757e56877a5a02e Mon Sep 17 00:00:00 2001
|
||||
From: W_Y_CPP <383152993@qq.com>
|
||||
Date: Thu, 25 Jan 2024 05:15:13 -0500
|
||||
Subject: [PATCH] fix build with kernel 6.6
|
||||
|
||||
---
|
||||
compat.c | 6 ++++++
|
||||
smb1pdu.c | 32 ++++++++++++++++++++++++++++++--
|
||||
2 files changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/compat.c b/compat.c
|
||||
index cd48401..47fe647 100644
|
||||
--- a/compat.c
|
||||
+++ b/compat.c
|
||||
@@ -8,6 +8,12 @@
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
+int compat_inode_permission(struct path *path, struct inode *inode, int mask)
|
||||
+{
|
||||
+ return inode_permission(mnt_idmap(path->mnt), inode, mask);
|
||||
+
|
||||
+}
|
||||
+
|
||||
void compat_generic_fillattr(struct path *path, u32 request_mask,
|
||||
struct inode *inode, struct kstat *kstat)
|
||||
{
|
||||
diff --git a/smb1pdu.c b/smb1pdu.c
|
||||
index 7501a53..6d9d204 100644
|
||||
--- a/smb1pdu.c
|
||||
+++ b/smb1pdu.c
|
||||
@@ -825,7 +825,12 @@ int smb_rename(struct ksmbd_work *work)
|
||||
char *oldname, *newname;
|
||||
struct ksmbd_file *fp = NULL;
|
||||
int oldname_len;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ struct path path, parent_path;
|
||||
+ int flags = 0;
|
||||
+#else
|
||||
struct path path;
|
||||
+#endif
|
||||
bool file_present = true;
|
||||
int rc = 0;
|
||||
|
||||
@@ -858,8 +863,12 @@ int smb_rename(struct ksmbd_work *work)
|
||||
newname = NULL;
|
||||
goto out;
|
||||
}
|
||||
-
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ rc = ksmbd_vfs_kern_path_locked(work, newname, LOOKUP_NO_SYMLINKS,
|
||||
+ &parent_path, &path, 1);
|
||||
+#else
|
||||
rc = ksmbd_vfs_kern_path(work, newname, LOOKUP_NO_SYMLINKS, &path, 1);
|
||||
+#endif
|
||||
if (rc)
|
||||
file_present = false;
|
||||
else
|
||||
@@ -873,7 +882,12 @@ int smb_rename(struct ksmbd_work *work)
|
||||
}
|
||||
|
||||
ksmbd_debug(SMB, "rename %s -> %s\n", oldname, newname);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ rc = ksmbd_vfs_kern_path_locked(work, oldname, LOOKUP_NO_SYMLINKS,
|
||||
+ &parent_path, &path, 1);
|
||||
+#else
|
||||
rc = ksmbd_vfs_kern_path(work, oldname, LOOKUP_NO_SYMLINKS, &path, 1);
|
||||
+#endif
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -883,8 +897,11 @@ int smb_rename(struct ksmbd_work *work)
|
||||
path_put(&path);
|
||||
goto out;
|
||||
}
|
||||
-
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ rc = ksmbd_vfs_rename(work, &fp->filp->f_path, newname, flags);
|
||||
+#else
|
||||
rc = ksmbd_vfs_fp_rename(work, fp, newname);
|
||||
+#endif
|
||||
if (rc) {
|
||||
rsp->hdr.Status.CifsError = STATUS_NO_MEMORY;
|
||||
path_put(&path);
|
||||
@@ -7344,6 +7361,9 @@ static int smb_fileinfo_rename(struct ksmbd_work *work)
|
||||
struct ksmbd_file *fp;
|
||||
char *newname;
|
||||
int rc = 0;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ int flags = 0;
|
||||
+#endif
|
||||
|
||||
req = (struct smb_com_trans2_sfi_req *)work->request_buf;
|
||||
rsp = (struct smb_com_trans2_sfi_rsp *)work->response_buf;
|
||||
@@ -7381,7 +7401,11 @@ static int smb_fileinfo_rename(struct ksmbd_work *work)
|
||||
}
|
||||
|
||||
ksmbd_debug(SMB, "new name(%s)\n", newname);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
|
||||
+ rc = ksmbd_vfs_rename(work, &fp->filp->f_path, newname, flags);
|
||||
+#else
|
||||
rc = ksmbd_vfs_fp_rename(work, fp, newname);
|
||||
+#endif
|
||||
if (rc) {
|
||||
rsp->hdr.Status.CifsError = STATUS_UNEXPECTED_IO_ERROR;
|
||||
goto out;
|
||||
@@ -8380,7 +8404,11 @@ int smb_open_andx(struct ksmbd_work *work)
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
|
||||
+ generic_fillattr(mnt_idmap(path.mnt), STATX_BASIC_STATS, d_inode(path.dentry),&stat);
|
||||
+#else
|
||||
generic_fillattr(mnt_idmap(path.mnt), d_inode(path.dentry), &stat);
|
||||
+#endif
|
||||
#else
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||
generic_fillattr(mnt_user_ns(path.mnt), d_inode(path.dentry), &stat);
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user