| 964 | } |
| 965 | |
| 966 | static int |
| 967 | zap_lookup_impl(zap_t *zap, const char *name, |
| 968 | uint64_t integer_size, uint64_t num_integers, void *buf, |
| 969 | matchtype_t mt, char *realname, int rn_len, |
| 970 | boolean_t *ncp) |
| 971 | { |
| 972 | int err = 0; |
| 973 | |
| 974 | zap_name_t *zn = zap_name_alloc(zap, name, mt); |
| 975 | if (zn == NULL) |
| 976 | return (SET_ERROR(ENOTSUP)); |
| 977 | |
| 978 | if (!zap->zap_ismicro) { |
| 979 | err = fzap_lookup(zn, integer_size, num_integers, buf, |
| 980 | realname, rn_len, ncp); |
| 981 | } else { |
| 982 | mzap_ent_t *mze = mze_find(zn); |
| 983 | if (mze == NULL) { |
| 984 | err = SET_ERROR(ENOENT); |
| 985 | } else { |
| 986 | if (num_integers < 1) { |
| 987 | err = SET_ERROR(EOVERFLOW); |
| 988 | } else if (integer_size != 8) { |
| 989 | err = SET_ERROR(EINVAL); |
| 990 | } else { |
| 991 | *(uint64_t *)buf = |
| 992 | MZE_PHYS(zap, mze)->mze_value; |
| 993 | (void) strlcpy(realname, |
| 994 | MZE_PHYS(zap, mze)->mze_name, rn_len); |
| 995 | if (ncp) { |
| 996 | *ncp = mzap_normalization_conflict(zap, |
| 997 | zn, mze); |
| 998 | } |
| 999 | } |
| 1000 | } |
| 1001 | } |
| 1002 | zap_name_free(zn); |
| 1003 | return (err); |
| 1004 | } |
| 1005 | |
| 1006 | int |
| 1007 | zap_lookup_norm(objset_t *os, uint64_t zapobj, const char *name, |
no test coverage detected