Page MenuHomeFreeBSD

D61901.1795412889.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61901.1795412889.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/mmu_notifier.h b/sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
--- a/sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
+++ b/sys/compat/linuxkpi/common/include/linux/mmu_notifier.h
@@ -1,6 +1,9 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c) 2017 Mark Johnston <markj@FreeBSD.org>
* All rights reserved.
+ * Copyright (c) 2026 The FreeBSD Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,7 +30,81 @@
#ifndef _LINUXKPI_LINUX_MMU_NOTIFIER_H_
#define _LINUXKPI_LINUX_MMU_NOTIFIER_H_
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+
+struct mm_struct;
+struct mmu_notifier;
+struct mmu_notifier_range;
+
+/*
+ * MMU notifiers are not implemented. Only enough of the interface is
+ * provided to manage the lifetime of a notifier: the release and
+ * invalidate callbacks are never called.
+ */
+struct mmu_notifier_ops {
+ void (*release)(struct mmu_notifier *, struct mm_struct *);
+ int (*invalidate_range_start)(struct mmu_notifier *,
+ const struct mmu_notifier_range *);
+ void (*invalidate_range_end)(struct mmu_notifier *,
+ const struct mmu_notifier_range *);
+ struct mmu_notifier *(*alloc_notifier)(struct mm_struct *);
+ void (*free_notifier)(struct mmu_notifier *);
+};
+
struct mmu_notifier {
+ const struct mmu_notifier_ops *ops;
+ struct mm_struct *mm;
};
+static inline int
+mmu_notifier_register(struct mmu_notifier *mn __unused,
+ struct mm_struct *mm __unused)
+{
+ pr_debug("%s: TODO\n", __func__);
+ return (-EINVAL);
+}
+
+static inline void
+mmu_notifier_unregister(struct mmu_notifier *mn __unused,
+ struct mm_struct *mm __unused)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
+/*
+ * Unlike on Linux, notifiers are not shared: every call allocates a new
+ * notifier using the alloc_notifier callback.
+ */
+static inline struct mmu_notifier *
+mmu_notifier_get(const struct mmu_notifier_ops *ops, struct mm_struct *mm)
+{
+ struct mmu_notifier *mn;
+
+ pr_debug("%s: TODO\n", __func__);
+ if (ops->alloc_notifier == NULL)
+ return (ERR_PTR(-EINVAL));
+ mn = ops->alloc_notifier(mm);
+ if (IS_ERR(mn))
+ return (mn);
+ mn->ops = ops;
+ mn->mm = mm;
+ return (mn);
+}
+
+static inline void
+mmu_notifier_put(struct mmu_notifier *mn)
+{
+ pr_debug("%s: TODO\n", __func__);
+ if (mn->ops->free_notifier != NULL)
+ mn->ops->free_notifier(mn);
+}
+
+static inline void
+mmu_notifier_synchronize(void)
+{
+ pr_debug("%s: TODO\n", __func__);
+}
+
#endif /* _LINUXKPI_LINUX_MMU_NOTIFIER_H_ */

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 5:48 AM (23 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41924097
Default Alt Text
D61901.1795412889.diff (2 KB)

Event Timeline