Simplify.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-02-10 15:03:08 +00:00
parent d5874fc4f1
commit 5d386b72b1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261713

View File

@ -123,7 +123,7 @@ target_entry:
target_name: TARGET_NAME EQUALS STR
{
if (target->t_name != NULL)
errx(1, "duplicated TargetName at line %d", lineno + 1);
errx(1, "duplicated TargetName at line %d", lineno);
target->t_name = $3;
}
;
@ -131,7 +131,7 @@ target_name: TARGET_NAME EQUALS STR
target_address: TARGET_ADDRESS EQUALS STR
{
if (target->t_address != NULL)
errx(1, "duplicated TargetAddress at line %d", lineno + 1);
errx(1, "duplicated TargetAddress at line %d", lineno);
target->t_address = $3;
}
;
@ -139,7 +139,7 @@ target_address: TARGET_ADDRESS EQUALS STR
initiator_name: INITIATOR_NAME EQUALS STR
{
if (target->t_initiator_name != NULL)
errx(1, "duplicated InitiatorName at line %d", lineno + 1);
errx(1, "duplicated InitiatorName at line %d", lineno);
target->t_initiator_name = $3;
}
;
@ -147,7 +147,7 @@ initiator_name: INITIATOR_NAME EQUALS STR
initiator_address: INITIATOR_ADDRESS EQUALS STR
{
if (target->t_initiator_address != NULL)
errx(1, "duplicated InitiatorAddress at line %d", lineno + 1);
errx(1, "duplicated InitiatorAddress at line %d", lineno);
target->t_initiator_address = $3;
}
;
@ -155,7 +155,7 @@ initiator_address: INITIATOR_ADDRESS EQUALS STR
initiator_alias: INITIATOR_ALIAS EQUALS STR
{
if (target->t_initiator_alias != NULL)
errx(1, "duplicated InitiatorAlias at line %d", lineno + 1);
errx(1, "duplicated InitiatorAlias at line %d", lineno);
target->t_initiator_alias = $3;
}
;
@ -163,7 +163,7 @@ initiator_alias: INITIATOR_ALIAS EQUALS STR
user: USER EQUALS STR
{
if (target->t_user != NULL)
errx(1, "duplicated chapIName at line %d", lineno + 1);
errx(1, "duplicated chapIName at line %d", lineno);
target->t_user = $3;
}
;
@ -171,7 +171,7 @@ user: USER EQUALS STR
secret: SECRET EQUALS STR
{
if (target->t_secret != NULL)
errx(1, "duplicated chapSecret at line %d", lineno + 1);
errx(1, "duplicated chapSecret at line %d", lineno);
target->t_secret = $3;
}
;
@ -179,7 +179,7 @@ secret: SECRET EQUALS STR
mutual_user: MUTUAL_USER EQUALS STR
{
if (target->t_mutual_user != NULL)
errx(1, "duplicated tgtChapName at line %d", lineno + 1);
errx(1, "duplicated tgtChapName at line %d", lineno);
target->t_mutual_user = $3;
}
;
@ -187,7 +187,7 @@ mutual_user: MUTUAL_USER EQUALS STR
mutual_secret: MUTUAL_SECRET EQUALS STR
{
if (target->t_mutual_secret != NULL)
errx(1, "duplicated tgtChapSecret at line %d", lineno + 1);
errx(1, "duplicated tgtChapSecret at line %d", lineno);
target->t_mutual_secret = $3;
}
;
@ -195,76 +195,76 @@ mutual_secret: MUTUAL_SECRET EQUALS STR
auth_method: AUTH_METHOD EQUALS STR
{
if (target->t_auth_method != AUTH_METHOD_UNSPECIFIED)
errx(1, "duplicated AuthMethod at line %d", lineno + 1);
errx(1, "duplicated AuthMethod at line %d", lineno);
if (strcasecmp($3, "none") == 0)
target->t_auth_method = AUTH_METHOD_NONE;
else if (strcasecmp($3, "chap") == 0)
target->t_auth_method = AUTH_METHOD_CHAP;
else
errx(1, "invalid AuthMethod at line %d; "
"must be either \"none\" or \"CHAP\"", lineno + 1);
"must be either \"none\" or \"CHAP\"", lineno);
}
;
header_digest: HEADER_DIGEST EQUALS STR
{
if (target->t_header_digest != DIGEST_UNSPECIFIED)
errx(1, "duplicated HeaderDigest at line %d", lineno + 1);
errx(1, "duplicated HeaderDigest at line %d", lineno);
if (strcasecmp($3, "none") == 0)
target->t_header_digest = DIGEST_NONE;
else if (strcasecmp($3, "CRC32C") == 0)
target->t_header_digest = DIGEST_CRC32C;
else
errx(1, "invalid HeaderDigest at line %d; "
"must be either \"none\" or \"CRC32C\"", lineno + 1);
"must be either \"none\" or \"CRC32C\"", lineno);
}
;
data_digest: DATA_DIGEST EQUALS STR
{
if (target->t_data_digest != DIGEST_UNSPECIFIED)
errx(1, "duplicated DataDigest at line %d", lineno + 1);
errx(1, "duplicated DataDigest at line %d", lineno);
if (strcasecmp($3, "none") == 0)
target->t_data_digest = DIGEST_NONE;
else if (strcasecmp($3, "CRC32C") == 0)
target->t_data_digest = DIGEST_CRC32C;
else
errx(1, "invalid DataDigest at line %d; "
"must be either \"none\" or \"CRC32C\"", lineno + 1);
"must be either \"none\" or \"CRC32C\"", lineno);
}
;
session_type: SESSION_TYPE EQUALS STR
{
if (target->t_session_type != SESSION_TYPE_UNSPECIFIED)
errx(1, "duplicated SessionType at line %d", lineno + 1);
errx(1, "duplicated SessionType at line %d", lineno);
if (strcasecmp($3, "normal") == 0)
target->t_session_type = SESSION_TYPE_NORMAL;
else if (strcasecmp($3, "discovery") == 0)
target->t_session_type = SESSION_TYPE_DISCOVERY;
else
errx(1, "invalid SessionType at line %d; "
"must be either \"normal\" or \"discovery\"", lineno + 1);
"must be either \"normal\" or \"discovery\"", lineno);
}
;
protocol: PROTOCOL EQUALS STR
{
if (target->t_protocol != PROTOCOL_UNSPECIFIED)
errx(1, "duplicated protocol at line %d", lineno + 1);
errx(1, "duplicated protocol at line %d", lineno);
if (strcasecmp($3, "iscsi") == 0)
target->t_protocol = PROTOCOL_ISCSI;
else if (strcasecmp($3, "iser") == 0)
target->t_protocol = PROTOCOL_ISER;
else
errx(1, "invalid protocol at line %d; "
"must be either \"iscsi\" or \"iser\"", lineno + 1);
"must be either \"iscsi\" or \"iser\"", lineno);
}
;
ignored: IGNORED EQUALS STR
{
warnx("obsolete statement ignored at line %d", lineno + 1);
warnx("obsolete statement ignored at line %d", lineno);
}
;
@ -275,7 +275,7 @@ yyerror(const char *str)
{
errx(1, "error in configuration file at line %d near '%s': %s",
lineno + 1, yytext, str);
lineno, yytext, str);
}
static void
@ -318,7 +318,7 @@ conf_new_from_file(const char *path)
if (yyin == NULL)
err(1, "unable to open configuration file %s", path);
check_perms(path);
lineno = 0;
lineno = 1;
yyrestart(yyin);
error = yyparse();
assert(error == 0);