On 6/10/24 9:01 AM, Alan Somers wrote:
The branch main has been updated by asomers:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=edbd489d09babebdc6c03924a912013be584c409

commit edbd489d09babebdc6c03924a912013be584c409
Author:     Alan Somers <asom...@freebsd.org>
AuthorDate: 2024-06-06 19:14:43 +0000
Commit:     Alan Somers <asom...@freebsd.org>
CommitDate: 2024-06-10 16:01:25 +0000

     ctladm: don't require the use of "-p" with "port -r"
When removing a port, the ioctl frontend requires the "-p" argument.
     But other frontends, like cfiscsi, do not.  So don't require that
     argument in the ctladm command.  The frontend driver will report an
     error if any required argument is missing.

     MFC after:      2 weeks
     Sponsored by:   Axcient
     Reviewed by:    mav
     Pull Request:   https://github.com/freebsd/freebsd-src/pull/1279
---
  sys/cam/ctl/ctl_frontend_ioctl.c |  2 +-
  usr.sbin/ctladm/ctladm.8         |  3 +--
  usr.sbin/ctladm/ctladm.c         | 10 +++-------
  usr.sbin/ctladm/tests/port.sh    | 28 +++++++++++++++++++++++-----
  4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 14951797ddf1..46b7b88547dd 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -580,11 +580,6 @@ cctl_port(int fd, int argc, char **argv, char *combinedopt)
                break;
        }
        case CCTL_PORT_MODE_REMOVE:
-               if (targ_port == -1) {
-                       warnx("%s: -r requires -p", __func__);
-                       retval = 1;
-                       goto bailout;
-               }
                /* FALLTHROUGH */

Should we just remove the FALLTHOUGH now?

        case CCTL_PORT_MODE_CREATE: {
                bzero(&req, sizeof(req));
diff --git a/usr.sbin/ctladm/tests/port.sh b/usr.sbin/ctladm/tests/port.sh
index 1f2c9aaed5c1..139e1a7d29a0 100644
--- a/usr.sbin/ctladm/tests/port.sh
+++ b/usr.sbin/ctladm/tests/port.sh
@@ -37,8 +37,6 @@ cleanup() {
                        ;;
                "iscsi")
                        TARGET=`awk '/target:/ {print $2}' port-create.txt`
-                       # PORTNUM is ignored, but must be set
-                       PORTNUM=9999
                        ctladm port -r -d $driver -p "$PORTNUM" -O 
cfiscsi_portal_group_tag=$PGTAG -O cfiscsi_target=$TARGET

You still use PORTNUM here even though you don't define it?

                        ;;
                esac
--
John Baldwin


Reply via email to