| 1125 | } |
| 1126 | |
| 1127 | int |
| 1128 | zap_length(objset_t *os, uint64_t zapobj, const char *name, |
| 1129 | uint64_t *integer_size, uint64_t *num_integers) |
| 1130 | { |
| 1131 | zap_t *zap; |
| 1132 | |
| 1133 | int err = |
| 1134 | zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap); |
| 1135 | if (err != 0) |
| 1136 | return (err); |
| 1137 | zap_name_t *zn = zap_name_alloc(zap, name, 0); |
| 1138 | if (zn == NULL) { |
| 1139 | zap_unlockdir(zap, FTAG); |
| 1140 | return (SET_ERROR(ENOTSUP)); |
| 1141 | } |
| 1142 | if (!zap->zap_ismicro) { |
| 1143 | err = fzap_length(zn, integer_size, num_integers); |
| 1144 | } else { |
| 1145 | mzap_ent_t *mze = mze_find(zn); |
| 1146 | if (mze == NULL) { |
| 1147 | err = SET_ERROR(ENOENT); |
| 1148 | } else { |
| 1149 | if (integer_size) |
| 1150 | *integer_size = 8; |
| 1151 | if (num_integers) |
| 1152 | *num_integers = 1; |
| 1153 | } |
| 1154 | } |
| 1155 | zap_name_free(zn); |
| 1156 | zap_unlockdir(zap, FTAG); |
| 1157 | return (err); |
| 1158 | } |
| 1159 | |
| 1160 | int |
| 1161 | zap_length_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key, |