On Sun, Nov 16, 2014 at 12:21 AM, Takeshi Nakayama <t...@catvmics.ne.jp> wrote: >>>> Takeshi Nakayama <t...@catvmics.ne.jp> wrote > >> >>> Justin Cormack <jus...@specialbusservice.com> wrote >> >> > Er, you can't do that. >> > >> > 1. It breaks the rump builds on most platforms >> > http://build.myriabit.eu:8012/waterfall as the prototypes dont match >> > eg see >> > http://build.myriabit.eu:8012/builders/ppc64-cross/builds/5585/steps/shell_3/logs/stdio >> >> It seems that posix says 2nd arg of iconv(3) is char **, but >> NetBSD's one is const char **. >> >> > 2. There is no requirement that rump runs on a platform that has iconv >> > anyway, it may be running on bare metal, or non Posix platform. >> > >> > Not sure what the intention was though - I am sure we can find a way >> > around it... >> >> I would like to include this at least on NetBSD host since we don't >> have kernel iconv and then mount_smbfs(8) is useless for filename >> conversions. >> >> So is it ok to add a compile-time option as below and define it >> somewhere? Or are there any more appropriate make variables to >> detect host OS? > > On second thought, it seems user component can use __NetBSD__ > definition, how about this change?
You also need to wrap the #include <iconv.h> in sys/netsmb/iconv.c in #ifdef as well, as some platforms do not have the header. How does it work when not using rump? Do we really need in kernel iconv? Justin > -- Takeshi Nakayama > > > Index: netsmb_user.c > =================================================================== > RCS file: /cvsroot/src/sys/rump/dev/lib/libnetsmb/netsmb_user.c,v > retrieving revision 1.1 > diff -u -d -r1.1 netsmb_user.c > --- netsmb_user.c 15 Nov 2014 18:49:04 -0000 1.1 > +++ netsmb_user.c 16 Nov 2014 00:21:28 -0000 > @@ -36,6 +36,7 @@ > int > rumpcomp_netsmb_iconv_open(const char *to, const char *from, void **handle) > { > +#ifdef __NetBSD__ > iconv_t cd; > int rv; > > @@ -49,11 +50,16 @@ > } > > return rumpuser_component_errtrans(rv); > +#else > + /* fallback to use stub functions */ > + return 0; > +#endif > } > > int > rumpcomp_netsmb_iconv_close(void *handle) > { > +#ifdef __NetBSD__ > int rv; > > if (iconv_close((iconv_t)handle) == -1) > @@ -62,12 +68,17 @@ > rv = 0; > > return rumpuser_component_errtrans(rv); > +#else > + /* do nothing */ > + return 0; > +#endif > } > > int > rumpcomp_netsmb_iconv_conv(void *handle, const char **inbuf, > size_t *inbytesleft, char **outbuf, size_t *outbytesleft) > { > +#ifdef __NetBSD__ > int rv; > > if (iconv((iconv_t)handle, inbuf, inbytesleft, outbuf, outbytesleft) > @@ -77,5 +88,9 @@ > rv = 0; > > return rumpuser_component_errtrans(rv); > +#else > + /* do nothing */ > + return 0; > +#endif > } > #endif