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