The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Daniel Palmer <daniel@thingy.jp>
To: w@1wt.eu, linux@weissschuh.net
Cc: david.laight.linux@gmail.com, linux-kernel@vger.kernel.org,
	Daniel Palmer <daniel@thingy.jp>
Subject: [PATCH v4 0/3] nolibc: Add fallocate()
Date: Thu,  7 May 2026 18:03:50 +0900	[thread overview]
Message-ID: <20260507090353.356764-1-daniel@thingy.jp> (raw)

While poking around with my "static PIE for nommu" series I found
I needed fallocate(). Implementing it turned out a bit more
interesting than I thought it would be due to how the offset and
size need to be passed on 32bit machines.

v4:
 - Added statfs()...
 - Reworked the test a bit to use statfs() to work out if /tmp
   is a tmpfs or not and skip the test if it isn't. This skips
   the test on sparc32 where CONFIG_TMPFS=n.
 - Adding the needed bits to the sparc32 config to allow tmpfs
   to be enabled allows it to run and pass the test. I will check
   the changes and send a patch.
 - Cleaned up the if() around deciding how to pass the parameters
   for fallocate() based on the comments from David and Thomas.
 - Test passed on all of the supported targets.

v3:
 - Reworked the test a bit, ran it on all the targets I could get
   to run (s390, loongarch and sh currently don't work for me).
   sparc32 doesn't seem to support fallocate() so made it skip
   the test.
 - Rebase on nolibc/for-next with the large file support bits.

v2:
 - Addressed Thomas' comments
 - Trial and error'd a test for the arguments being passed correctly.
   Hopefully someone smarter than I am can tell if it actually works.

Daniel Palmer (3):
  tools/nolibc: fcntl: Add fallocate()
  tools/nolibc: Add statfs()
  selftests/nolibc: Add a very basic test for fallocate()

 tools/include/nolibc/Makefile                |  1 +
 tools/include/nolibc/arch-mips.h             | 11 +++
 tools/include/nolibc/fcntl.h                 | 31 +++++++++
 tools/include/nolibc/nolibc.h                |  1 +
 tools/include/nolibc/sys.h                   |  8 +++
 tools/include/nolibc/sys/statfs.h            | 50 ++++++++++++++
 tools/testing/selftests/nolibc/nolibc-test.c | 70 ++++++++++++++++++++
 7 files changed, 172 insertions(+)
 create mode 100644 tools/include/nolibc/sys/statfs.h


base-commit: bb2d82d41894cb30d836e9796ff67d2f9a71eccf
-- 
2.53.0


             reply	other threads:[~2026-05-07  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  9:03 Daniel Palmer [this message]
2026-05-07  9:03 ` [PATCH v4 1/3] tools/nolibc: fcntl: Add fallocate() Daniel Palmer
2026-05-07  9:03 ` [PATCH v4 2/3] tools/nolibc: Add statfs() Daniel Palmer
2026-05-07  9:03 ` [PATCH v4 3/3] selftests/nolibc: Add a very basic test for fallocate() Daniel Palmer
2026-05-11  6:29 ` [PATCH v4 0/3] nolibc: Add fallocate() Willy Tarreau

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=20260507090353.356764-1-daniel@thingy.jp \
    --to=daniel@thingy.jp \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=w@1wt.eu \
    /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