Lines Matching refs:info

313 	dfs_info_t info;
343 bzero(&info, sizeof (info));
345 (void) strlcpy(info.i_comment, cmnt, sizeof (info.i_comment));
346 info.i_state = DFS_VOLUME_STATE_OK | DFS_VOLUME_FLAVOR_STANDALONE;
347 info.i_timeout = DFS_ROOT_TIMEOUT;
348 info.i_propflags = 0;
351 uuid_unparse(uuid, info.i_guid);
355 info.i_ntargets = 1;
356 info.i_targets = &t;
358 if ((status = dfs_root_add(si.shr_path, &info)) != ERROR_SUCCESS) {
426 dfs_info_t info;
431 /* get flavor info from state info (info level 2) */
432 if (dfs_root_getinfo(rootdir, &info, 2) != ERROR_SUCCESS)
435 return (info.i_state & DFS_VOLUME_FLAVORS);
452 dfs_root_getinfo(const char *rootdir, dfs_info_t *info, uint32_t infolvl)
457 bzero(info, sizeof (dfs_info_t));
458 info->i_type = DFS_OBJECT_ROOT;
465 status = dfs_root_xread(xfd, info, infolvl);
477 * information level (infolvl) is valid in the passed DFS info structure
478 * 'info'.
481 dfs_root_setinfo(const char *rootdir, dfs_info_t *info, uint32_t infolvl)
500 status = dfs_modinfo(DFS_OBJECT_ROOT, &curinfo, info, infolvl);
553 dfs_info_t info;
569 status = dfs_link_getinfo(NULL, &info, DFS_INFO_ALL);
573 (void) strlcpy(info.i_comment, (cmnt) ? cmnt : "",
574 sizeof (info.i_comment));
584 status = dfs_link_getinfo(path, &info, DFS_INFO_ALL);
599 ntargets = info.i_ntargets;
600 if (dfs_target_find(info.i_targets, ntargets, server, share) != -1) {
601 dfs_info_free(&info);
606 t = realloc(info.i_targets, (ntargets + 1) * sizeof (dfs_target_t));
608 dfs_info_free(&info);
612 info.i_targets = t;
613 dfs_target_init(&info.i_targets[ntargets], server, share,
615 info.i_ntargets++;
617 status = dfs_link_commit(path, &info);
619 dfs_info_free(&info);
634 dfs_info_t info;
654 status = dfs_link_getinfo(path, &info, DFS_INFO_ALL);
659 idx = dfs_target_find(info.i_targets, info.i_ntargets, server, share);
661 bcopy(&info.i_targets[idx + 1], &info.i_targets[idx],
662 (info.i_ntargets - idx - 1) * sizeof (dfs_target_t));
663 info.i_ntargets--;
665 dfs_info_free(&info);
669 if (info.i_ntargets == 0) {
674 status = dfs_link_commit(path, &info);
677 dfs_info_free(&info);
685 * information level (infolvl) is valid in the passed DFS info structure
686 * 'info'.
689 dfs_link_setinfo(const char *path, dfs_info_t *info, uint32_t infolvl)
698 status = dfs_modinfo(DFS_OBJECT_LINK, &curinfo, info, infolvl);
707 * Gets the DFS link info.
716 dfs_link_getinfo(const char *path, dfs_info_t *info, uint32_t infolvl)
723 bzero(info, sizeof (dfs_info_t));
724 info->i_type = DFS_OBJECT_LINK;
727 info->i_state = DFS_VOLUME_STATE_OK;
728 info->i_timeout = DFS_LINK_TIMEOUT;
729 info->i_propflags = 0;
731 uuid_unparse(uuid, info->i_guid);
742 status = dfs_link_decode(info, link_data, infolvl);
808 dfs_cache_getinfo(dfs_nscnode_t *dn, dfs_info_t *info, uint32_t infolvl)
813 status = dfs_link_getinfo(dn->nsc_fspath, info, infolvl);
815 status = dfs_root_getinfo(dn->nsc_fspath, info, infolvl);
817 (void) strlcpy(info->i_uncpath, dn->nsc_uncpath,
818 sizeof (info->i_uncpath));
821 dfs_info_trace("dfs_cache_getinfo", info);
1006 * Free the allocated memory for targets in the given info
1010 dfs_info_free(dfs_info_t *info)
1012 if (info)
1013 free(info->i_targets);
1017 * Trace the given DFS info structure
1020 dfs_info_trace(const char *msg, dfs_info_t *info)
1026 if (info == NULL)
1029 smb_tracef("UNC\t%s", info->i_uncpath);
1030 smb_tracef("comment\t%s", info->i_comment);
1031 smb_tracef("GUID\t%s", info->i_guid);
1032 smb_tracef("state\t%X", info->i_state);
1033 smb_tracef("timeout\t%d", info->i_timeout);
1034 smb_tracef("props\t%X", info->i_propflags);
1035 smb_tracef("# targets\t%X", info->i_ntargets);
1037 if (info->i_targets == NULL)
1040 for (i = 0, t = info->i_targets; i < info->i_ntargets; i++, t++) {
1143 dfs_root_add(const char *rootdir, dfs_info_t *info)
1150 status = dfs_root_xwrite(xfd, info);
1182 syslog(LOG_DEBUG, "dfs: failed to remove root info %s (%d)",
1231 dfs_root_xwrite(int xfd, dfs_info_t *info)
1238 if ((status = dfs_root_encode(info, &buf, &buflen)) != ERROR_SUCCESS)
1253 dfs_root_xread(int xfd, dfs_info_t *info, uint32_t infolvl)
1266 status = dfs_root_decode(info, buf, statbuf.st_size, infolvl);
1275 * Encodes (packs) DFS information in 'info' into a flat
1281 dfs_root_encode(dfs_info_t *info, char **buf, size_t *bufsz)
1290 rc = nvlist_add_string(nvl, "comment", info->i_comment);
1291 rc |= nvlist_add_string(nvl, "guid", info->i_guid);
1292 rc |= nvlist_add_uint32(nvl, "state", info->i_state);
1293 rc |= nvlist_add_uint32(nvl, "timeout", info->i_timeout);
1294 rc |= nvlist_add_uint32(nvl, "propflags", info->i_propflags);
1295 t = info->i_targets;
1317 dfs_root_decode(dfs_info_t *info, char *buf, size_t bufsz, uint32_t infolvl)
1333 rc |= nvlist_lookup_uint32(nvl, "state", &info->i_state);
1334 rc |= nvlist_lookup_uint32(nvl, "timeout", &info->i_timeout);
1335 rc |= nvlist_lookup_uint32(nvl, "propflags", &info->i_propflags);
1342 (void) strlcpy(info->i_comment, (cmnt) ? cmnt : "",
1343 sizeof (info->i_comment));
1344 (void) strlcpy(info->i_guid, (guid) ? guid : "", sizeof (info->i_guid));
1346 info->i_targets = NULL;
1347 info->i_ntargets = 1;
1365 info->i_targets = malloc(sizeof (dfs_target_t));
1366 if (info->i_targets == NULL) {
1376 free(info->i_targets);
1379 dfs_target_init(info->i_targets, t_server, t_share, t_state);
1390 free(info->i_targets);
1393 info->i_targets->t_priority.p_class = t_priority_class;
1394 info->i_targets->t_priority.p_rank = t_priority_rank;
1432 * Decodes the link info from given string buffer (buf) into
1436 dfs_link_decode(dfs_info_t *info, char *buf, uint32_t infolvl)
1459 info->i_state = strtoul(lfield[i++], NULL, 10);
1460 info->i_propflags = strtoul(lfield[i++], NULL, 10);
1461 info->i_timeout = strtoul(lfield[i++], NULL, 10);
1462 (void) strlcpy(info->i_guid, lfield[i++], sizeof (info->i_guid));
1463 info->i_ntargets = strtoul(lfield[i++], NULL, 10);
1464 info->i_targets = NULL;
1468 if (cmntlen > sizeof (info->i_comment))
1469 cpylen = sizeof (info->i_comment);
1473 (void) strlcpy(info->i_comment, buf, cpylen);
1488 info->i_targets = calloc(info->i_ntargets, sizeof (dfs_target_t));
1489 if (info->i_targets == NULL)
1496 for (i = 0, t = info->i_targets; i < info->i_ntargets; i++, t++) {
1499 dfs_info_free(info);
1515 * Encodes given link information (info)
1518 dfs_link_encode(dfs_info_t *info, char *buf, size_t bufsz)
1529 DFS_LINK_V1, info->i_state, info->i_propflags, info->i_timeout,
1530 info->i_guid, info->i_ntargets,
1531 strlen(info->i_comment), info->i_comment);
1535 dfs_info_trace("DFS link encode", info);
1544 for (i = 0, t = info->i_targets; i < info->i_ntargets; i++, t++) {
1553 dfs_info_trace("DFS link encode", info);
1567 dfs_link_commit(const char *path, dfs_info_t *info)
1573 status = dfs_link_encode(info, linkdata, MAXREPARSELEN);
1784 * Validates the given state based on the object type (root/link), info
1883 * (info) for the given object.
1886 dfs_modinfo(uint32_t type, dfs_info_t *info, dfs_info_t *newinfo,
1895 target_idx = dfs_target_find(info->i_targets, info->i_ntargets,
1904 (void) strlcpy(info->i_comment, newinfo->i_comment,
1922 info->i_state = state;
1924 info->i_targets[target_idx].t_state = state;
1929 info->i_timeout = newinfo->i_timeout;
1933 info->i_propflags = newinfo->i_propflags;
1937 info->i_targets[target_idx].t_priority =
1951 (void) strlcpy(info->i_comment, newinfo->i_comment,
1954 info->i_state = newinfo->i_state;
1955 info->i_timeout = newinfo->i_timeout;
1956 info->i_propflags = newinfo->i_propflags;