From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Fri, 22 May 2009 07:56:09 +0000 Subject: Re: [PATCH] implement a more efficient queue file format Message-Id: <4A165A99.6060500@tuffmail.co.uk> List-Id: References: <4A159D09.8060806@tuffmail.co.uk> In-Reply-To: <4A159D09.8060806@tuffmail.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Kay Sievers wrote: > On Thu, May 21, 2009 at 20:27, Alan Jenkins wrote: > >> Instead of creating a file for each event, append their details to a >> log file. The file is periodically rebuilt (garbage-collected) to >> prevent it from growing indefinitely. >> > > Sounds cool. Boots fine here. :) > > I've switched a few int to unsigned int, to silent some gcc warnings, > merged the few entries in queue-private.h just into libudev-private.h, > moved the file format comments to the C file, renamed the > seqnums_are_finished() to seqnum_sequence_is_finished() and exported > it, bumped the minor version of libudev, and comitted it. > > Would be great, if you can check, that I didn't mess it up. :) > > Thanks a lot, > Kay > Wow, thanks! I checked the delta. I don't see any problems in these changes. I only see one warning myself lib/libudev-queue-export.c:143: warning: comparison between signed and unsigned 142 n = seqnum - udev_queue_export->seqnum_max; 143 if (n >= devpaths->devpaths_size) 144 goto read_error; Arguably it _might_ be better addressed in this one place, by casting devpaths_size to unsigned. It seems to be a matter of personal taste though, and I'm not complaining. I have an unverifiable memory of reading "unsigned int i is evil" on LKML. Half the internet says unsigned has relatively special semantics (intended for e.g. bit manipulation), you should avoid it unless that's what you actually need, and size_t should never have been defined as unsigned. Of course, the other half advocate using unsigned liberally to exclude negative values when passing array indexes around :-). Alan