10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1618Srie * Common Development and Distribution License (the "License"). 6*1618Srie * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*1618Srie 220Sstevel@tonic-gate /* 23*1618Srie * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * String conversion routine for segment flags. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate #include <string.h> 32*1618Srie #include <libld.h> 33*1618Srie #include "_conv.h" 340Sstevel@tonic-gate #include "segments_msg.h" 350Sstevel@tonic-gate 360Sstevel@tonic-gate #define SEGSZ MSG_GBL_OSQBRKT_SIZE + \ 370Sstevel@tonic-gate MSG_FLG_SG_VADDR_SIZE + \ 380Sstevel@tonic-gate MSG_FLG_SG_PADDR_SIZE + \ 390Sstevel@tonic-gate MSG_FLG_SG_LENGTH_SIZE + \ 400Sstevel@tonic-gate MSG_FLG_SG_ALIGN_SIZE + \ 410Sstevel@tonic-gate MSG_FLG_SG_ROUND_SIZE + \ 420Sstevel@tonic-gate MSG_FLG_SG_FLAGS_SIZE + \ 430Sstevel@tonic-gate MSG_FLG_SG_TYPE_SIZE + \ 440Sstevel@tonic-gate MSG_FLG_SG_ORDER_SIZE + \ 45*1618Srie MSG_FLG_SG_NOHDR_SIZE + \ 460Sstevel@tonic-gate MSG_FLG_SG_EMPTY_SIZE + \ 47*1618Srie MSG_FLG_SG_KEY_SIZE + \ 48*1618Srie MSG_FLG_SG_DISABLED_SIZE + \ 49*1618Srie MSG_FLG_SG_PHREQ_SIZE + \ 50*1618Srie CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE 510Sstevel@tonic-gate 520Sstevel@tonic-gate const char * 53*1618Srie conv_seg_flags(Half flags) 540Sstevel@tonic-gate { 55*1618Srie static char string[SEGSZ]; 56*1618Srie static Val_desc vda[] = { 57*1618Srie { FLG_SG_VADDR, MSG_ORIG(MSG_FLG_SG_VADDR) }, 58*1618Srie { FLG_SG_PADDR, MSG_ORIG(MSG_FLG_SG_PADDR) }, 59*1618Srie { FLG_SG_LENGTH, MSG_ORIG(MSG_FLG_SG_LENGTH) }, 60*1618Srie { FLG_SG_ALIGN, MSG_ORIG(MSG_FLG_SG_ALIGN) }, 61*1618Srie { FLG_SG_ROUND, MSG_ORIG(MSG_FLG_SG_ROUND) }, 62*1618Srie { FLG_SG_FLAGS, MSG_ORIG(MSG_FLG_SG_FLAGS) }, 63*1618Srie { FLG_SG_TYPE, MSG_ORIG(MSG_FLG_SG_TYPE) }, 64*1618Srie { FLG_SG_ORDER, MSG_ORIG(MSG_FLG_SG_ORDER) }, 65*1618Srie { FLG_SG_NOHDR, MSG_ORIG(MSG_FLG_SG_NOHDR) }, 66*1618Srie { FLG_SG_EMPTY, MSG_ORIG(MSG_FLG_SG_EMPTY) }, 67*1618Srie { FLG_SG_KEY, MSG_ORIG(MSG_FLG_SG_KEY) }, 68*1618Srie { FLG_SG_DISABLED, MSG_ORIG(MSG_FLG_SG_DISABLED) }, 69*1618Srie { FLG_SG_PHREQ, MSG_ORIG(MSG_FLG_SG_PHREQ) }, 70*1618Srie { 0, 0 } 71*1618Srie }; 720Sstevel@tonic-gate 730Sstevel@tonic-gate if (flags == 0) 740Sstevel@tonic-gate return (MSG_ORIG(MSG_GBL_ZERO)); 750Sstevel@tonic-gate 76*1618Srie (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), SEGSZ); 77*1618Srie if (conv_expn_field(string, SEGSZ, vda, flags, flags, 0, 0)) 78*1618Srie (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), SEGSZ); 79*1618Srie 80*1618Srie return ((const char *)string); 810Sstevel@tonic-gate } 82