Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758421AbbLBOFZ (ORCPT ); Wed, 2 Dec 2015 09:05:25 -0500 Received: from smtprelay0223.hostedemail.com ([216.40.44.223]:47148 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757381AbbLBOFV (ORCPT ); Wed, 2 Dec 2015 09:05:21 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2902:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4470:5007:6261:7875:10004:10400:10848:10967:11232:11658:11914:12517:12519:12555:12740:13069:13160:13229:13311:13357:14096:14097:14659:21063:21080:30054:30079:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: beds10_113194afbc25b X-Filterd-Recvd-Size: 3099 Date: Wed, 2 Dec 2015 09:05:17 -0500 From: Steven Rostedt To: Russell King - ARM Linux Cc: Michal Marek , Thomas Petazzoni , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Arnd Bergmann , linux-kbuild@vger.kernel.org, linux-arm-msm@vger.kernel.org, Nicolas Pitre , Stephen Boyd , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Message-ID: <20151202090517.432556a4@gandalf.local.home> In-Reply-To: <20151202102339.GB8644@n2100.arm.linux.org.uk> References: <20151125234711.GT8644@n2100.arm.linux.org.uk> <565C6714.802@suse.com> <20151130153208.GR8644@n2100.arm.linux.org.uk> <565C6DE9.2020302@suse.com> <565DC5A9.2010305@suse.cz> <20151201161944.GX8644@n2100.arm.linux.org.uk> <20151201114929.655433a2@gandalf.local.home> <20151201171014.GY8644@n2100.arm.linux.org.uk> <20151201122212.474afce5@gandalf.local.home> <20151201181643.GZ8644@n2100.arm.linux.org.uk> <20151202102339.GB8644@n2100.arm.linux.org.uk> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1721 Lines: 55 On Wed, 2 Dec 2015 10:23:39 +0000 Russell King - ARM Linux wrote: > On Tue, Dec 01, 2015 at 06:16:43PM +0000, Russell King - ARM Linux wrote: > > On Tue, Dec 01, 2015 at 12:22:12PM -0500, Steven Rostedt wrote: > > > I guess another solution is to do a copy instead of modifying in place > > > if it detects the multiple hard link? > > > > That would be the "transparent" solution. If you think it's worth > > persuing, I'll have a go at fixing recordmcount to do that. > > Well, copying the file is easy - I've tested this and the linker > appears happy with the result: Want to make this into a proper patch and I'll start running it through my tests? -- Steve > > scripts/recordmcount.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c > index 698768bdc581..91705ef30402 100644 > --- a/scripts/recordmcount.c > +++ b/scripts/recordmcount.c > @@ -211,6 +211,20 @@ static void *mmap_file(char const *fname) > addr = umalloc(sb.st_size); > uread(fd_map, addr, sb.st_size); > } > + if (sb.st_nlink != 1) { > + /* file is hard-linked, break the hard link */ > + close(fd_map); > + if (unlink(fname) < 0) { > + perror(fname); > + fail_file(); > + } > + fd_map = open(fname, O_RDWR | O_CREAT, sb.st_mode); > + if (fd_map < 0) { > + perror(fname); > + fail_file(); > + } > + uwrite(fd_map, addr, sb.st_size); > + } > return addr; > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/