Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Feb 2025 15:15:51 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 67940b204f58 - main - ctld: Add missing properties to the UCL parser
Message-ID:  <202502261515.51QFFpZH034021@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit 67940b204f5829a72e7c47f92069fb06a7dad91f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-02-26 15:12:25 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-02-26 15:12:25 +0000

    ctld: Add missing properties to the UCL parser
    
    - Support for "foreign", "offload", and "tag" properties in portal
      group contexts.
    
    - Support for "ctl-lun" and "device-type" properties in LUN contexts.
    
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D48936
---
 usr.sbin/ctld/uclparse.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c
index e8e026247b71..7c786afb1e93 100644
--- a/usr.sbin/ctld/uclparse.c
+++ b/usr.sbin/ctld/uclparse.c
@@ -634,6 +634,10 @@ uclparse_portal_group(const char *name, const ucl_object_t *top)
 				goto fail;
 		}
 
+		if (strcmp(key, "foreign") == 0) {
+			portal_group_set_foreign();
+		}
+
 		if (strcmp(key, "listen") == 0) {
 			if (obj->type == UCL_STRING) {
 				if (!portal_group_add_listen(
@@ -676,6 +680,18 @@ uclparse_portal_group(const char *name, const ucl_object_t *top)
 			}
 		}
 
+		if (strcmp(key, "offload") == 0) {
+			if (obj->type != UCL_STRING) {
+				log_warnx("\"offload\" property of "
+				    "portal-group \"%s\" is not a string",
+				    name);
+				goto fail;
+			}
+
+			if (!portal_group_set_offload(ucl_object_tostring(obj)))
+				goto fail;
+		}
+
 		if (strcmp(key, "redirect") == 0) {
 			if (obj->type != UCL_STRING) {
 				log_warnx("\"listen\" property of "
@@ -705,6 +721,17 @@ uclparse_portal_group(const char *name, const ucl_object_t *top)
 			}
 		}
 
+		if (strcmp(key, "tag") == 0) {
+			if (obj->type != UCL_INT) {
+				log_warnx("\"tag\" property of portal group "
+				    "\"%s\" is not an integer",
+				    name);
+				goto fail;
+			}
+
+			portal_group_set_tag(ucl_object_toint(obj));
+		}
+
 		if (strcmp(key, "dscp") == 0) {
 			if (!uclparse_dscp("portal", name, obj))
 				goto fail;
@@ -946,6 +973,28 @@ uclparse_lun(const char *name, const ucl_object_t *top)
 				goto fail;
 		}
 
+		if (strcmp(key, "device-type") == 0) {
+			if (obj->type != UCL_STRING) {
+				log_warnx("\"device-type\" property of lun "
+				    "\"%s\" is not an integer", name);
+				goto fail;
+			}
+
+			if (!lun_set_device_type(ucl_object_tostring(obj)))
+				goto fail;
+		}
+
+		if (strcmp(key, "ctl-lun") == 0) {
+			if (obj->type != UCL_INT) {
+				log_warnx("\"ctl-lun\" property of lun "
+				    "\"%s\" is not an integer", name);
+				goto fail;
+			}
+
+			if (!lun_set_ctl_lun(ucl_object_toint(obj)))
+				goto fail;
+		}
+
 		if (strcmp(key, "options") == 0) {
 			if (obj->type != UCL_OBJECT) {
 				log_warnx("\"options\" property of lun "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502261515.51QFFpZH034021>