Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/include/sys/nvpair_impl.h
Real path: /usr/include/sys/nvpair_impl.h
Zurück
/* * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. */ #ifndef _NVPAIR_IMPL_H #define _NVPAIR_IMPL_H #ifdef __cplusplus extern "C" { #endif #include <rpc/xdr.h> #include <sys/nvpair.h> /* * The structures here provided for information and debugging purposes only * may be changed in the future. */ /* * implementation linked list for pre-packed data */ typedef struct i_nvp i_nvp_t; struct i_nvp { union { uint64_t _nvi_align; /* ensure alignment */ struct { i_nvp_t *_nvi_next; /* pointer to next nvpair */ i_nvp_t *_nvi_prev; /* pointer to prev nvpair */ } _nvi; } _nvi_un; nvpair_t nvi_nvp; /* nvpair */ }; #define nvi_next _nvi_un._nvi._nvi_next #define nvi_prev _nvi_un._nvi._nvi_prev typedef struct { i_nvp_t *nvp_list; /* linked list of nvpairs */ i_nvp_t *nvp_last; /* last nvpair */ i_nvp_t *nvp_curr; /* current walker nvpair */ nv_alloc_t *nvp_nva; /* pluggable allocator */ uint32_t nvp_stat; /* internal state */ uint_t nvp_count; /* number of nvpairs */ } nvpriv_t; #define EMBEDDED_NVL(nvp) ((nvlist_t *)(void *)NVP_VALUE(nvp)) #define EMBEDDED_NVL_ARRAY(nvp) ((nvlist_t **)(void *)NVP_VALUE(nvp)) /* * Encoding related routines */ #define NVS_OP_ENCODE 0 #define NVS_OP_DECODE 1 #define NVS_OP_GETSIZE 2 /* * name_len is the length of the name string including the null terminator * so it must be >= 1 */ #define NVP_SIZE_CALC(name_len, data_len) \ (NV_ALIGN((sizeof (nvpair_t)) + name_len) + NV_ALIGN(data_len)) /* * The NVS_XDR_MAX_LEN macro takes a packed xdr buffer of size x and estimates * the largest nvpair that could be encoded in the buffer. * * See comments above nvpair_xdr_op() for the format of xdr encoding. * The size of a xdr packed nvpair without any data is 5 words. * * Using the size of the data directly as an estimate would be ok * in all cases except one. If the data type is of DATA_TYPE_STRING_ARRAY * then the actual nvpair has space for an array of pointers to index * the strings. These pointers are not encoded into the packed xdr buffer. * * If the data is of type DATA_TYPE_STRING_ARRAY and all the strings are * of length 0, then each string is endcoded in xdr format as a single word. * Therefore when expanded to an nvpair there will be 2.25 word used for * each string. (a int64_t allocated for pointer usage, and a single char * for the null termination.) * * This is the calculation performed by the NVS_XDR_MAX_LEN macro. */ #define NVS_XDR_HDR_LEN ((size_t)(5 * 4)) #define NVS_XDR_DATA_LEN(y) (((size_t)(y) <= NVS_XDR_HDR_LEN) ? \ 0 : ((size_t)(y) - NVS_XDR_HDR_LEN)) #define NVS_XDR_MAX_LEN(x) (NVP_SIZE_CALC(1, 0) + \ (NVS_XDR_DATA_LEN(x) * 2) + \ NV_ALIGN4((NVS_XDR_DATA_LEN(x) / 4))) typedef struct nvs_ops nvs_ops_t; typedef struct { int nvs_op; const nvs_ops_t *nvs_ops; void *nvs_private; nvpriv_t *nvs_priv; } nvstream_t; /* * nvs operations are: * - nvs_nvlist * encoding / decoding of a nvlist header (nvlist_t) * calculates the size used for header and end detection * * - nvs_nvpair * responsible for the first part of encoding / decoding of an nvpair * calculates the decoded size of an nvpair * * - nvs_nvp_op * second part of encoding / decoding of an nvpair * * - nvs_nvp_size * calculates the encoding size of an nvpair * * - nvs_nvl_fini * encodes the end detection mark (zeros). */ struct nvs_ops { int (*nvs_nvlist)(nvstream_t *, nvlist_t *, size_t *); int (*nvs_nvpair)(nvstream_t *, nvpair_t *, size_t *); int (*nvs_nvp_op)(nvstream_t *, nvpair_t *); int (*nvs_nvp_size)(nvstream_t *, nvpair_t *, size_t *); int (*nvs_nvl_fini)(nvstream_t *); }; int nvs_decode_pairs(nvstream_t *__nvs, nvlist_t *__nvl); int nvs_xdr_nvp_op(nvstream_t *__nvs, nvpair_t *__nvp); int nvs_xdr_create(nvstream_t *__nvs, XDR *__xdr, char *__buf, size_t __buflen); void nvs_xdr_destroy(nvstream_t *__nvs); #ifdef __cplusplus } #endif #endif /* _NVPAIR_IMPL_H */