Lines Matching refs:sh

366 suri_parse_generic_uri(struct suri_handle *sh, suri_gen_uri_t *gen_uri)
372 assert(sh->sh_uri[0] != '\0');
373 assert(strlen(sh->sh_uri) < SURI_MAX_URI_LEN);
376 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
384 ret = regexec(&suri_re_uri, sh->sh_uri, 10, pm, 0);
387 pmatch_copy(gen_uri->sgu_scheme, sh->sh_uri, pm, 1);
389 pmatch_copy(gen_uri->sgu_authority, sh->sh_uri, pm, 3);
391 pmatch_copy(gen_uri->sgu_path, sh->sh_uri, pm, 5);
393 pmatch_copy(gen_uri->sgu_query, sh->sh_uri, pm, 6);
395 pmatch_copy(gen_uri->sgu_fragment, sh->sh_uri, pm, 8);
403 if (strchr(sh->sh_uri, ':') == NULL) {
404 suri_err_set_desc(sh, "%s",
409 ret = regexec(&suri_re_uri_scheme, sh->sh_uri, 0, NULL, 0);
414 if ((s = strdup(sh->sh_uri)) == NULL)
415 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
422 suri_err_set_desc(sh, "%s: \"%s\"",
430 suri_err_set_desc(sh, "%s", SURIGTEXT("Could not parse URI"));
435 suri_query_nonempty(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
438 suri_err_set_desc(sh, "%s: \"%s\"",
446 suri_fragment_nonempty(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
449 suri_err_set_desc(sh, "%s: \"%s\"",
457 suri_path_empty(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
460 suri_err_set_desc(sh, "%s", SURI_PARSER_EMPTY_PATH);
478 suri_get_uri_type(struct suri_handle *sh, suri_gen_uri_t *gen_uri)
486 assert(sh->sh_uri_type == SURI_TYPE_ANY);
488 ret = suri_parse_generic_uri(sh, gen_uri);
495 sh->sh_uri_type = SURI_TYPE_FILE;
497 sh->sh_uri_type = SURI_TYPE_LU;
499 sh->sh_uri_type = SURI_TYPE_ISCSI;
501 sh->sh_uri_type = SURI_TYPE_DEV;
503 if (sh->sh_uri_type == SURI_TYPE_ANY) {
504 suri_err_set_desc(sh, "%s: \"%s\"",
517 check_guid(struct suri_handle *sh, const char *name, const char *s)
526 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
539 suri_err_set_desc(sh, "%s \"%s\", %s \"%s\"",
545 suri_err_set_desc(sh, "%s \".naa\" %s \"%s\"",
553 suri_err_set_desc(sh, "%s \".<GUID>\" %s \"%s.naa\"",
564 suri_err_set_desc(sh, "<GUID> %s \"%s.naa.<GUID>\" %s: "
580 suri_file_dev_parse(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
588 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
590 if (sh->sh_uri_type == SURI_TYPE_FILE) {
591 path = (SURIH2FILE(sh))->sf_prop_path;
592 size = sizeof ((SURIH2FILE(sh))->sf_prop_path);
594 path = (SURIH2DEV(sh))->sd_prop_path;
595 size = sizeof ((SURIH2DEV(sh))->sd_prop_path);
601 suri_err_set_desc(sh, "%s: \"%s\"",
605 if (suri_query_nonempty(sh, gen_uri))
607 if (suri_fragment_nonempty(sh, gen_uri))
617 if (suri_path_empty(sh, gen_uri))
621 suri_err_set_desc(sh, "%s: \"%s\"",
631 suri_err_set_desc(sh, "%s: \"%s\"",
642 suri_err_set_desc(sh, "%s: \"%s\"",
651 if (sh->sh_uri_type == SURI_TYPE_FILE) {
653 suri_err_set_desc(sh, "%s: \"%s\"",
663 if ((sh->sh_uri_type == SURI_TYPE_DEV) &&
666 suri_err_set_desc(sh, "%s: \"%s\"", ERR_SURI_NOT_IN_SLASH_DEV,
679 suri_lu_parse(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
685 suri_lu_t *so_lu = SURIH2LU(sh);
691 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
694 suri_err_set_desc(sh, "%s: \"%s\"",
698 if (suri_query_nonempty(sh, gen_uri))
700 if (suri_fragment_nonempty(sh, gen_uri))
725 if (suri_path_empty(sh, gen_uri))
745 if ((ret = check_guid(sh, "initiator", part1)) != ESURI_OK)
748 if ((ret = check_guid(sh, "target", part2 + 1)) != ESURI_OK)
750 if ((ret = check_guid(sh, "luname", part3 + 1)) != ESURI_OK)
754 if ((ret = check_guid(sh, "luname", part1)) != ESURI_OK)
758 suri_err_set_desc(sh, "%s", "Incorrect syntax of LU URI");
767 suri_iscsi_parse(struct suri_handle *sh, const suri_gen_uri_t *gen_uri)
774 suri_iscsi_t *suri_iscsi = SURIH2ISCSI(sh);
778 return (suri_err_set_static_desc(sh, ESURI_NOMEM));
785 suri_err_set_desc(sh, "%s", SURI_PARSER_AUTHORITY);
788 if (suri_path_empty(sh, gen_uri) ||
789 suri_query_nonempty(sh, gen_uri) ||
790 suri_fragment_nonempty(sh, gen_uri)) {
826 suri_err_set_desc(sh, "%s",
830 suri_err_set_desc(sh, "%s: \"%s\"",
842 suri_err_set_desc(sh, "%s: \"%s\"",
850 suri_err_set_desc(sh,
873 suri_err_set_desc(sh, "%s: \"%s\"",
884 suri_err_set_desc(sh, "%s: \"%s\"",
904 suri_err_set_desc(sh, "%s: \"%d\"",
940 if ((ret = check_guid(sh, "luname", copy)) != ESURI_OK)
943 suri_err_set_desc(sh, "%s", "Incorrect syntax of iSCSI URI");