Skip to contentSkip to conversation

cmdline: remove cmdline_poll()

PATCH Superseded Stephen Hemminger 3 participants 4 messages Jul 31, 2023 – Oct 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmdline: remove cmdline_poll()

The API functions cmdline_poll() was unused by any project, untested, and it was buggy. Remove it from 23.11 release.

---
 doc/guides/rel_notes/release_23_11.rst | 10 +---
 lib/cmdline/cmdline.c                  | 34 -------------
 lib/cmdline/cmdline.h                  | 16 ------
 lib/cmdline/cmdline_os_unix.c          | 12 -----
 lib/cmdline/cmdline_os_windows.c       | 68 --------------------------
 lib/cmdline/cmdline_private.h          |  3 --
 lib/cmdline/version.map                |  1 -
 7 files changed, 1 insertion(+), 143 deletions(-)
doc/guides/rel_notes/release_23_11.rst +1 -9
index 6b4dd21fd0e1..d4c123e5503b 100644
@@ -59,15 +59,7 @@ New Features
 Removed Items
 -------------
 
-.. This section should contain removed items in this release. Sample format:
-
-   * Add a short 1-2 sentence description of the removed item
-     in the past tense.
-
-   This section is a comment. Do not overwrite or remove it.
-   Also, make sure to start the actual text at the margin.
-   =======================================================
-
+* cmdline: Removed broken and unused function ``cmdline_poll``.
 
 API Changes
 -----------
lib/cmdline/cmdline.c +0 -34
index 355c7d8ca635..08721ee919be 100644
@@ -177,40 +177,6 @@ cmdline_quit(struct cmdline *cl)
 	rdline_quit(&cl->rdl);
 }
 
-int
-cmdline_poll(struct cmdline *cl)
-{
-	int status;
-	ssize_t read_status;
-	char c;
-
-	if (!cl)
-		return -EINVAL;
-	else if (cl->rdl.status == RDLINE_EXITED)
-		return RDLINE_EXITED;
-
-	status = cmdline_poll_char(cl);
-	if (status < 0)
-		return status;
-	else if (status > 0) {
-		c = -1;
-		read_status = cmdline_read_char(cl, &c);
-		if (read_status < 0)
-			return read_status;
-
-		if (read_status == 0) {
-			/* end of file is implicit quit */
-			cmdline_quit(cl);
-		} else {
-			status = cmdline_in(cl, &c, 1);
-			if (status < 0 && cl->rdl.status != RDLINE_EXITED)
-				return status;
-		}
-	}
-
-	return cl->rdl.status;
-}
-
 void
 cmdline_interact(struct cmdline *cl)
 {
lib/cmdline/cmdline.h +0 -16
index d631cd4bd459..992c84591456 100644
@@ -43,22 +43,6 @@ __rte_experimental
 struct rdline *
 cmdline_get_rdline(struct cmdline *cl);
 
-/**
- * @deprecated Function is broken and scheduled for removal.
- *
- * This function is nonblocking equivalent of ``cmdline_interact()``. It polls
- * *cl* for one character and interpret it. If return value is *RDLINE_EXITED*
- * it mean that ``cmdline_quit()`` was invoked.
- *
- * @param cl
- *   The command line object.
- *
- * @return
- *   On success return object status - one of *enum rdline_status*.
- *   On error return negative value.
- */
-__rte_deprecated
-int cmdline_poll(struct cmdline *cl);
 
 void cmdline_interact(struct cmdline *cl);
 void cmdline_quit(struct cmdline *cl);
lib/cmdline/cmdline_os_unix.c +0 -12
index 9a4ec4e33477..0365e73c115e 100644
@@ -28,18 +28,6 @@ terminal_restore(const struct cmdline *cl)
 	tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
 }
 
-int
-cmdline_poll_char(struct cmdline *cl)
-{
-	struct pollfd pfd;
-
-	pfd.fd = cl->s_in;
-	pfd.events = POLLIN;
-	pfd.revents = 0;
-
-	return poll(&pfd, 1, 0);
-}
-
 ssize_t
 cmdline_read_char(struct cmdline *cl, char *c)
 {
lib/cmdline/cmdline_os_windows.c +0 -68

74 lines not on this page · raw message

lib/cmdline/cmdline_private.h +0 -3
index 86a46cdea61a..b64f363903cd 100644
@@ -84,9 +84,6 @@ void terminal_adjust(struct cmdline *cl);
 /* Restore terminal settings form oldterm. */
 void terminal_restore(const struct cmdline *cl);
 
-/* Check if a single character can be read from input. */
-int cmdline_poll_char(struct cmdline *cl);
-
 /* Read one character from input. */
 ssize_t cmdline_read_char(struct cmdline *cl, char *c);
 
lib/cmdline/version.map +0 -1
index db4d904ffbdb..97166789016c 100644
@@ -40,7 +40,6 @@ DPDK_24 {
 	cmdline_parse_num;
 	cmdline_parse_portlist;
 	cmdline_parse_string;
-	cmdline_poll;
 	cmdline_printf;
 	cmdline_quit;
 	cmdline_set_prompt;
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Stephen Hemminger

The API functions cmdline_poll() was unused by any project, untested, and it was buggy. Remove it from 23.11 release.

Quoted 10 lines
---
 doc/guides/rel_notes/release_23_11.rst | 10 +---
 lib/cmdline/cmdline.c                  | 34 -------------
 lib/cmdline/cmdline.h                  | 16 ------
 lib/cmdline/cmdline_os_unix.c          | 12 -----
 lib/cmdline/cmdline_os_windows.c       | 68 --------------------------
 lib/cmdline/cmdline_private.h          |  3 --
 lib/cmdline/version.map                |  1 -
 7 files changed, 1 insertion(+), 143 deletions(-)

with one comment below

Quoted 7 lines
doc/guides/rel_notes/release_23_11.rst +0 -0
index 6b4dd21fd0e1..d4c123e5503b 100644
@@ -59,15 +59,7 @@ New Features
 Removed Items
 -------------

doc/guides/rel_notes/release_23_11.rst New Features · line 70

Quoted 10 lines
doc/guides/rel_notes/release_23_11.rst +0 -9
 
-.. This section should contain removed items in this release. Sample format:
-
-   * Add a short 1-2 sentence description of the removed item
-     in the past tense.
-
-   This section is a comment. Do not overwrite or remove it.
-   Also, make sure to start the actual text at the margin.
-   =======================================================
-

I believe we keep this boilerplate in place until the finalization of the release. We want to ensure the instructions are read by all who are editing this file.

#2 lore raw

PATCH v2 1/1 cmdline: remove cmdline_poll()

In reply to Stephen Hemminger

The API functions cmdline_poll() was unused by any project, untested, and buggy. Remove it from 23.11 release.

---
 doc/guides/rel_notes/release_23_11.rst |  1 +
 lib/cmdline/cmdline.c                  | 34 -------------
 lib/cmdline/cmdline.h                  | 16 ------
 lib/cmdline/cmdline_os_unix.c          | 12 -----
 lib/cmdline/cmdline_os_windows.c       | 68 --------------------------
 lib/cmdline/cmdline_private.h          |  3 --
 lib/cmdline/version.map                |  1 -
 7 files changed, 1 insertion(+), 134 deletions(-)
doc/guides/rel_notes/release_23_11.rst +1 -0
index 6b4dd21fd0e1..0e206219a83e 100644
@@ -68,6 +68,7 @@ Removed Items
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* cmdline: Removed broken and unused function ``cmdline_poll``.
 
 API Changes
 -----------
lib/cmdline/cmdline.c +0 -34
index 355c7d8ca635..08721ee919be 100644
@@ -177,40 +177,6 @@ cmdline_quit(struct cmdline *cl)
 	rdline_quit(&cl->rdl);
 }
 
-int
-cmdline_poll(struct cmdline *cl)
-{
-	int status;
-	ssize_t read_status;
-	char c;
-
-	if (!cl)
-		return -EINVAL;
-	else if (cl->rdl.status == RDLINE_EXITED)
-		return RDLINE_EXITED;
-
-	status = cmdline_poll_char(cl);
-	if (status < 0)
-		return status;
-	else if (status > 0) {
-		c = -1;
-		read_status = cmdline_read_char(cl, &c);
-		if (read_status < 0)
-			return read_status;
-
-		if (read_status == 0) {
-			/* end of file is implicit quit */
-			cmdline_quit(cl);
-		} else {
-			status = cmdline_in(cl, &c, 1);
-			if (status < 0 && cl->rdl.status != RDLINE_EXITED)
-				return status;
-		}
-	}
-
-	return cl->rdl.status;
-}
-
 void
 cmdline_interact(struct cmdline *cl)
 {
lib/cmdline/cmdline.h +0 -16
index d631cd4bd459..992c84591456 100644
@@ -43,22 +43,6 @@ __rte_experimental
 struct rdline *
 cmdline_get_rdline(struct cmdline *cl);
 
-/**
- * @deprecated Function is broken and scheduled for removal.
- *
- * This function is nonblocking equivalent of ``cmdline_interact()``. It polls
- * *cl* for one character and interpret it. If return value is *RDLINE_EXITED*
- * it mean that ``cmdline_quit()`` was invoked.
- *
- * @param cl
- *   The command line object.
- *
- * @return
- *   On success return object status - one of *enum rdline_status*.
- *   On error return negative value.
- */
-__rte_deprecated
-int cmdline_poll(struct cmdline *cl);
 
 void cmdline_interact(struct cmdline *cl);
 void cmdline_quit(struct cmdline *cl);
lib/cmdline/cmdline_os_unix.c +0 -12
index 9a4ec4e33477..0365e73c115e 100644
@@ -28,18 +28,6 @@ terminal_restore(const struct cmdline *cl)
 	tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
 }
 
-int
-cmdline_poll_char(struct cmdline *cl)
-{
-	struct pollfd pfd;
-
-	pfd.fd = cl->s_in;
-	pfd.events = POLLIN;
-	pfd.revents = 0;
-
-	return poll(&pfd, 1, 0);
-}
-
 ssize_t
 cmdline_read_char(struct cmdline *cl, char *c)
 {
lib/cmdline/cmdline_os_windows.c +0 -68

74 lines not on this page · raw message

lib/cmdline/cmdline_private.h +0 -3
index 86a46cdea61a..b64f363903cd 100644
@@ -84,9 +84,6 @@ void terminal_adjust(struct cmdline *cl);
 /* Restore terminal settings form oldterm. */
 void terminal_restore(const struct cmdline *cl);
 
-/* Check if a single character can be read from input. */
-int cmdline_poll_char(struct cmdline *cl);
-
 /* Read one character from input. */
 ssize_t cmdline_read_char(struct cmdline *cl, char *c);
 
lib/cmdline/version.map +0 -1
index db4d904ffbdb..97166789016c 100644
@@ -40,7 +40,6 @@ DPDK_24 {
 	cmdline_parse_num;
 	cmdline_parse_portlist;
 	cmdline_parse_string;
-	cmdline_poll;
 	cmdline_printf;
 	cmdline_quit;
 	cmdline_set_prompt;
Signature · 1 line
2.39.2