Do not print UINT64_MAX value for some of zfs properties
The values of next properties: filesystem_limit, filesystem_count, snapshot_limit, snapshot_count were returned to user as UINT64_MAX integers in case if -p cli option is used, return 'none' value instead. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com> Closes #9306 Closes #12690
This commit is contained in:
parent
1139e170d4
commit
475e41b9f5
|
@ -2767,16 +2767,15 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If limit is UINT64_MAX, we translate this into 'none' (unless
|
* If limit is UINT64_MAX, we translate this into 'none', and
|
||||||
* literal is set), and indicate that it's the default value.
|
* indicate that it's the default value. Otherwise, we print
|
||||||
* Otherwise, we print the number nicely and indicate that it's
|
* the number nicely and indicate that it's set locally.
|
||||||
* set locally.
|
|
||||||
*/
|
*/
|
||||||
if (literal) {
|
if (val == UINT64_MAX) {
|
||||||
|
(void) strlcpy(propbuf, "none", proplen);
|
||||||
|
} else if (literal) {
|
||||||
(void) snprintf(propbuf, proplen, "%llu",
|
(void) snprintf(propbuf, proplen, "%llu",
|
||||||
(u_longlong_t)val);
|
(u_longlong_t)val);
|
||||||
} else if (val == UINT64_MAX) {
|
|
||||||
(void) strlcpy(propbuf, "none", proplen);
|
|
||||||
} else {
|
} else {
|
||||||
zfs_nicenum(val, propbuf, proplen);
|
zfs_nicenum(val, propbuf, proplen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,14 @@ do
|
||||||
((i+=1))
|
((i+=1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
typeset -r uint64_max="18446744073709551615"
|
||||||
|
|
||||||
typeset zfs_props=("type" used available creation volsize referenced \
|
typeset zfs_props=("type" used available creation volsize referenced \
|
||||||
compressratio mounted origin recordsize quota reservation mountpoint \
|
compressratio mounted origin recordsize quota reservation mountpoint \
|
||||||
sharenfs checksum compression atime devices exec readonly setuid \
|
sharenfs checksum compression atime devices exec readonly setuid \
|
||||||
snapdir aclinherit canmount primarycache secondarycache version \
|
snapdir aclinherit canmount primarycache secondarycache version \
|
||||||
usedbychildren usedbydataset usedbyrefreservation usedbysnapshots)
|
usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
|
||||||
|
filesystem_limit snapshot_limit filesystem_count snapshot_count)
|
||||||
if is_freebsd; then
|
if is_freebsd; then
|
||||||
typeset zfs_props_os=(jailed aclmode)
|
typeset zfs_props_os=(jailed aclmode)
|
||||||
else
|
else
|
||||||
|
@ -100,11 +103,21 @@ function check_return_value
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
typeset item
|
typeset item
|
||||||
item=$(echo $line | awk '{print $2}' 2>&1)
|
typeset value
|
||||||
|
|
||||||
|
item=$(echo $line | awk '{print $2}' 2>&1)
|
||||||
if [[ $item == $p ]]; then
|
if [[ $item == $p ]]; then
|
||||||
((found += 1))
|
((found += 1))
|
||||||
cols=$(echo $line | awk '{print NF}')
|
cols=$(echo $line | awk '{print NF}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
value=$(echo $line | awk '{print $3}' 2>&1)
|
||||||
|
if [[ $value == $uint64_max ]]; then
|
||||||
|
log_fail "'zfs get $opt $props $dst' return " \
|
||||||
|
"UINT64_MAX constant."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((found > 0)); then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done < $TESTDIR/$TESTFILE0
|
done < $TESTDIR/$TESTFILE0
|
||||||
|
|
Loading…
Reference in New Issue