Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263888AbTH1KH0 (ORCPT ); Thu, 28 Aug 2003 06:07:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263883AbTH1KH0 (ORCPT ); Thu, 28 Aug 2003 06:07:26 -0400 Received: from mail.webmaster.com ([216.152.64.131]:42690 "EHLO shell.webmaster.com") by vger.kernel.org with ESMTP id S263908AbTH1JSD (ORCPT ); Thu, 28 Aug 2003 05:18:03 -0400 From: "David Schwartz" To: "Timo Sirainen" , Cc: "Jamie Lokier" , , "Martin Konold" , Subject: RE: Lockless file reading Date: Thu, 28 Aug 2003 02:17:55 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal In-Reply-To: <1062060035.1456.222.camel@hurina> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 874 Lines: 20 > That was my original plan, to just rely on such kernel behaviour. I just > don't know if it's such a good idea to rely on that, especially if I > want to keep my program portable. I'll probably fallback to that anyway > if my checksumming ideas won't work. If you only have one writer, why not have the writer update an MD5 checksum in the file along with the datawrite? If the reader sees an invalid checksum, it repeats the read. This is simple, elegant, and foolproof. The only possible flaw would be if you found two data sets with the same MD5 checksum. The instant fame would be well worth the inconvenience. ;) DS - 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/