1 .\" $NetBSD: gelf_xlatetof.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" This software is provided by Joseph Koshy ``as is'' and
15 .\" any express or implied warranties, including, but not limited to, the
16 .\" implied warranties of merchantability and fitness for a particular purpose
17 .\" are disclaimed. in no event shall Joseph Koshy be liable
18 .\" for any direct, indirect, incidental, special, exemplary, or consequential
19 .\" damages (including, but not limited to, procurement of substitute goods
20 .\" or services; loss of use, data, or profits; or business interruption)
21 .\" however caused and on any theory of liability, whether in contract, strict
22 .\" liability, or tort (including negligence or otherwise) arising in any way
23 .\" out of the use of this software, even if advised of the possibility of
26 .\" Id: gelf_xlatetof.3 189 2008-07-20 10:38:08Z jkoshy
35 .Nd translate data between files and memory
41 .Fn elf32_xlatetof "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
43 .Fn elf32_xlatetom "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
45 .Fn elf64_xlatetof "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
47 .Fn elf64_xlatetom "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
54 .Fa "unsigned int encode"
61 .Fa "unsigned int encode"
64 These functions translate between the file and memory representations
65 of ELF data structures.
66 The in-memory representation of an ELF data structure would confirm to
67 the byte ordering and data alignment restrictions dictated by the host
69 A file representation of the same data structure could use a non-native byte
70 ordering and in addition may be laid out differently with the file.
77 translate data from file representations to native, in-memory representations.
83 translate data from in-memory representations to file representations.
89 descriptor describing the source to be translated.
90 The following elements of the descriptor need to be set before
91 invoking these functions:
92 .Bl -hang -offset indent
94 Set to a valid pointer value denoting the beginning of the data area
97 Set to the total size in bytes of the source data area to be
100 Set to the type of the source data being translated.
101 This value is one of the values defined in the
106 enumeration is described in
109 Set to the version number of the ELF data structures being
111 Currently only version
118 describes the destination buffer.
119 The following elements of the
121 descriptor need to be set before invoking these functions:
122 .Bl -hang -offset indent
124 Set to a valid pointer value that denotes the start of the destination
125 buffer that will hold translated data.
126 This value may be the same as that of the source buffer, in which case
127 an in-place conversion will be attempted.
129 Set to the size of the destination buffer in bytes.
130 This value will be modified if the function call succeeds.
132 Set to the desired version number of the destination.
133 Currently only version
138 These translations routines allow the source and destination buffers
139 to coincide, in which case an in-place translation will be done
140 if the destination is large enough to hold the translated data.
141 Other kinds of overlap between the source and destination buffers
144 On successful completion of the translation request the following
147 descriptor would be modified:
148 .Bl -hang -offset indent
150 Set to the size in bytes of the translated data.
154 value of the source data descriptor.
159 specifies the encoding in which the file objects are represented.
161 .Bl -hang -offset indent
163 File objects use the library's native byte ordering.
165 File objects use a little-endian ordering.
167 File objects use a big-endian ordering.
174 select the appropriate 32 or 64 bit translations based on the class of argument
177 These functions return argument
179 if successful, or NULL in case of an error.
183 These functions may fail with the following errors:
184 .Bl -tag -width "[ELF_E_RESOURCE]"
185 .It Bq Er ELF_E_ARGUMENT
192 .It Bq Er ELF_E_ARGUMENT
198 .It Bq Er ELF_E_ARGUMENT
199 The desired encoding parameter was not one of
204 .It Bq Er ELF_E_ARGUMENT
209 specified an unsupported type.
213 argument specified a buffer size that was not an integral multiple of
218 argument specified a buffer size that was too small.
222 specified a destination buffer that overlaps with the source
225 The destination buffer for a conversion to memory had an alignment
226 inappropriate for the underlying ELF type.
228 The source buffer for a conversion to file had an alignment
229 inappropriate for the underlying ELF type.
230 .It Bq Er ELF_E_UNIMPL
231 The version numbers for arguments
236 .It Bq Er ELF_E_UNIMPL
239 requested conversion for a type which is not currently
241 .It Bq Er ELF_E_VERSION
244 specified an unsupported version number.