git: 4a26b63145a5 - main - osd: Constify signature of osd_register()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Dec 2024 14:45:03 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=4a26b63145a5e18610aa9050262e3b4f75aa7117
commit 4a26b63145a5e18610aa9050262e3b4f75aa7117
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-07-01 17:10:47 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-12-16 14:42:20 +0000
osd: Constify signature of osd_register()
This makes it clear that 'methods' (if not NULL) points to an array that
won't be modified. Internally, this array is indeed copied into the
given OSD type's larger array of all methods for all slots.
Reviewed by: jamie
Approved by: markj (mentor)
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46886
---
share/man/man9/osd.9 | 4 ++--
sys/kern/kern_osd.c | 2 +-
sys/sys/osd.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/share/man/man9/osd.9 b/share/man/man9/osd.9
index 95547f5211c2..5e0e482914c3 100644
--- a/share/man/man9/osd.9
+++ b/share/man/man9/osd.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 26, 2016
+.Dd October 07, 2024
.Dt OSD 9
.Os
.Sh NAME
@@ -49,7 +49,7 @@
.Fo osd_register
.Fa "u_int type"
.Fa "osd_destructor_t destructor"
-.Fa "osd_method_t *methods"
+.Fa "const osd_method_t *methods"
.Fc
.Ft void
.Fo osd_deregister
diff --git a/sys/kern/kern_osd.c b/sys/kern/kern_osd.c
index dcd80a948ea7..93809ccab8e5 100644
--- a/sys/kern/kern_osd.c
+++ b/sys/kern/kern_osd.c
@@ -90,7 +90,7 @@ osd_default_destructor(void *value __unused)
}
int
-osd_register(u_int type, osd_destructor_t destructor, osd_method_t *methods)
+osd_register(u_int type, osd_destructor_t destructor, const osd_method_t *methods)
{
void *newptr;
u_int i, m;
diff --git a/sys/sys/osd.h b/sys/sys/osd.h
index 498cad5064f9..5d59ce5a3d9a 100644
--- a/sys/sys/osd.h
+++ b/sys/sys/osd.h
@@ -55,7 +55,7 @@ typedef void (*osd_destructor_t)(void *value);
typedef int (*osd_method_t)(void *obj, void *data);
int osd_register(u_int type, osd_destructor_t destructor,
- osd_method_t *methods);
+ const osd_method_t *methods);
void osd_deregister(u_int type, u_int slot);
int osd_set(u_int type, struct osd *osd, u_int slot, void *value);