mirror of
https://github.com/schoebel/mars
synced 2025-02-17 12:37:20 +00:00
infra: classify MARS_NEEDS_OLDCOMPAT_FUNCTIONS
This commit is contained in:
parent
063b386dbe
commit
f11993a1ee
@ -792,8 +792,10 @@ void _rollover_channel(struct say_channel *ch)
|
||||
mars_rename(old, new);
|
||||
#elif defined(MARS_HAS_PREPATCH)
|
||||
sys_rename(old, new);
|
||||
#else
|
||||
#elif defined(MARS_NEEDS_OLDCOMPAT_FUNCTIONS)
|
||||
__oldcompat_rename(old, new);
|
||||
#else
|
||||
#error Build Error - check the sources and/or the pre-patch version
|
||||
#endif
|
||||
set_fs(oldfs);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#ifndef _MARS_COMPAT
|
||||
#define _MARS_COMPAT
|
||||
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/major.h>
|
||||
|
||||
/* Detect 5c0ba4e0762e6dabd14a5c276652e2defec38de7
|
||||
@ -46,6 +47,7 @@
|
||||
* and the new wrappers around vfs_*().
|
||||
*/
|
||||
#ifdef MARS_MAJOR
|
||||
#if !defined(MARS_HAS_PREPATCH_V3)
|
||||
/*
|
||||
* Obey 819671ff849b07b9831b91de879ddc5da4b333d4 as much as possible,
|
||||
* detected via 57b56ac6fecb05c3192586e4892572dd13d972de
|
||||
@ -56,20 +58,35 @@
|
||||
/* old prepatch (to disappear), using deprecated sys_*() calls */
|
||||
#define MARS_HAS_PREPATCH
|
||||
#endif
|
||||
#else
|
||||
#endif /* !defined(MARS_HAS_PREPATCH_V3) */
|
||||
#else /* MARS_MAJOR */
|
||||
#define MARS_MAJOR (DRBD_MAJOR + 1)
|
||||
#endif
|
||||
#endif /* MARS_MAJOR */
|
||||
|
||||
#if defined(MARS_HAS_PREPATCH_V2) || defined(MARS_HAS_PREPATCH)
|
||||
|
||||
#include <linux/syscalls.h>
|
||||
|
||||
#else /* MARS_HAS_PREPATCH */
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/time.h>
|
||||
#include "lamport.h"
|
||||
|
||||
/* The __oldcompat_*() functions were originally needed for OLD out-of-tree
|
||||
* versions of MARS for adapdation to OLD kernel versions.
|
||||
* After some v4.xxx kernels, the out-of-tree compile did not
|
||||
* really work anymore.
|
||||
* Even some combinations of in-tree mars.ko with some (Frankenstein) kernels
|
||||
* were requiring this code.
|
||||
*
|
||||
* This crap should VANISH in the long term, by integration of MARS
|
||||
* into the upstream kernel.
|
||||
*
|
||||
* Since kernel v5.10 and later, it should be possible to compile (and run!)
|
||||
* even an out-of-tree mars.ko without the following compat_*()
|
||||
* historics.
|
||||
*/
|
||||
#define MARS_NEEDS_OLDCOMPAT_FUNCTIONS
|
||||
|
||||
extern int __oldcompat_symlink(
|
||||
const char __user *oldname,
|
||||
const char __user *newname,
|
||||
|
@ -101,13 +101,56 @@ const struct meta mars_dent_meta[] = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(mars_dent_meta);
|
||||
|
||||
// remove_this
|
||||
#ifndef MARS_HAS_PREPATCH
|
||||
/* This interfaces to vfs_unlink() for eventual removal for .deleted
|
||||
* and similar uses.
|
||||
*/
|
||||
int __mars_vfs_unlink(struct inode *parent_inode, struct dentry *dentry)
|
||||
{
|
||||
int error;
|
||||
|
||||
#ifdef FL_DELEG
|
||||
error = vfs_unlink(parent_inode, dentry, NULL);
|
||||
#else
|
||||
error = vfs_unlink(parent_inode, dentry);
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* The __oldcompat_*() functions are needed for the out-of-tree version
|
||||
* of MARS for adapdation to different kernel version.
|
||||
/* The __oldcompat_*() functions were originally needed for OLD out-of-tree
|
||||
* versions of MARS for adapdation to OLD kernel versions.
|
||||
* After some v4.xxx kernels, the out-of-tree compile did not
|
||||
* really work anymore.
|
||||
* Even some combinations of in-tree mars.ko with some (Frankenstein) kernels
|
||||
* were requiring this code.
|
||||
*
|
||||
* This crap should VANISH in the long term, by integration of MARS
|
||||
* into the upstream kernel.
|
||||
*
|
||||
* Since kernel v5.10 and later, it should be possible to compile (and run!)
|
||||
* even an out-of-tree mars.ko without the following compat_*()
|
||||
* historics.
|
||||
*/
|
||||
#if defined(MARS_HAS_PREPATCH) || \
|
||||
defined(MARS_HAS_PREPATCH_V2) || \
|
||||
(defined(MARS_HAS_PREPATCH_V3) && \
|
||||
!defined(MARS_HAS_PREPATCH_V3b) && \
|
||||
!defined(MARS_HAS_PREPATCH_V4) && \
|
||||
1)
|
||||
#define MARS_HAS_HISTORIC_PREPATCH
|
||||
#define MARS_NEEDS_OLDCOMPAT_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if !defined(MARS_HAS_PREPATCH) && \
|
||||
!defined(MARS_HAS_PREPATCH_V2) && \
|
||||
defined(MARS_HAS_PREPATCH_V3) && \
|
||||
defined(MARS_HAS_PREPATCH_V3b) && \
|
||||
1
|
||||
#define MARS_NEEDS_OLDCOMPAT_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#ifdef MARS_NEEDS_OLDCOMPAT_FUNCTIONS
|
||||
|
||||
#ifdef SB_FREEZE_LEVELS
|
||||
/* since kernel 3.6 */
|
||||
@ -502,8 +545,8 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif
|
||||
// end_remove_this
|
||||
#endif /* MARS_NEEDS_OLDCOMPAT_FUNCTIONS */
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// some helpers
|
||||
@ -654,8 +697,10 @@ int mars_unlink(const char *path)
|
||||
set_fs(KERNEL_DS);
|
||||
#ifdef MARS_HAS_PREPATCH
|
||||
status = sys_unlink(path);
|
||||
#else
|
||||
#elif defined(MARS_NEEDS_OLDCOMPAT_FUNCTIONS)
|
||||
status = __oldcompat_unlink(path);
|
||||
#else
|
||||
#error Build Error - check the sources and/or the pre-patch version
|
||||
#endif
|
||||
set_fs(oldfs);
|
||||
|
||||
@ -744,9 +789,11 @@ int mars_symlink(const char *oldpath, const char *newpath,
|
||||
memcpy(×[1], ×[0], sizeof(struct lamport_time));
|
||||
status = do_utimes(AT_FDCWD, tmp, times, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
#else
|
||||
#elif defined(MARS_NEEDS_OLDCOMPAT_FUNCTIONS)
|
||||
(void)__oldcompat_unlink(tmp);
|
||||
status = __oldcompat_symlink(oldpath, tmp, ×[0]);
|
||||
#else
|
||||
#error Build Error - check the sources and/or the pre-patch version
|
||||
#endif
|
||||
|
||||
if (status >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user