From: Yufen Yu <yuyufen@huawei.com>
To: fstests@vger.kernel.org
Subject: [PATCH 1/5] commom/rc: define function _get_max_file_size
Date: Wed, 20 Feb 2019 09:59:51 +0800 [thread overview]
Message-ID: <20190220015955.26342-2-yuyufen@huawei.com> (raw)
In-Reply-To: <20190220015955.26342-1-yuyufen@huawei.com>
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@huawei.com>
---
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
next prev parent reply other threads:[~2019-02-20 1:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 1:59 [PATCH 0/5] define common _get_max_file_size function Yufen Yu
2019-02-20 1:59 ` Yufen Yu [this message]
2019-02-20 3:12 ` [PATCH 1/5] commom/rc: define function _get_max_file_size Eric Biggers
2019-02-20 13:32 ` Eryu Guan
2019-02-20 1:59 ` [PATCH 2/5] generic/299: limit max file size Yufen Yu
2019-02-20 1:59 ` [PATCH 3/5] generic/351: use the common function _get_max_file_size Yufen Yu
2019-02-20 1:59 ` [PATCH 4/5] generic/349: " Yufen Yu
2019-02-20 1:59 ` [PATCH 5/5] generic/350: " Yufen Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190220015955.26342-2-yuyufen@huawei.com \
--to=yuyufen@huawei.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox