aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ctld/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ctld/parse.y')
-rw-r--r--usr.sbin/ctld/parse.y53
1 files changed, 51 insertions, 2 deletions
diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y
index 677b5d5a237ac..03a511f61326c 100644
--- a/usr.sbin/ctld/parse.y
+++ b/usr.sbin/ctld/parse.y
@@ -57,8 +57,8 @@ extern void yyrestart(FILE *);
%}
%token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL
-%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER
-%token FOREIGN
+%token CLOSING_BRACKET CTL_LUN DEBUG DEVICE_ID DEVICE_TYPE
+%token DISCOVERY_AUTH_GROUP DISCOVERY_FILTER FOREIGN
%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT
%token LISTEN LISTEN_ISER LUN MAXPROC OFFLOAD OPENING_BRACKET OPTION
%token PATH PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR
@@ -855,6 +855,10 @@ lun_entry:
|
lun_device_id
|
+ lun_device_type
+ |
+ lun_ctl_lun
+ |
lun_option
|
lun_path
@@ -912,6 +916,51 @@ lun_device_id: DEVICE_ID STR
}
;
+lun_device_type: DEVICE_TYPE STR
+ {
+ uint64_t tmp;
+
+ if (strcasecmp($2, "disk") == 0 ||
+ strcasecmp($2, "direct") == 0)
+ tmp = 0;
+ else if (strcasecmp($2, "processor") == 0)
+ tmp = 3;
+ else if (strcasecmp($2, "cd") == 0 ||
+ strcasecmp($2, "cdrom") == 0 ||
+ strcasecmp($2, "dvd") == 0 ||
+ strcasecmp($2, "dvdrom") == 0)
+ tmp = 5;
+ else if (expand_number($2, &tmp) != 0 ||
+ tmp > 15) {
+ yyerror("invalid numeric value");
+ free($2);
+ return (1);
+ }
+
+ lun_set_device_type(lun, tmp);
+ }
+ ;
+
+lun_ctl_lun: CTL_LUN STR
+ {
+ uint64_t tmp;
+
+ if (expand_number($2, &tmp) != 0) {
+ yyerror("invalid numeric value");
+ free($2);
+ return (1);
+ }
+
+ if (lun->l_ctl_lun >= 0) {
+ log_warnx("ctl_lun for lun \"%s\" "
+ "specified more than once",
+ lun->l_name);
+ return (1);
+ }
+ lun_set_ctl_lun(lun, tmp);
+ }
+ ;
+
lun_option: OPTION STR STR
{
struct lun_option *clo;