4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
41 #define SEG_NAME_LEN 2
44 typedef uint64_t fru_hdl_t
;
46 typedef fru_hdl_t container_hdl_t
;
47 typedef fru_hdl_t section_hdl_t
;
48 typedef fru_hdl_t segment_hdl_t
;
49 typedef fru_hdl_t packet_hdl_t
;
53 section_hdl_t handle
; /* for use in operations on section */
54 uint32_t offset
; /* bytes from container beginning */
55 uint32_t length
; /* length of section in bytes */
56 uint32_t protection
; /* non-zero if section is write-protected */
57 int32_t version
; /* version of section header, or -1 */
63 segment_hdl_t handle
; /* for operations on segment */
64 char name
[SEG_NAME_LEN
]; /* from container section header */
65 uint32_t descriptor
; /* ditto */
66 uint32_t offset
; /* ditto */
67 uint32_t length
; /* ditto */
71 typedef uint64_t tag_t
;
75 packet_hdl_t handle
; /* for use in operations on packet */
81 container_hdl_t
fru_open_container(picl_nodehdl_t fru
);
83 int fru_close_container(container_hdl_t container
);
84 int fru_get_num_sections(container_hdl_t container
, door_cred_t
*cred
);
85 int fru_get_sections(container_hdl_t container
, section_t
*section
,
86 int max_sections
, door_cred_t
*cred
);
87 int fru_get_num_segments(section_hdl_t section
, door_cred_t
*rarg
);
88 int fru_get_segments(section_hdl_t section
, segment_t
*segment
,
89 int max_segments
, door_cred_t
*rarg
);
90 int fru_add_segment(section_hdl_t section
, segment_t
*segment
,
91 section_hdl_t
*newsection
, door_cred_t
*cred
);
92 int fru_delete_segment(segment_hdl_t segment
, section_hdl_t
*newsection
,
94 ssize_t
fru_read_segment(segment_hdl_t segment
, void *buffer
, size_t nbytes
,
96 int fru_write_segment(segment_hdl_t segment
, const void *data
, size_t nbytes
,
97 segment_hdl_t
*newsegment
, door_cred_t
*cred
);
98 int fru_get_num_packets(segment_hdl_t segment
, door_cred_t
*cred
);
99 int fru_get_packets(segment_hdl_t segment
, packet_t
*packet
,
100 int max_packets
, door_cred_t
*cred
);
101 ssize_t
fru_get_payload(packet_hdl_t packet
, void *buffer
,
102 size_t nbytes
, door_cred_t
*cred
);
103 int fru_update_payload(packet_hdl_t packet
, const void *data
, size_t nbytes
,
104 packet_hdl_t
*newpacket
, door_cred_t
*cred
);
105 int fru_append_packet(segment_hdl_t segment
, packet_t
*packet
,
106 const void *payload
, size_t nbytes
, segment_hdl_t
*newsegment
,
108 int fru_delete_packet(packet_hdl_t packet
, segment_hdl_t
*newsegment
,
110 int fru_is_data_available(picl_nodehdl_t fru
);
116 #endif /* _FRU_ACCESS_H */