From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
"Smith,
Stan" <stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
ofw-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org,
linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [OPENSM] match functions to prototypes in header file
Date: Thu, 1 Oct 2009 14:13:48 -0600 [thread overview]
Message-ID: <20091001201348.GK19540@obsidianresearch.com> (raw)
In-Reply-To: <4D838DBAE5F245EEA72D4466987294E1-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
On Thu, Oct 01, 2009 at 12:52:21PM -0700, Sean Hefty wrote:
> >> > @@ -1106,9 +1109,9 @@ void osm_dump_path_record(IN osm_log_t * p_log, IN
> >const ib_path_rec_t * p_pr,
> >> > "\t\t\t\tresv2...................0x%X\n"
> >> > "\t\t\t\tresv3...................0x%X\n",
> >> > cl_ntoh64(p_pr->service_id),
> >> > - inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str,
> >> > + inet_ntop(AF_INET6, (void*)p_pr->dgid.raw, gid_str,
> >>
> >> And why is such casting(s) needed?
> >
> >Casting away const like that is incorrect, fix your inet_ntop to have
> >a POSIX signature or ignore the warning.
>
> The WinOF version of inet_ntop is:
>
> const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
>
> The MS version of inet_ntop (available in vista and later) is:
>
> "The ANSI version of this function is inet_ntop"
> PCTSTR WSAAPI InetNtop(
> __in INT Family,
> __in PVOID pAddr,
> __out PTSTR pStringBuf,
> __in size_t StringBufSize
> );
>
> I'm guessing inet_ntop maps directly to InetNtop, but I can't find the
> definition in the header file. We use the MS version of the function when
> available.
Well, if windows header files are providing inet_ntop with the wrong
signature you are kinda stuck, pretty crummy thing for MS to do really.
I've fixed things like this via this approach before:
#include <windows-header.h>
#define inet_ntop my_inet_ntop
static inline const char *my_inet_ntop(int af, const void *src,
char *dst, socklen_t size)
{
return InetNtop(af,(void *)src,dst,size);
}
With #include_next it can be pretty transparent.
Hey, I ran into this the other day:
http://www.gnu.org/software/gnulib/
I wonder if it is something that might help your efforts?
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-10-01 20:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3DE88517D38A4EB0B49A2E3AAF96D005@amr.corp.intel.com>
[not found] ` <3DE88517D38A4EB0B49A2E3AAF96D005-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-10-01 18:31 ` [OPENSM] match functions to prototypes in header file Sasha Khapyorsky
2009-10-01 18:33 ` Bart Van Assche
2009-10-01 19:06 ` Sean Hefty
2009-10-01 18:51 ` Jason Gunthorpe
[not found] ` <20091001185148.GJ19540-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2009-10-01 19:52 ` Sean Hefty
[not found] ` <4D838DBAE5F245EEA72D4466987294E1-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-10-01 20:13 ` Jason Gunthorpe [this message]
2009-10-01 19:30 ` Smith, Stan
[not found] ` <3F6F638B8D880340AB536D29CD4C1E1912C86E88D1-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2009-10-01 20:22 ` [PATCH] opensm/osm_helper: remove meanless 'const' keywords Sasha Khapyorsky
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=20091001201348.GK19540@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ofw-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org \
--cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.