This change adds additional, libucl-based configuration file parser to ctld. Parsing ctl.conf (or configuration file specified with -f) as an UCL file is enabled using -u command-line switch.
Details
Details
Example config file (which is actually in JSON format, fully compatible with UCL):
{
"target": {
"naa.5000c50006815e48": {
"port": "camsim",
"lun": [
{
"number": 0,
"name": "disk1"
},
{
"number": 1,
"name": "disk3"
},
{
"number": 2,
"name": "disk4"
}
]
}
},
"lun": {
"disk1": {
"serial": "00505625139600",
"blocksize": 512,
"options": {
"removable": "on",
"product": "Virtual Disk",
"vendor": "FreeNAS",
"device-id": "Virtual Disk 00505625139600",
"rpm": "7200",
"naa": "0x6589cfc000000572122b119a12bbdac3"
},
"path": "/var/db/system/simulator/disk1"
},
"disk3": {
"serial": "00505625139600",
"blocksize": 512,
"options": {
"removable": "on",
"product": "Virtual Disk",
"vendor": "FreeNAS",
"device-id": "Virtual Disk 00505625139600",
"rpm": "7200",
"naa": "0x6589cfc000000446222150ce63317d41"
},
"path": "/var/db/system/simulator/disk3"
},
"disk4": {
"serial": "00505625139600",
"blocksize": 512,
"options": {
"removable": "on",
"product": "Virtual Disk",
"vendor": "FreeNAS",
"device-id": "Virtual Disk 00505625139600",
"rpm": "7200",
"naa": "0x6589cfc000000e7f80ec91885d4d80b9"
},
"path": "/var/db/system/simulator/disk4"
},
"disk2": {
"serial": "00505625139600",
"blocksize": 512,
"options": {
"removable": "on",
"product": "Virtual Disk",
"vendor": "FreeNAS",
"device-id": "Virtual Disk 00505625139600",
"rpm": "7200",
"naa": "0x6589cfc000000ee13371ddb41ec93d01"
},
"path": "/var/db/system/simulator/disk2"
}
}
}Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
| usr.sbin/ctld/Makefile | ||
|---|---|---|
| 5 ↗ | (On Diff #11185) | This kind of looks like like it should be handled by LIBADD=ucl. Isn't it? |
| usr.sbin/ctld/ctld.c | ||
| 2553 ↗ | (On Diff #11185) | I liked the old order, ie check_perms after parse_conf/uclparse_conf. This way you would get an user-friendly error with path, if the configuration file doesn't exist. |
| 2556 ↗ | (On Diff #11185) | style(9) - superfluous "{}" bracees. |
| usr.sbin/ctld/uclparse.c | ||
| 227 ↗ | (On Diff #11185) | s/parse_toplevel/uclparse_toplevel/ ? |
| 471 ↗ | (On Diff #11185) | Empty line. |
| 659 ↗ | (On Diff #11185) | Unneeded braces. |
| 692 ↗ | (On Diff #11185) | Braces. |