Rename SIMPLEQ_* to STAILQ_* in /usr/src/share and /usr/src/regress Index: regress/usr.sbin/bgpd/unittests/rde_sets_test.c =================================================================== RCS file: /cvs/src/regress/usr.sbin/bgpd/unittests/rde_sets_test.c,v retrieving revision 1.7 diff -u -p -r1.7 rde_sets_test.c --- regress/usr.sbin/bgpd/unittests/rde_sets_test.c 17 Dec 2019 11:57:16 -0000 1.7 +++ regress/usr.sbin/bgpd/unittests/rde_sets_test.c 25 Dec 2020 16:40:36 -0000 @@ -54,7 +54,7 @@ main(int argc, char **argv) struct as_set *a, *aa, *b, *c, *empty; size_t i; - SIMPLEQ_INIT(&as_sets); + STAILQ_INIT(&as_sets); a = build_set("a", va, sizeof(va) / sizeof(va[0]), sizeof(va) / sizeof(va[0])); Index: share/man/man3/queue.3 =================================================================== RCS file: /cvs/src/share/man/man3/queue.3,v retrieving revision 1.67 diff -u -p -r1.67 queue.3 --- share/man/man3/queue.3 13 Jul 2020 01:28:10 -0000 1.67 +++ share/man/man3/queue.3 25 Dec 2020 16:40:36 -0000 @@ -62,21 +62,21 @@ .Nm LIST_INSERT_HEAD , .Nm LIST_REMOVE , .Nm LIST_REPLACE , -.Nm SIMPLEQ_ENTRY , -.Nm SIMPLEQ_HEAD , -.Nm SIMPLEQ_HEAD_INITIALIZER , -.Nm SIMPLEQ_FIRST , -.Nm SIMPLEQ_NEXT , -.Nm SIMPLEQ_EMPTY , -.Nm SIMPLEQ_FOREACH , -.Nm SIMPLEQ_FOREACH_SAFE , -.Nm SIMPLEQ_INIT , -.Nm SIMPLEQ_INSERT_AFTER , -.Nm SIMPLEQ_INSERT_HEAD , -.Nm SIMPLEQ_INSERT_TAIL , -.Nm SIMPLEQ_REMOVE_AFTER , -.Nm SIMPLEQ_REMOVE_HEAD , -.Nm SIMPLEQ_CONCAT , +.Nm STAILQ_ENTRY , +.Nm STAILQ_HEAD , +.Nm STAILQ_HEAD_INITIALIZER , +.Nm STAILQ_FIRST , +.Nm STAILQ_NEXT , +.Nm STAILQ_EMPTY , +.Nm STAILQ_FOREACH , +.Nm STAILQ_FOREACH_SAFE , +.Nm STAILQ_INIT , +.Nm STAILQ_INSERT_AFTER , +.Nm STAILQ_INSERT_HEAD , +.Nm STAILQ_INSERT_TAIL , +.Nm STAILQ_REMOVE_AFTER , +.Nm STAILQ_REMOVE_HEAD , +.Nm STAILQ_CONCAT , .Nm TAILQ_ENTRY , .Nm TAILQ_HEAD , .Nm TAILQ_HEAD_INITIALIZER , @@ -97,7 +97,7 @@ .Nm TAILQ_REMOVE , .Nm TAILQ_REPLACE , .Nm TAILQ_CONCAT -.Nd intrusive singly-linked and doubly-linked lists, simple queues, and tail queues +.Nd intrusive singly-linked and doubly-linked lists, singly-linked tail queues, and tail queues .Sh SYNOPSIS .In sys/queue.h .Pp @@ -149,30 +149,30 @@ .Ft void .Fn LIST_REPLACE "struct TYPE *elm" "struct TYPE *elm2" "FIELDNAME" .Pp -.Fn SIMPLEQ_ENTRY "TYPE" -.Fn SIMPLEQ_HEAD "HEADNAME" "TYPE" -.Fn SIMPLEQ_HEAD_INITIALIZER "SIMPLEQ_HEAD head" +.Fn STAILQ_ENTRY "TYPE" +.Fn STAILQ_HEAD "HEADNAME" "TYPE" +.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head" .Ft "struct TYPE *" -.Fn SIMPLEQ_FIRST "SIMPLEQ_HEAD *head" +.Fn STAILQ_FIRST "STAILQ_HEAD *head" .Ft "struct TYPE *" -.Fn SIMPLEQ_NEXT "struct TYPE *listelm" "FIELDNAME" +.Fn STAILQ_NEXT "struct TYPE *listelm" "FIELDNAME" .Ft int -.Fn SIMPLEQ_EMPTY "SIMPLEQ_HEAD *head" -.Fn SIMPLEQ_FOREACH "VARNAME" "SIMPLEQ_HEAD *head" "FIELDNAME" -.Fn SIMPLEQ_FOREACH_SAFE "VARNAME" "SIMPLEQ_HEAD *head" "FIELDNAME" "TEMP_VARNAME" +.Fn STAILQ_EMPTY "STAILQ_HEAD *head" +.Fn STAILQ_FOREACH "VARNAME" "STAILQ_HEAD *head" "FIELDNAME" +.Fn STAILQ_FOREACH_SAFE "VARNAME" "STAILQ_HEAD *head" "FIELDNAME" "TEMP_VARNAME" .Ft void -.Fn SIMPLEQ_INIT "SIMPLEQ_HEAD *head" +.Fn STAILQ_INIT "STAILQ_HEAD *head" .Ft void -.Fn SIMPLEQ_INSERT_AFTER "SIMPLEQ_HEAD *head" "struct TYPE *listelm" "struct TYPE *elm" "FIELDNAME" +.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "struct TYPE *listelm" "struct TYPE *elm" "FIELDNAME" .Ft void -.Fn SIMPLEQ_INSERT_HEAD "SIMPLEQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" +.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" .Ft void -.Fn SIMPLEQ_INSERT_TAIL "SIMPLEQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" +.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" .Ft void -.Fn SIMPLEQ_REMOVE_AFTER "SIMPLEQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" +.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "struct TYPE *elm" "FIELDNAME" .Ft void -.Fn SIMPLEQ_REMOVE_HEAD "SIMPLEQ_HEAD *head" "FIELDNAME" -.Fn SIMPLEQ_CONCAT "SIMPLEQ_HEAD *head1" "SIMPLEQ_HEAD *head2" +.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "FIELDNAME" +.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" .Pp .Fn TAILQ_ENTRY "TYPE" .Fn TAILQ_HEAD "HEADNAME" "TYPE" @@ -208,7 +208,7 @@ .Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "FIELDNAME" .Sh DESCRIPTION These macros define and operate on four types of data structures: -singly-linked lists, simple queues, lists, and tail queues. +singly-linked lists, singly-linked tail queues, lists, and tail queues. All four structures support the following functionality: .Pp .Bl -enum -compact -offset indent @@ -237,7 +237,7 @@ and support only the above functionality Singly-linked lists are ideal for applications with large datasets and few or no removals, or for implementing a LIFO queue. .Pp -Simple queues add the following functionality: +Singly-linked tail queues add the following functionality: .Pp .Bl -enum -compact -offset indent .It @@ -256,8 +256,8 @@ Code size is about 15% greater and opera than singly-linked lists. .El .Pp -Simple queues are ideal for applications with large datasets and -few or no removals, or for implementing a FIFO queue. +Singly-linked tail queues are ideal for applications with large datasets +and few or no removals, or for implementing a FIFO queue. .Pp All doubly linked types of data structures (lists and tail queues) additionally allow: @@ -312,7 +312,7 @@ All these lists and queues are intrusive defined structures containing a field of type .Li SLIST_ENTRY , .Li LIST_ENTRY , -.Li SIMPLEQ_ENTRY , +.Li STAILQ_ENTRY , or .Li TAILQ_ENTRY . In the macro definitions, @@ -333,7 +333,7 @@ is the name tag of a user defined struct using the macros .Fn SLIST_HEAD , .Fn LIST_HEAD , -.Fn SIMPLEQ_HEAD , +.Fn STAILQ_HEAD , or .Fn TAILQ_HEAD . See the examples below for further explanation of how these macros are used. @@ -622,20 +622,21 @@ while (!LIST_EMPTY(&head)) { /* Delete. free(n1); } .Ed -.Sh SIMPLE QUEUES -A simple queue is headed by a structure defined by the -.Fn SIMPLEQ_HEAD +.Sh SINGLY-LINKED TAIL QUEUES +A singly-linked tail queue is headed by a structure defined by the +.Fn STAILQ_HEAD macro. This structure contains a pair of pointers, one to the first element in the -simple queue and the other to the last element in the simple queue. +singly-linked tail queue and the other to the last element in the +singly-linked tail queue. The elements are singly linked. New elements can be added to the queue after an existing element, at the head of the queue or at the tail of the queue. A -.Fa SIMPLEQ_HEAD +.Fa STAILQ_HEAD structure is declared as follows: .Bd -literal -offset indent -SIMPLEQ_HEAD(HEADNAME, TYPE) head; +STAILQ_HEAD(HEADNAME, TYPE) head; .Ed .Pp where @@ -655,53 +656,53 @@ and are user selectable.) .Pp The -.Fn SIMPLEQ_ENTRY +.Fn STAILQ_ENTRY macro declares a structure that connects the elements in the queue. .Pp The -.Fn SIMPLEQ_INIT +.Fn STAILQ_INIT macro initializes the queue referenced by .Fa head . .Pp The queue can also be initialized statically by using the -.Fn SIMPLEQ_HEAD_INITIALIZER +.Fn STAILQ_HEAD_INITIALIZER macro like this: .Bd -literal -offset indent -SIMPLEQ_HEAD(HEADNAME, TYPE) head = SIMPLEQ_HEAD_INITIALIZER(head); +STAILQ_HEAD(HEADNAME, TYPE) head = STAILQ_HEAD_INITIALIZER(head); .Ed .Pp The -.Fn SIMPLEQ_INSERT_AFTER +.Fn STAILQ_INSERT_AFTER macro inserts the new element .Fa elm after the element .Fa listelm . .Pp The -.Fn SIMPLEQ_INSERT_HEAD +.Fn STAILQ_INSERT_HEAD macro inserts the new element .Fa elm at the head of the queue. .Pp The -.Fn SIMPLEQ_INSERT_TAIL +.Fn STAILQ_INSERT_TAIL macro inserts the new element .Fa elm at the end of the queue. .Pp The -.Fn SIMPLEQ_REMOVE_AFTER +.Fn STAILQ_REMOVE_AFTER macro removes the queue element immediately following .Fa elm . .Pp The -.Fn SIMPLEQ_REMOVE_HEAD +.Fn STAILQ_REMOVE_HEAD macro removes the first element from the queue. .Pp The -.Fn SIMPLEQ_CONCAT +.Fn STAILQ_CONCAT macro concatenates all the elements of the queue referenced by .Fa head2 to the end of the queue referenced by @@ -714,53 +715,53 @@ as it does not actually traverse .Fa head2 . .Pp The -.Fn SIMPLEQ_FIRST +.Fn STAILQ_FIRST and -.Fn SIMPLEQ_NEXT +.Fn STAILQ_NEXT macros can be used to traverse the queue. The -.Fn SIMPLEQ_FOREACH +.Fn STAILQ_FOREACH is used for queue traversal: .Bd -literal -offset indent -SIMPLEQ_FOREACH(np, head, FIELDNAME) +STAILQ_FOREACH(np, head, FIELDNAME) .Ed .Pp The macro -.Fn SIMPLEQ_FOREACH_SAFE +.Fn STAILQ_FOREACH_SAFE traverses the queue referenced by head in a forward direction, assigning each element in turn to var. However, unlike -.Fn SIMPLEQ_FOREACH +.Fn STAILQ_FOREACH it is permitted to remove var as well as free it from within the loop safely without interfering with the traversal. .Pp The -.Fn SIMPLEQ_EMPTY +.Fn STAILQ_EMPTY macro should be used to check whether a list is empty. -.Sh SIMPLE QUEUE EXAMPLE +.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE .Bd -literal -SIMPLEQ_HEAD(listhead, entry) head = SIMPLEQ_HEAD_INITIALIZER(head); +STAILQ_HEAD(listhead, entry) head = STAILQ_HEAD_INITIALIZER(head); struct entry { ... - SIMPLEQ_ENTRY(entry) entries; /* Simple queue. */ + STAILQ_ENTRY(entry) entries; /* Singly-linked tail queue. */ ... } *n1, *n2, *np; n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ -SIMPLEQ_INSERT_HEAD(&head, n1, entries); +STAILQ_INSERT_HEAD(&head, n1, entries); n2 = malloc(sizeof(struct entry)); /* Insert after. */ -SIMPLEQ_INSERT_AFTER(&head, n1, n2, entries); +STAILQ_INSERT_AFTER(&head, n1, n2, entries); n2 = malloc(sizeof(struct entry)); /* Insert at the tail. */ -SIMPLEQ_INSERT_TAIL(&head, n2, entries); +STAILQ_INSERT_TAIL(&head, n2, entries); /* Forward traversal. */ -SIMPLEQ_FOREACH(np, &head, entries) +STAILQ_FOREACH(np, &head, entries) np-> ... /* Delete. */ -while (!SIMPLEQ_EMPTY(&head)) { - n1 = SIMPLEQ_FIRST(&head); - SIMPLEQ_REMOVE_HEAD(&head, entries); +while (!STAILQ_EMPTY(&head)) { + n1 = STAILQ_FIRST(&head); + STAILQ_REMOVE_HEAD(&head, entries); free(n1); } .Ed @@ -949,7 +950,7 @@ An example of erroneous usage is removin The .Fn SLIST_END , .Fn LIST_END , -.Fn SIMPLEQ_END +.Fn STAILQ_END and .Fn TAILQ_END macros are deprecated; they provided symmetry with the historical Index: share/man/man9/fb_setup.9 =================================================================== RCS file: /cvs/src/share/man/man9/fb_setup.9,v retrieving revision 1.7 diff -u -p -r1.7 fb_setup.9 --- share/man/man9/fb_setup.9 30 Nov 2017 11:29:03 -0000 1.7 +++ share/man/man9/fb_setup.9 25 Dec 2020 16:40:36 -0000 @@ -35,7 +35,7 @@ #define FUSEBUFSIZE (sizeof(struct fusebuf)) struct fb_hdr { - SIMPLEQ_ENTRY(fusebuf) fh_next; + STAILQ_ENTRY(fusebuf) fh_next; size_t fh_len; int fh_err; int fh_type; @@ -102,7 +102,7 @@ The header contains the following elemen .Bl -tag -width foobarmoocow .It Fa fh_next A -.Xr SIMPLEQ_ENTRY 3 +.Xr STAILQ_ENTRY 3 needed to store the different fusebufs stored with .Fn fb_queue . .It Fa fh_len