Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Oct 2011 14:22:00 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Ed Schouten <ed@80386.nl>, Jilles Tjoelker <jilles@stack.nl>, arch@freebsd.org
Subject:   Re: [PATCH] fadvise(2) system call
Message-ID:  <CAGH67wRN9%2BDPh07yrxrQYTc%2Bv34RY0KQdXade0KCiiGOjr9pqg@mail.gmail.com>
In-Reply-To: <201110311717.53476.jhb@freebsd.org>
References:  <201110281426.00013.jhb@freebsd.org> <201110311024.07580.jhb@freebsd.org> <20111031190359.GP2258@hoeg.nl> <201110311717.53476.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 31, 2011 at 2:17 PM, John Baldwin <jhb@freebsd.org> wrote:
> On Monday, October 31, 2011 3:03:59 pm Ed Schouten wrote:
>> Hi John,
>>
>> * John Baldwin <jhb@freebsd.org>, 20111031 15:24:
>> > Existing applications use the name and I find it ugly. =A0(I also wish=
 we
>> > had a plain fallocate() instead of just posix_fallocate().) =A0However=
, if
>> > other folks prefer not having the wrapper I could update it to use the
>> > posix_* name.
>>
>> I agree with Jilles. It's easier to introduce namespace pollution than
>> it is to get rid of it afterwards. If the function is called
>> posix_fadvise(), people should just use that.
>
> They don't. =A0They use fadvise() which is part of Linux's API much as
> madvise(2) is part of ours. =A0(See the other fork in this thread.)
>
>> People are constantly complaining about `Linuxisms' when they want to
>> port software to FreeBSD. The word `BSDism' should remain an euphemism.
>> ;-)
>
> I think kqueue() is a useful BSDism. =A0I think the attitude that we shou=
ld have
> nothing that deviates from an established standard would be harmful if it=
 was
> actually applied.
>
> I also really do think that posix_*() truly is far uglier to read. =A0In =
the
> worst case, imagine something like this:
>
> =A0 =A0 =A0 =A0char *cp;
>
> =A0 =A0 =A0 =A0cp =3D posix_malloc(posix_strlen(some_string) + 1);
> =A0 =A0 =A0 =A0posix_strcpy(cp, s);
> =A0 =A0 =A0 =A0posix_printf("%s\n", cp);
>
> *blech*
>
> I realize not all symbols will get this treatment, but this will eventual=
ly
> lead to some ugly code the more it is done. =A0I am fine with fully POSIX=
-
> compliant code looking ugly, but I'd like for code written for FreeBSD to=
 not
> be quite so clunky. =A0Yes, POSIX wants to use a clean namespace for new
> routines going forward, that's fine. =A0However, I think we should provid=
e sane
> names for our APIs and implement POSIX on top of those. =A0How many folks=
 have
> actually used posix_madvise() instead of madvise()? =A0And do you really =
think
> posix_fadvise() as a function name is not less orthogonal to madvise() th=
an
> fadvise()?

int fadvise(...);

#ifdef _POSIX_SOURCE
#define posix_fadvise fadvise
#endif

Done :P?

posix_* IMO is a mistake that really should be controlled via the
_POSIX_SOURCE macro.

> </soapbox>
>
> That said, I can update the patch to use the ugly name. =A0Can someone el=
se
> volunteer to implement a VOP_ADVISE() for UFS that actually does the read=
-
> ahead (for FADV_WILLNEED) (or for other filesystems for that matter). =A0=
ZFS
> might need to use a custom FADV_DONTNEED as well.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wRN9%2BDPh07yrxrQYTc%2Bv34RY0KQdXade0KCiiGOjr9pqg>