Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144386279
D48939.id150828.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D48939.id150828.diff
View Options
diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5
--- a/usr.sbin/ctld/ctl.conf.5
+++ b/usr.sbin/ctld/ctl.conf.5
@@ -555,36 +555,34 @@
"iqn.2012-06.com.example:target0" {
alias = "Example target"
auth-group = no-authentication
- lun = [
- {
- number = 0
+ lun = {
+ 0 {
path = /dev/zvol/tank/example_0
blocksize = 4096
size = 4GB
}
- ]
+ }
}
"iqn.2012-06.com.example:target1" {
auth-group = ag0
portal-group = pg0
- lun = [
- { number = 0, name = example_1 },
- {
- number = 1
+ lun {
+ 0 = example_1
+ 1 {
path = /dev/zvol/tank/example_2
options {
vendor = "FreeBSD"
}
}
- ]
+ }
}
naa.50015178f369f092 {
port = isp0
- lun = [
- { number = 0, name = example_1 }
- ]
+ lun {
+ 0 = example_1
+ }
}
}
.Ed
diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c
--- a/usr.sbin/ctld/uclparse.c
+++ b/usr.sbin/ctld/uclparse.c
@@ -240,21 +240,39 @@
const ucl_object_t *num;
const ucl_object_t *name;
struct lun *lun;
+ const char *key;
+ char *end;
u_int id;
+ key = ucl_object_key(obj);
+ if (key != NULL) {
+ id = strtoul(key, &end, 0);
+ if (*end != '\0') {
+ log_warnx("lun key \"%s\" in target \"%s\" is invalid",
+ key, target->t_name);
+ return (false);
+ }
+
+ if (obj->type == UCL_STRING)
+ return (target_add_lun(target, id,
+ ucl_object_tostring(obj)));
+ }
+
if (obj->type != UCL_OBJECT) {
log_warnx("lun section entries in target \"%s\" must be objects",
target->t_name);
return (false);
}
- num = ucl_object_find_key(obj, "number");
- if (num == NULL || num->type != UCL_INT) {
- log_warnx("lun section in target \"%s\" is missing "
- "\"number\" integer property", target->t_name);
- return (false);
+ if (key == NULL) {
+ num = ucl_object_find_key(obj, "number");
+ if (num == NULL || num->type != UCL_INT) {
+ log_warnx("lun section in target \"%s\" is missing "
+ "\"number\" integer property", target->t_name);
+ return (false);
+ }
+ id = ucl_object_toint(num);
}
- id = ucl_object_toint(num);
name = ucl_object_find_key(obj, "name");
if (name == NULL) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 4:29 AM (14 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28537113
Default Alt Text
D48939.id150828.diff (2 KB)
Attached To
Mode
D48939: ctld: Permit simpler syntax for target LUNs in UCL
Attached
Detach File
Event Timeline
Log In to Comment