Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144298507
D48939.id151230.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.id151230.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
@@ -233,28 +233,45 @@
{
const ucl_object_t *num;
const ucl_object_t *name;
+ 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, t_name);
+ return (false);
+ }
+
+ if (obj->type == UCL_STRING)
+ return (target_add_lun(id, ucl_object_tostring(obj)));
+ }
+
if (obj->type != UCL_OBJECT) {
log_warnx("lun section entries in target \"%s\" must be objects",
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", 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", t_name);
+ return (false);
+ }
+ id = ucl_object_toint(num);
}
- id = ucl_object_toint(num);
name = ucl_object_find_key(obj, "name");
if (name == NULL) {
if (!target_start_lun(id))
return (false);
- return (uclparse_lun_entries(ucl_object_tostring_forced(num),
- obj));
+ return (uclparse_lun_entries(key != NULL ? key :
+ ucl_object_tostring_forced(num), obj));
} else {
if (name->type != UCL_STRING) {
log_warnx("\"name\" property for lun %u for target "
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 5:27 PM (9 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28478475
Default Alt Text
D48939.id151230.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