From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:32952 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727387AbfAIJLo (ORCPT ); Wed, 9 Jan 2019 04:11:44 -0500 Date: Wed, 9 Jan 2019 10:11:42 +0100 From: Jan Kara To: Amir Goldstein Cc: Jan Kara , linux-fsdevel , Vivek Trivedi , Orion Poplawski , Konstantin Khlebnikov Subject: Re: [PATCH 3/4] fanotify: Track permission event state Message-ID: <20190109091142.GA15397@quack2.suse.cz> References: <20190108164611.11440-1-jack@suse.cz> <20190108164611.11440-4-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed 09-01-19 09:22:19, Amir Goldstein wrote: > > @@ -31,7 +37,9 @@ struct fanotify_event_info { > > */ > > struct fanotify_perm_event_info { > > struct fanotify_event_info fae; > > - int response; /* userspace answer to question */ > > + unsigned int response; /* userspace answer to the event. We also use > > + * high bits of this field for recording state > > + * of the event. */ > > What's wrong with: > > short response; /* userspace answer to question */ > short state; /* the state of this event */ > > Will make for a much simpler code/patch IMO. I guess you're right. I'm somewhat cautious about types shorter than int as I do read 'state' locklessly and for shorter-than-int types compiler can do fancy things like read-modify-write cycle of a full word when storing some value in either response or state. But I think this particular case should be fine. Honza -- Jan Kara SUSE Labs, CR