Sat Jul 29 11:58:53 2023 UTC ()
Sprinkle __inline to compat_100___kevent50_{fetch_changes,put_events}


(rin)
diff -r1.3 -r1.4 src/sys/compat/sys/event.h

cvs diff -r1.3 -r1.4 src/sys/compat/sys/event.h (expand / switch to unified diff)

--- src/sys/compat/sys/event.h 2023/07/28 18:19:01 1.3
+++ src/sys/compat/sys/event.h 2023/07/29 11:58:53 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: event.h,v 1.3 2023/07/28 18:19:01 christos Exp $ */ 1/* $NetBSD: event.h,v 1.4 2023/07/29 11:58:53 rin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> 4 * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,52 +53,52 @@ static __inline void @@ -53,52 +53,52 @@ static __inline void
53kevent100_to_kevent(const struct kevent100 *kev100, struct kevent *kev) 53kevent100_to_kevent(const struct kevent100 *kev100, struct kevent *kev)
54{ 54{
55 memset(kev, 0, sizeof(*kev)); 55 memset(kev, 0, sizeof(*kev));
56 memcpy(kev, kev100, sizeof(*kev100)); 56 memcpy(kev, kev100, sizeof(*kev100));
57} 57}
58 58
59static __inline void 59static __inline void
60kevent_to_kevent100(const struct kevent *kev, struct kevent100 *kev100) 60kevent_to_kevent100(const struct kevent *kev, struct kevent100 *kev100)
61{ 61{
62 memcpy(kev100, kev, sizeof(*kev100)); 62 memcpy(kev100, kev, sizeof(*kev100));
63} 63}
64 64
65#ifdef _KERNEL 65#ifdef _KERNEL
66static int 66static __inline int
67compat_100___kevent50_fetch_changes(void *ctx, const struct kevent *changelist, 67compat_100___kevent50_fetch_changes(void *ctx, const struct kevent *changelist,
68 struct kevent *changes, size_t index, int n) 68 struct kevent *changes, size_t index, int n)
69{ 69{
70 int error, i; 70 int error, i;
71 struct kevent100 *buf; 71 struct kevent100 *buf;
72 const size_t buf_size = sizeof(*buf) * n; 72 const size_t buf_size = sizeof(*buf) * n;
73 const struct kevent100 *changelist100 = (const struct kevent100 *)changelist; 73 const struct kevent100 *changelist100 = (const struct kevent100 *)changelist;
74 74
75 KASSERT(n >= 0); 75 KASSERT(n >= 0);
76 76
77 buf = kmem_alloc(buf_size, KM_SLEEP); 77 buf = kmem_alloc(buf_size, KM_SLEEP);
78 78
79 error = copyin(changelist100 + index, buf, buf_size); 79 error = copyin(changelist100 + index, buf, buf_size);
80 if (error != 0) 80 if (error != 0)
81 goto leave; 81 goto leave;
82 82
83 for (i = 0; i < n; i++) 83 for (i = 0; i < n; i++)
84 kevent100_to_kevent(buf + i, changes + i); 84 kevent100_to_kevent(buf + i, changes + i);
85 85
86leave: 86leave:
87 kmem_free(buf, buf_size); 87 kmem_free(buf, buf_size);
88 return error; 88 return error;
89} 89}
90 90
91static int 91static __inline int
92compat_100___kevent50_put_events(void *ctx, struct kevent *events, 92compat_100___kevent50_put_events(void *ctx, struct kevent *events,
93 struct kevent *eventlist, size_t index, int n) 93 struct kevent *eventlist, size_t index, int n)
94{ 94{
95 int error, i; 95 int error, i;
96 struct kevent100 *buf; 96 struct kevent100 *buf;
97 const size_t buf_size = sizeof(*buf) * n; 97 const size_t buf_size = sizeof(*buf) * n;
98 struct kevent100 *eventlist100 = (struct kevent100 *)eventlist; 98 struct kevent100 *eventlist100 = (struct kevent100 *)eventlist;
99 99
100 KASSERT(n >= 0); 100 KASSERT(n >= 0);
101 101
102 buf = kmem_alloc(buf_size, KM_SLEEP); 102 buf = kmem_alloc(buf_size, KM_SLEEP);
103 103
104 for (i = 0; i < n; i++) 104 for (i = 0; i < n; i++)