Esempio n. 1
0
static int
textfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{	
	struct map_rect_priv *mr=priv_data;
	char *str=NULL;
	dbg(1,"textfile_attr_get mr=%p attrs='%s' ", mr, mr->attrs);
	if (attr_type != mr->attr_last) {
		dbg(1,"reset attr_pos\n");
		mr->attr_pos=0;
		mr->attr_last=attr_type;
	}
	if (attr_type == attr_any) {
		dbg(1,"attr_any");
		if (get_tag(mr->attrs,NULL,&mr->attr_pos,mr->attr, mr->attr_name)) {
			attr_type=attr_from_name(mr->attr_name);
			dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type);
			attr->type=attr_type;
			textfile_encode_attr(mr->attr, attr_type, attr);
			return 1;
		}
	} else {
		str=attr_to_name(attr_type);
		dbg(1,"attr='%s' ",str);
		if (get_tag(mr->attrs,str,&mr->attr_pos,mr->attr, NULL)) {
			textfile_encode_attr(mr->attr, attr_type, attr);
			dbg(1,"found\n");
			return 1;
		}
	}
	dbg(1,"not found\n");
	return 0;
}
Esempio n. 2
0
static int
vehicle_demo_set_attr_do(struct vehicle_priv *priv, struct attr *attr)
{
	switch(attr->type) {
	case attr_navit:
		priv->navit = attr->u.navit;
		break;
	case attr_route:
		priv->route = attr->u.route;
		break;
	case attr_speed:
		priv->config_speed=attr->u.num;
		break;
	case attr_interval:
		priv->interval=attr->u.num;
		if (priv->timer)
			event_remove_timeout(priv->timer);
		priv->timer=event_add_timeout(priv->interval, 1, priv->timer_callback);
		break;
	case attr_position_coord_geo:
		priv->geo=*(attr->u.coord_geo);
		priv->position_set=1;
		dbg(1,"position_set %f %f\n", priv->geo.lat, priv->geo.lng);
		break;
	case attr_profilename:
	case attr_source:
	case attr_name:
		// Ignore; used by Navit's infrastructure, but not relevant for this vehicle.
		break;
	default:
		dbg(0,"unsupported attribute %s\n",attr_to_name(attr->type));
		return 0;
	}
	return 1;
}
Esempio n. 3
0
static int
search_list_level(enum attr_type attr_type)
{
	switch(attr_type) {
	case attr_country_all:
	case attr_country_id:
	case attr_country_iso2:
	case attr_country_iso3:
	case attr_country_car:
	case attr_country_name:
		return 0;
	case attr_town_postal:
		return 1;
	case attr_town_name:
	case attr_district_name:
	case attr_town_or_district_name:
		return 1;
	case attr_street_name:
		return 2;
	case attr_house_number:
		return 3;
	case attr_postal:
		return -1;
	default:
		dbg(0,"unknown search '%s'\n",attr_to_name(attr_type));
		return -1;
	}
}
Esempio n. 4
0
static void
vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr)
{
	dbg(1,"%s:%d\n", attr_to_name(attr->type), attr->u.num);
	switch (attr->type) {
	case attr_flags:
		this_->flags=attr->u.num;
		break;
	case attr_flags_forward_mask:
		this_->flags_forward_mask=attr->u.num;
		break;
	case attr_flags_reverse_mask:
		this_->flags_reverse_mask=attr->u.num;
		break;
	case attr_maxspeed_handling:
		this_->maxspeed_handling=attr->u.num;
		break;
	case attr_route_mode:
		this_->mode=attr->u.num;
		break;
	case attr_name:
		if(this_->name)
			g_free(this_->name);
		/* previously used strdupn not available on win32 */
		this_->name = g_strdup(attr->u.str);
		break;
	default:
		break;
	}
}
Esempio n. 5
0
static int
street_name_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
	struct map_rect_priv *mr=priv_data;

	attr->type=attr_type;
	switch (attr_type) {
	case attr_street_name:
		attr->u.str=mr->street.name.name2;
		return ((attr->u.str && attr->u.str[0]) ? 1:0);
	case attr_street_name_systematic:
		attr->u.str=mr->street.name.name1;
		return ((attr->u.str && attr->u.str[0]) ? 1:0);
	case attr_town_name:
	case attr_district_name:
	case attr_postal:
		if (!mr->search_item_tmp)
			mr->search_item_tmp=map_rect_get_item_byid_mg(mr->search_mr_tmp, mr->street.name_numbers.country | (file_town_twn << 16), mr->street.name_numbers.dist);
		if (!mr->search_item_tmp)
			return 0;
		return item_attr_get(mr->search_item_tmp, attr_type, attr);
	default:
		dbg(0,"%p\n",mr->street.name_numbers.dist);
		dbg(0,"unknown attr %s\n",attr_to_name(attr_type));
		return 0;
	}
}
Esempio n. 6
0
static void
print_xvs(uint64_t xvs)
{
	uint_t bits;
	int idx = 0;

	if (xvs == 0)
		return;

	(void) printf("-------------------\n");
	(void) printf("Attribute bit(s) set:\n");
	(void) printf("-------------------\n");

	bits = xvs & ((1 << F_ATTR_ALL) - 1);
	while (bits) {
		uint_t rest = bits >> 1;
		if (bits & 1) {
			(void) printf("%s", attr_to_name((f_attr_t)idx));
			if (rest)
				(void) printf(", ");
		}
		idx++;
		bits = rest;
	}
	(void) printf("\n");
}
Esempio n. 7
0
void
item_dump_attr(struct item *item, struct map *map, FILE *out)
{
	struct attr attr;
	fprintf(out,"type=%s", item_to_name(item->type));
	while (item_attr_get(item, attr_any, &attr)) 
		fprintf(out," %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1));
}
Esempio n. 8
0
static void
popup_show_attr_val(struct map *map, void *menu, struct attr *attr)
{
	char *attr_name=attr_to_name(attr->type);
	char *str;

	str=attr_to_text(attr, /*map,*/ 1);
	popup_printf(menu, menu_type_menu, "%s: %s", attr_name, str);
	g_free(str);
}
Esempio n. 9
0
static void
vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr)
{
    dbg(1,"%s:%d\n", attr_to_name(attr->type), attr->u.num);
    switch (attr->type) {
    case attr_flags:
        this_->flags=attr->u.num;
        break;
    case attr_flags_forward_mask:
        this_->flags_forward_mask=attr->u.num;
        break;
    case attr_flags_reverse_mask:
        this_->flags_reverse_mask=attr->u.num;
        break;
    case attr_maxspeed_handling:
        this_->maxspeed_handling=attr->u.num;
        break;
    case attr_route_mode:
        this_->mode=attr->u.num;
        break;
    case attr_name:
        if(this_->name)
            g_free(this_->name);
        /* previously used strdupn not available on win32 */
        this_->name = g_strdup(attr->u.str);
        break;
    case attr_vehicle_axle_weight:
        this_->axle_weight=attr->u.num;
        break;
    case attr_vehicle_height:
        this_->height=attr->u.num;
        break;
    case attr_vehicle_length:
        this_->length=attr->u.num;
        break;
    case attr_vehicle_weight:
        this_->weight=attr->u.num;
        break;
    case attr_vehicle_width:
        this_->width=attr->u.num;
        break;
    case attr_static_speed:
        this_->static_speed=attr->u.num;
        break;
    case attr_static_distance:
        this_->static_distance=attr->u.num;
        break;
    case attr_through_traffic_penalty:
        this_->through_traffic_penalty=attr->u.num;
        break;
    default:
        break;
    }
}
Esempio n. 10
0
static int
binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{	
	struct map_rect_priv *mr=priv_data;
	struct tile *t=mr->t;
	enum attr_type type;
	int i,size;

	if (attr_type != mr->attr_last) {
		t->pos_attr=t->pos_attr_start;
		mr->attr_last=attr_type;
	}
	while (t->pos_attr < t->pos_next) {
		size=le32_to_cpu(*(t->pos_attr++));
		type=le32_to_cpu(t->pos_attr[0]);
		if (type == attr_label) 
			mr->label=1;
		if (type == attr_town_name)
			mr->label_attr[0]=t->pos_attr;
		if (type == attr_street_name)
			mr->label_attr[0]=t->pos_attr;
		if (type == attr_street_name_systematic)
			mr->label_attr[1]=t->pos_attr;
		if (type == attr_type || attr_type == attr_any) {
			if (attr_type == attr_any) {
				dbg(1,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size);
			}
			attr->type=type;
			attr_data_set(attr, t->pos_attr+1);
			if (type == attr_url_local) {
				g_free(mr->url);
				mr->url=binfile_extract(mr->m, mr->m->cachedir, attr->u.str, 1);
				attr->u.str=mr->url;
			}
			t->pos_attr+=size;
			return 1;
		} else {
			t->pos_attr+=size;
		}
	}
	if (!mr->label && (attr_type == attr_any || attr_type == attr_label)) {
		for (i = 0 ; i < sizeof(mr->label_attr)/sizeof(int *) ; i++) {
			if (mr->label_attr[i]) {
				mr->label=1;
				attr->type=attr_label;
				attr_data_set(attr, mr->label_attr[i]+1);
				return 1;
			}
		}
	}
	return 0;
}
Esempio n. 11
0
/**
 * @brief Provide the outside with information
 * 
 * @param priv
 * @param type TODO: What can this be?
 * @param attr
 * @returns true/false
 */
static int
vehicle_null_position_attr_get(struct vehicle_priv *priv,
			       enum attr_type type, struct attr *attr)
{
	dbg(lvl_debug,"enter %s\n",attr_to_name(type));
	switch (type) {
#if 0
	case attr_position_fix_type:
		attr->u.num = priv->fix_type;
		break;
#endif
	case attr_position_height:
		attr->u.numd = &priv->height;
		break;
	case attr_position_speed:
		attr->u.numd = &priv->speed;
		break;
	case attr_position_direction:
		attr->u.numd = &priv->direction;
		break;
	case attr_position_radius:
		attr->u.numd = &priv->radius;
		break;

#if 0
	case attr_position_qual:
		attr->u.num = priv->sats;
		break;
	case attr_position_sats_used:
		attr->u.num = priv->sats_used;
		break;
#endif
	case attr_position_coord_geo:
		attr->u.coord_geo = &priv->geo;
		if (!priv->have_coords)
			return 0;
		break;
	case attr_position_time_iso8601:
		attr->u.str=priv->fixiso8601;
		break;
	default:
		return 0;
	}
	dbg(lvl_debug,"ok\n");
	attr->type = type;
	return 1;
}
Esempio n. 12
0
// for _any we must return one by one
static int
point_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
    struct gobject *g = priv_data;
    struct map_rect_priv *mr = g->priv_data;
    int rc;
    switch (attr_type) {
    case attr_any:
        if (g != mr->last_oattr) {
            mr->last_oattr = g;
            mr->last_attr = 0;
        }
        switch(mr->last_attr) {
        case 0:
            mr->last_attr++;
            attr->type = attr_label;
            rc = garmin_object_label(g, attr);
            if (rc)
                return rc;
        case 1:
            mr->last_attr++;
            attr->type = attr_debug;
            rc = garmin_object_debug(g, attr);
            if (rc)
                return rc;
        default:
            return 0;
        }
        break;
    case attr_label:
        attr->type = attr_label;
        return garmin_object_label(g, attr);
    case attr_limit:
        return 0;
    default:
        dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type));
    }

    return 0;
}
Esempio n. 13
0
void
item_bin_dump(struct item_bin *ib, FILE *out)
{
	struct coord *c;
	struct attr_bin *a;
	struct attr attr;
	int *attr_start;
	int *attr_end;
	int i;
	char *str;

	c=(struct coord *)(ib+1);
	if (ib->type < type_line) {
		dump_coord(c,out);
		fprintf(out, " ");
	}
	attr_start=(int *)(ib+1)+ib->clen;
	attr_end=(int *)ib+ib->len+1;
	fprintf(out,"type=%s", item_to_name(ib->type));
	while (attr_start < attr_end) {
		a=(struct attr_bin *)(attr_start);
		attr_start+=a->len+1;
		attr.type=a->type;
		attr_data_set(&attr, (a+1));
		str=attr_to_text(&attr, NULL, 1);
		fprintf(out," %s=\"%s\"", attr_to_name(a->type), str);
		g_free(str);
	}
	fprintf(out," debug=\"length=%d\"", ib->len);
	fprintf(out,"\n");
	if (ib->type >= type_line) {
		for (i = 0 ; i < ib->clen/2 ; i++) {
			dump_coord(c+i,out);
			fprintf(out,"\n");
		}
	}
}
Esempio n. 14
0
static int 
search_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
	struct gobject *g = priv_data;
	struct map_rect_priv *mr = g->priv_data;
	int rc;
	switch (attr_type) {
	case attr_any:
			if (g != mr->last_oattr) {
				mr->last_oattr = g;
				mr->last_attr = 0;
			}
			switch(mr->last_attr) {
				case 0:
					mr->last_attr++;
					attr->type = attr_label;
					rc = garmin_object_label(g, attr);
					if (rc)
						return rc;
				case 1:
					mr->last_attr++;
					attr->type = attr_debug;
					rc = garmin_object_debug(g, attr);
					if (rc)
						return rc;
				case 2:
					mr->last_attr++;
					if (g->type == GO_POLYLINE) {
						attr->type = attr_street_name;
						rc = garmin_object_label(g, attr);
						if (rc)
							return rc;
					}
				case 3:
					mr->last_attr++;
					attr->type = attr_flags;
					attr->u.num = 0;
					rc = gar_object_flags(g);
					if (rc & F_ONEWAY)
						attr->u.num |= AF_ONEWAY;
					if (rc & F_SEGMENTED)
						attr->u.num |= AF_SEGMENTED;
					return 1;
				default:
					return 0;
			}
			break;
	case attr_label:
		attr->type = attr_label;
		return garmin_object_label(g, attr);
	case attr_town_name:
		attr->type = attr_town_name;
		if (mr->label)
			free(mr->label);
		mr->label = gar_srch_get_city(g);
		attr->u.str = mr->label;
		if (attr->u.str)
			return 1;
		return 0;
	case attr_town_id:
		rc = gar_srch_get_cityid(g);
		if (rc) {
			attr->type = attr_town_id;
			attr->u.num = rc;
			return 1;
		}
		return 0;
	case attr_town_postal:
		attr->type = attr_town_postal;
		attr->u.str = gar_srch_get_zip(g);
		if (attr->u.str)
			return 1;
		return 0;
	case attr_street_name:
		attr->type = attr_street_name;
		if (mr->label)
			free(mr->label);
		mr->label = gar_srch_get_roadname(g);
		attr->u.str = mr->label;
		if (attr->u.str)
			return 1;
		return 0;
	case attr_street_id:
		attr->type = attr_street_id;
		attr->u.num = gar_srch_get_roadid(g);
		if (attr->u.num)
			return 1;
		return 0;
	case attr_flags:
		attr->type = attr_flags;
		attr->u.num = 0;
		rc = gar_object_flags(g);
		if (rc & F_ONEWAY)
			attr->u.num |= AF_ONEWAY;
		if (rc & F_SEGMENTED)
			attr->u.num |= AF_SEGMENTED;
		return 1;
	case attr_country_id:
		rc = gar_srch_get_countryid(g);
		if (rc) {
			attr->type = attr_country_id;
			attr->u.num = rc;
			return 1;
		}
		return 0;
	case attr_country_name:
		attr->type = attr_country_name;
		attr->u.str = gar_srch_get_country(g);
		if (attr->u.str)
			return 1;
		return 0;
	case attr_district_id:
		rc = gar_srch_get_regionid(g);
		if (rc) {
			attr->type = attr_district_id;
			attr->u.num = rc;
			return 1;
		}
		return 0;
	case attr_district_name:
		attr->type = attr_district_name;
		attr->u.str = gar_srch_get_region(g);
		if (attr->u.str)
			return 1;
		return 0;
	case attr_town_streets_item:
		return 0;
	default:
		dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type));
	}

	return 0;
}
Esempio n. 15
0
// for _any we must return one by one 
static int 
point_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
	struct gobject *g = priv_data;
	struct map_rect_priv *mr = g->priv_data;
	int rc;
	switch (attr_type) {
	case attr_any:
			if (g != mr->last_oattr) {
				mr->last_oattr = g;
				mr->last_attr = 0;
			}
			switch(mr->last_attr) {
				case 0:
					mr->last_attr++;
					attr->type = attr_label;
					rc = garmin_object_label(g, attr);
					if (rc)
						return rc;
				case 1:
					mr->last_attr++;
					attr->type = attr_debug;
					rc = garmin_object_debug(g, attr);
					if (rc)
						return rc;
				case 2:
					mr->last_attr++;
					if (g->type == GO_POLYLINE) {
						attr->type = attr_street_name;
						rc = garmin_object_label(g, attr);
						if (rc)
							return rc;
					}
				case 3:
					mr->last_attr++;
					attr->type = attr_flags;
					attr->u.num = 0;
					rc = gar_object_flags(g);
					if (rc & F_ONEWAY)
						attr->u.num |= AF_ONEWAY;
					if (rc & F_SEGMENTED)
						attr->u.num |= AF_SEGMENTED;
					return 1;
				default:
					return 0;
			}
			break;
	case attr_label:
		attr->type = attr_label;
		return garmin_object_label(g, attr);
	case attr_town_name:
		attr->type = attr_town_name;
		return garmin_object_label(g, attr);
	case attr_street_name:
		attr->type = attr_street_name;
		return garmin_object_label(g, attr);
	case attr_flags:
		attr->type = attr_flags;
		attr->u.num = 0;
		rc = gar_object_flags(g);
		if (rc & F_ONEWAY)
			attr->u.num |= AF_ONEWAY;
		if (rc & F_SEGMENTED)
			attr->u.num |= AF_SEGMENTED;
		return 1;
	default:
		dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type));
	}

	return 0;
}
Esempio n. 16
0
/* ARGSUSED */
static int
xattr_fill_nvlist(vnode_t *vp, xattr_view_t xattr_view, nvlist_t *nvlp,
    cred_t *cr, caller_context_t *ct)
{
	int error;
	f_attr_t attr;
	uint64_t fsid;
	xvattr_t xvattr;
	xoptattr_t *xoap;	/* Pointer to optional attributes */
	vnode_t *ppvp;
	const char *domain;
	uint32_t rid;

	xva_init(&xvattr);

	if ((xoap = xva_getxoptattr(&xvattr)) == NULL)
		return (EINVAL);

	/*
	 * For detecting ephemeral uid/gid
	 */
	xvattr.xva_vattr.va_mask |= (AT_UID|AT_GID);

	/*
	 * We need to access the real fs object.
	 * vp points to a GFS file; ppvp points to the real object.
	 */
	ppvp = gfs_file_parent(gfs_file_parent(vp));

	/*
	 * Iterate through the attrs associated with this view
	 */

	for (attr = 0; attr < F_ATTR_ALL; attr++) {
		if (xattr_view != attr_to_xattr_view(attr)) {
			continue;
		}

		switch (attr) {
		case F_SYSTEM:
			XVA_SET_REQ(&xvattr, XAT_SYSTEM);
			break;
		case F_READONLY:
			XVA_SET_REQ(&xvattr, XAT_READONLY);
			break;
		case F_HIDDEN:
			XVA_SET_REQ(&xvattr, XAT_HIDDEN);
			break;
		case F_ARCHIVE:
			XVA_SET_REQ(&xvattr, XAT_ARCHIVE);
			break;
		case F_IMMUTABLE:
			XVA_SET_REQ(&xvattr, XAT_IMMUTABLE);
			break;
		case F_APPENDONLY:
			XVA_SET_REQ(&xvattr, XAT_APPENDONLY);
			break;
		case F_NOUNLINK:
			XVA_SET_REQ(&xvattr, XAT_NOUNLINK);
			break;
		case F_OPAQUE:
			XVA_SET_REQ(&xvattr, XAT_OPAQUE);
			break;
		case F_NODUMP:
			XVA_SET_REQ(&xvattr, XAT_NODUMP);
			break;
		case F_AV_QUARANTINED:
			XVA_SET_REQ(&xvattr, XAT_AV_QUARANTINED);
			break;
		case F_AV_MODIFIED:
			XVA_SET_REQ(&xvattr, XAT_AV_MODIFIED);
			break;
		case F_AV_SCANSTAMP:
			if (ppvp->v_type == VREG)
				XVA_SET_REQ(&xvattr, XAT_AV_SCANSTAMP);
			break;
		case F_CRTIME:
			XVA_SET_REQ(&xvattr, XAT_CREATETIME);
			break;
		case F_FSID:
			fsid = (((uint64_t)vp->v_vfsp->vfs_fsid.val[0] << 32) |
			    (uint64_t)(vp->v_vfsp->vfs_fsid.val[1] &
			    0xffffffff));
			VERIFY(nvlist_add_uint64(nvlp, attr_to_name(attr),
			    fsid) == 0);
			break;
		case F_REPARSE:
			XVA_SET_REQ(&xvattr, XAT_REPARSE);
			break;
		case F_GEN:
			XVA_SET_REQ(&xvattr, XAT_GEN);
			break;
		case F_OFFLINE:
			XVA_SET_REQ(&xvattr, XAT_OFFLINE);
			break;
		case F_SPARSE:
			XVA_SET_REQ(&xvattr, XAT_SPARSE);
			break;
		default:
			break;
		}
	}

	error = VOP_GETATTR(ppvp, &xvattr.xva_vattr, 0, cr, ct);
	if (error)
		return (error);

	/*
	 * Process all the optional attributes together here.  Notice that
	 * xoap was set when the optional attribute bits were set above.
	 */
	if ((xvattr.xva_vattr.va_mask & AT_XVATTR) && xoap) {
		if (XVA_ISSET_RTN(&xvattr, XAT_READONLY)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_READONLY),
			    xoap->xoa_readonly) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_HIDDEN)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_HIDDEN),
			    xoap->xoa_hidden) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_SYSTEM)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_SYSTEM),
			    xoap->xoa_system) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_ARCHIVE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_ARCHIVE),
			    xoap->xoa_archive) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_IMMUTABLE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_IMMUTABLE),
			    xoap->xoa_immutable) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_NOUNLINK)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_NOUNLINK),
			    xoap->xoa_nounlink) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_APPENDONLY)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_APPENDONLY),
			    xoap->xoa_appendonly) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_NODUMP)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_NODUMP),
			    xoap->xoa_nodump) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_OPAQUE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_OPAQUE),
			    xoap->xoa_opaque) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_AV_QUARANTINED)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_AV_QUARANTINED),
			    xoap->xoa_av_quarantined) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_AV_MODIFIED)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_AV_MODIFIED),
			    xoap->xoa_av_modified) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_AV_SCANSTAMP)) {
			VERIFY(nvlist_add_uint8_array(nvlp,
			    attr_to_name(F_AV_SCANSTAMP),
			    xoap->xoa_av_scanstamp,
			    sizeof (xoap->xoa_av_scanstamp)) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_CREATETIME)) {
			VERIFY(nvlist_add_uint64_array(nvlp,
			    attr_to_name(F_CRTIME),
			    (uint64_t *)&(xoap->xoa_createtime),
			    sizeof (xoap->xoa_createtime) /
			    sizeof (uint64_t)) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_REPARSE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_REPARSE),
			    xoap->xoa_reparse) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_GEN)) {
			VERIFY(nvlist_add_uint64(nvlp,
			    attr_to_name(F_GEN),
			    xoap->xoa_generation) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_OFFLINE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_OFFLINE),
			    xoap->xoa_offline) == 0);
		}
		if (XVA_ISSET_RTN(&xvattr, XAT_SPARSE)) {
			VERIFY(nvlist_add_boolean_value(nvlp,
			    attr_to_name(F_SPARSE),
			    xoap->xoa_sparse) == 0);
		}
	}
	/*
	 * Check for optional ownersid/groupsid
	 */

	if (xvattr.xva_vattr.va_uid > MAXUID) {
		nvlist_t *nvl_sid;

		if (nvlist_alloc(&nvl_sid, NV_UNIQUE_NAME, KM_SLEEP))
			return (ENOMEM);

		if (kidmap_getsidbyuid(crgetzone(cr), xvattr.xva_vattr.va_uid,
		    &domain, &rid) == 0) {
			VERIFY(nvlist_add_string(nvl_sid,
			    SID_DOMAIN, domain) == 0);
			VERIFY(nvlist_add_uint32(nvl_sid, SID_RID, rid) == 0);
			VERIFY(nvlist_add_nvlist(nvlp, attr_to_name(F_OWNERSID),
			    nvl_sid) == 0);
		}
		nvlist_free(nvl_sid);
	}
	if (xvattr.xva_vattr.va_gid > MAXUID) {
		nvlist_t *nvl_sid;

		if (nvlist_alloc(&nvl_sid, NV_UNIQUE_NAME, KM_SLEEP))
			return (ENOMEM);

		if (kidmap_getsidbygid(crgetzone(cr), xvattr.xva_vattr.va_gid,
		    &domain, &rid) == 0) {
			VERIFY(nvlist_add_string(nvl_sid,
			    SID_DOMAIN, domain) == 0);
			VERIFY(nvlist_add_uint32(nvl_sid, SID_RID, rid) == 0);
			VERIFY(nvlist_add_nvlist(nvlp, attr_to_name(F_GROUPSID),
			    nvl_sid) == 0);
		}
		nvlist_free(nvl_sid);
	}

	return (0);
}