Magic symlinks redux
Andrey V. Elsukov
bu7cher at yandex.ru
Fri Aug 22 10:09:35 UTC 2008
Luigi Rizzo wrote:
> interestingly simple.
>
> Question - is the process' ENV easily available in this part
> of the kernel, so one could in principle use environment variables
> as replacement strings ?
>
> Some comments on the code in the above patch:
>
> + readability it might be improved a bit:
> e.g. I don't see why uma_{zalloc|zfree} are hidden behind macros,
> nor why symlynk_magic() isn't simply called as
>
> if (vfs_magiclinks)
> symlink_magic(td, cp, &linklen);
>
> as it cannot fail as implemented;
> also, the whole MATCH/SUBSTITUTE macros are not particularly
> readable -- i understand one needs macros to implement sizeof("somestring")
> correctly, but apart from a wrapper I believe the core of these two
> blocks should be implemented by functions (possibly inline) with
> MATCH() returning the match length so one doesn't need to replicate
> the string parameter in SUBSTITUTE();
>
> + correctness --
> 1. termchar is not reset to '/' if a match is not found
> 2. what is the intended behaviour when the replacement string overflows
> the buffer ?
>
> + efficiency of symlink_magic() might be improved too:
> e.g. the function could do a quick check for the presence of @ and return
> without allocation/deallocation if not found;
> getcredhostname() (and similar routines) could be called so that
> they write directly to tmp, without the need for
> allocating an in-stack buffer
This was so long ago.. As i remember this patch is a quick port of
NetBSD's implementation and uses the same code.
Also there was another implementation ported from DragonFlyBSD.
David Quattlebaum is working on varsyms implementation and he sent
fresh patch to me in this April. I attached patch.
And sorry, i am not working on this today..
--
WBR, Andrey V. Elsukov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varsym.patch
Type: application/octet-stream
Size: 42181 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20080822/c01a40d7/varsym.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 679 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20080822/c01a40d7/Makefile.obj
More information about the freebsd-arch
mailing list