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

(cherry picked from commit 4a26b63145)
This commit is contained in:
Olivier Certner 2024-07-01 19:10:47 +02:00
parent 0635f5eeac
commit 63abb6a3b5
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
3 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -91,7 +91,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;

View file

@ -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);