mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Use _Noreturn (C11; GNU89) properly
A function that returns with no value is a different thing from a
function that doesn't return at all. Those are two orthogonal
concepts, commonly confused.
pthread_create(3) expects a pointer to a start routine that has a
very precise prototype:
void *(*start_routine)(void *);
However, other thread functions, such as kernel ones, expect:
void (*start_routine)(void *);
Providing a different one is incorrect, and has only been working
because the ABIs happen to produce a compatible function.
We should use '_Noreturn void', since it's the natural type, and
then provide a '_Noreturn void *' wrapper for pthread functions.
For consistency, replace most cases of __NORETURN or
__attribute__((noreturn)) by _Noreturn. _Noreturn is understood
by -std=gnu89, so it should be safe to use everywhere.
Ref: https://github.com/openzfs/zfs/pull/13110#discussion_r808450136
Ref: https://software.codidact.com/posts/285972
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Closes #13120
This commit is contained in:
committed by
GitHub
parent
06b8050678
commit
db7f1a91de
@@ -834,7 +834,7 @@ vdev_trim_range_add(void *arg, uint64_t start, uint64_t size)
|
||||
* by its ms_allocatable. While a metaslab is undergoing trimming it is
|
||||
* not eligible for new allocations.
|
||||
*/
|
||||
static void
|
||||
static _Noreturn void
|
||||
vdev_trim_thread(void *arg)
|
||||
{
|
||||
vdev_t *vd = arg;
|
||||
@@ -1175,7 +1175,7 @@ vdev_trim_range_verify(void *arg, uint64_t start, uint64_t size)
|
||||
* N.B. This behavior is different from a manual TRIM where a thread
|
||||
* is created for each leaf vdev, instead of each top-level vdev.
|
||||
*/
|
||||
static void
|
||||
static _Noreturn void
|
||||
vdev_autotrim_thread(void *arg)
|
||||
{
|
||||
vdev_t *vd = arg;
|
||||
@@ -1514,7 +1514,7 @@ vdev_autotrim_restart(spa_t *spa)
|
||||
vdev_autotrim(spa);
|
||||
}
|
||||
|
||||
static void
|
||||
static _Noreturn void
|
||||
vdev_trim_l2arc_thread(void *arg)
|
||||
{
|
||||
vdev_t *vd = arg;
|
||||
|
||||
Reference in New Issue
Block a user