Define a new function _get_max_file_size to return the max file size supported by the special filesystem. Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx> --- common/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/common/rc b/common/rc index e5da6484..10ab497d 100644 --- a/common/rc +++ b/common/rc @@ -3785,6 +3785,29 @@ _require_scratch_feature() esac } +# get filesystem max file size +_get_max_file_size() +{ + case $FSTYP in + vfat|jffs2|romfs) + echo $((2**32-1)) # 0xFFFFFFFF + ;; + *) # MAX_LFS_FILESIZE + case "$(getconf LONG_BIT)" in + "32") + echo $(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1)) + ;; + "64") + echo "9223372036854775807" + ;; + *) + _fail "sizeof(long) == $(getconf LONG_BIT)?" + ;; + esac + ;; + esac +} + # The maximum filesystem label length, /not/ including terminating NULL _label_get_max() { -- 2.16.2.dirty