From 44e4372f3f47bb990406379b79460a2b13783f81 Mon Sep 17 00:00:00 2001 From: ozaki-r Date: Thu, 7 Jul 2016 06:56:24 +0000 Subject: [PATCH] Constify some arguments of pslist(9) functions By doing so, callers don't need to discard const qualifier. --- share/man/man9/pslist.9 | 16 ++++++++-------- sys/sys/pslist.h | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/share/man/man9/pslist.9 b/share/man/man9/pslist.9 index 348205949ef4..5ad6298b27e5 100644 --- a/share/man/man9/pslist.9 +++ b/share/man/man9/pslist.9 @@ -1,4 +1,4 @@ -.\" $NetBSD: pslist.9,v 1.16 2016/04/27 06:57:24 ozaki-r Exp $ +.\" $NetBSD: pslist.9,v 1.17 2016/07/07 06:56:24 ozaki-r Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 27, 2016 +.Dd July 7, 2016 .Dt PSLIST 9 .Os .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -58,16 +58,16 @@ .Ft void .Fn PSLIST_WRITER_REMOVE "TYPE *element" "PSLIST_ENTRY NAME" .Ft TYPE * -.Fn PSLIST_WRITER_FIRST "struct pslist *head" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_WRITER_FIRST "const struct pslist *head" "TYPE" "PSLIST_ENTRY NAME" .Ft TYPE * -.Fn PSLIST_WRITER_NEXT "TYPE *element" "TYPE" "PSLIST_ENTRY NAME" -.Fn PSLIST_WRITER_FOREACH "TYPE *element" "struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_WRITER_NEXT "const TYPE *element" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_WRITER_FOREACH "const TYPE *element" "const struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME" .\" Reader operations .Ft TYPE * -.Fn PSLIST_READER_FIRST "struct pslist *head" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_READER_FIRST "const struct pslist *head" "TYPE" "PSLIST_ENTRY NAME" .Ft TYPE * -.Fn PSLIST_READER_NEXT "TYPE *element" "TYPE" "PSLIST_ENTRY NAME" -.Fn PSLIST_READER_FOREACH "TYPE *element" "struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_READER_NEXT "const TYPE *element" "TYPE" "PSLIST_ENTRY NAME" +.Fn PSLIST_READER_FOREACH "const TYPE *element" "const struct pslist_head *head" "TYPE" "PSLIST_ENTRY NAME" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh DESCRIPTION The diff --git a/sys/sys/pslist.h b/sys/sys/pslist.h index 94462d5765cc..47e77f572d10 100644 --- a/sys/sys/pslist.h +++ b/sys/sys/pslist.h @@ -1,4 +1,4 @@ -/* $NetBSD: pslist.h,v 1.2 2016/04/11 03:46:37 riastradh Exp $ */ +/* $NetBSD: pslist.h,v 1.3 2016/07/07 06:56:25 ozaki-r Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -178,14 +178,14 @@ pslist_writer_remove(struct pslist_entry *entry) } static inline struct pslist_entry * -pslist_writer_first(struct pslist_head *head) +pslist_writer_first(const struct pslist_head *head) { return head->plh_first; } static inline struct pslist_entry * -pslist_writer_next(struct pslist_entry *entry) +pslist_writer_next(const struct pslist_entry *entry) { _PSLIST_ASSERT(entry->ple_next != _PSLIST_POISON); @@ -193,7 +193,8 @@ pslist_writer_next(struct pslist_entry *entry) } static inline void * -_pslist_writer_first_container(struct pslist_head *head, ptrdiff_t offset) +_pslist_writer_first_container(const struct pslist_head *head, + const ptrdiff_t offset) { struct pslist_entry *first = head->plh_first; @@ -201,7 +202,8 @@ _pslist_writer_first_container(struct pslist_head *head, ptrdiff_t offset) } static inline void * -_pslist_writer_next_container(struct pslist_entry *entry, ptrdiff_t offset) +_pslist_writer_next_container(const struct pslist_entry *entry, + const ptrdiff_t offset) { struct pslist_entry *next = entry->ple_next; @@ -217,7 +219,7 @@ _pslist_writer_next_container(struct pslist_entry *entry, ptrdiff_t offset) */ static inline struct pslist_entry * -pslist_reader_first(struct pslist_head *head) +pslist_reader_first(const struct pslist_head *head) { struct pslist_entry *first = head->plh_first; @@ -228,7 +230,7 @@ pslist_reader_first(struct pslist_head *head) } static inline struct pslist_entry * -pslist_reader_next(struct pslist_entry *entry) +pslist_reader_next(const struct pslist_entry *entry) { struct pslist_entry *next = entry->ple_next; @@ -240,7 +242,8 @@ pslist_reader_next(struct pslist_entry *entry) } static inline void * -_pslist_reader_first_container(struct pslist_head *head, ptrdiff_t offset) +_pslist_reader_first_container(const struct pslist_head *head, + const ptrdiff_t offset) { struct pslist_entry *first = head->plh_first; @@ -252,7 +255,8 @@ _pslist_reader_first_container(struct pslist_head *head, ptrdiff_t offset) } static inline void * -_pslist_reader_next_container(struct pslist_entry *entry, ptrdiff_t offset) +_pslist_reader_next_container(const struct pslist_entry *entry, + const ptrdiff_t offset) { struct pslist_entry *next = entry->ple_next;