From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 24 Feb 2015 09:48:48 -0500 From: Steven Rostedt To: James Hogan Cc: Jeff Layton , "J. Bruce Fields" , , Trond Myklebust , Ingo Molnar , Subject: Re: [PATCH] sunrpc: Fix trace events to store data in the struct Message-ID: <20150224094848.36dc2c88@gandalf.local.home> In-Reply-To: <54EC885B.6090905@imgtec.com> References: <1424778476-28242-1-git-send-email-james.hogan@imgtec.com> <20150224090915.40d8c7ff@grimm.local.home> <54EC885B.6090905@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: On Tue, 24 Feb 2015 14:19:07 +0000 James Hogan wrote: > Hi Steven, > > On 24/02/15 14:09, Steven Rostedt wrote: > > On Tue, 24 Feb 2015 11:47:56 +0000 > > James Hogan wrote: > > > > > > > >> TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt, > >> - (struct sockaddr *)&__entry->xprt->xpt_remote, > > > > There's actually nothing wrong with the above even if xprt is NULL. > > It's not dereferencing the structure, it is just getting the address of > > what would be dereference. > > I think that corresponds to the %pIScp format which I presumed does > dereference the pointer? Ah, I missed the "__entry->xprt" part :-p > > Looking at Documentation/printk-formats.txt I see: > > > IPv4/IPv6 addresses (generic, with port, flowinfo, scope): > > ... > > %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345 > > Same applies below. Should these formats still be avoided? No, we can still use them. I assume that the %pISpc expects a "struct sockaddr" passed to it as that is what is typecast in the print. We might as well make the ss into that structure instead of a struct sockaddr_storage, as it looks like the storage one is much larger, and we only care about the sockaddr part. Let's not waste the ring buffer if we don't need to. -- Steve