expand_number(3) support for tmpfs -o size and -o maxfilesize
Oliver Fromme
olli at lurza.secnetix.de
Mon Dec 13 18:20:12 UTC 2010
Alexander Best wrote:
> is it possible to get support for something like this fstab entry?
>
> tmpfs /tmp tmpfs rw,mode=1777,size=500m 0 0
expand_number(3) is a libc function which is availbale to
userland, but the size= argument is parsed by the kernel.
We don't have something like expand_number() in the kernel.
A few parts of the kernel have grown their own:
getenv_quad() in kern/kern_environment.c
gv_sizespec() in geom/vinum/geom_vinum_share.c
> tmpfs doesn't seem to handle humanzied numbers that well. df -h reports:
>
> Filesystem Size Used Avail Capacity Mounted on
> tmpfs 17G 12M 17G 0% /tmp
That's expected behaviour ... The function vfs_scanopt()
is used to parse the size argument using the "%qu" format,
expecting the number in bytes. So if you write "500m",
it stops at the "m" and simply parses the number as 500
bytes, which is below the minimum size (4 KB), so it falls
back to the default maximum size which is the total amount
of memory available (RAM + swap).
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"That's what I love about GUIs: They make simple tasks easier,
and complex tasks impossible."
-- John William Chambless
More information about the freebsd-fs
mailing list