iscsi-scst: Port to Linux kernel v5.10

mm_segment_t, get_fs() and set_fs() have been removed from Linux kernel
v5.10. Instead of adding more #ifdef / #endif directives, provide backports
for this typedef and these functions in iscsi_scst.h.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9189 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-11-23 15:58:00 +00:00
parent 9ac77f979d
commit fd5b318880

View File

@@ -16,6 +16,28 @@
#ifndef _ISCSI_SCST_U_H
#define _ISCSI_SCST_U_H
#ifdef __KERNEL__
#include <linux/uaccess.h> /* mm_segment_t */
#include <linux/version.h>
/* <asm/uaccess.h> */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
/*
* With kernel 5.9 or older, certain kernel functions, e.g. setsockopt(),
* sock_recvmsg() only accept a pointer to a user space buffer. With kernel
* v5.10 these functions accept a sockptr_t, a data structure that includes
* information about the address space of a pointer. See also commit
* 47058bb54b57 ("x86: remove address space overrides using set_fs()"). See
* also https://lwn.net/Articles/832121/. The definitions below make it easy
* to write kernel code that is compatible with all kernel versions.
*/
#define KERNEL_DS ((mm_segment_t) { })
static inline mm_segment_t get_fs(void) { return ((mm_segment_t) { }); }
static inline void set_fs(mm_segment_t seg) { }
#endif
#endif
#ifdef __KERNEL__
#include <linux/types.h>
#else