From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9AC3C43381 for ; Sat, 16 Mar 2019 12:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 798F8218D0 for ; Sat, 16 Mar 2019 12:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=mbobrowski-org.20150623.gappssmtp.com header.i=@mbobrowski-org.20150623.gappssmtp.com header.b="TKbsgc2S" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726105AbfCPMff (ORCPT ); Sat, 16 Mar 2019 08:35:35 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39991 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726653AbfCPMff (ORCPT ); Sat, 16 Mar 2019 08:35:35 -0400 Received: by mail-pf1-f196.google.com with SMTP id y124so8183726pfy.7 for ; Sat, 16 Mar 2019 05:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mbobrowski-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3HaQGeBao7JfzFGKIHXIFXuW05oC6c/fAwMUXXn3wIM=; b=TKbsgc2Sjm7fXj6/SAl76s+VQn/ty3kCh+gX7rFtjNkWnBgxIm19JKLbYebJV0qTOl oICuYKoTun3UZUQqbnn5W7Wpz20CtVkc3/LbQmXkT4o2/8tt43+nv0dRsnvduWCYSCoa WSqvO0dH5Qu0KntrN4D0oAMRAwFlc5+jeRkWre0bvcKO/bkt67UCynhzFpSYEqmWnNXG Q1/0lF+Pbx84O2VcAxiJzCr1pqxSHBa5aIiEBceu8SHfUFZ7HmY5Ghv2zLIWCDnDheQo u2r/y0y6PpnHt3H3KwSLFs4J/31TEc0LeAaXs0cd4Kl2m7uCZT6ta3TixmzPg6fharvt OCxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3HaQGeBao7JfzFGKIHXIFXuW05oC6c/fAwMUXXn3wIM=; b=XRA4OOJM/JK0KK9pXUcSutOcss1BvAUV68CBjePzEOBcjdzechPEtWta2PrmEQsWVP vje9YUCAsYDU0PLUbHg73isncG60TEbxjYbh2DU5H4IvWG+sUq+lCHWHUW/qZ3hlfdl9 4XY5sCpNDH6oXH5bkCofpSijIngMsH7y9vcjiFrSv5tU8ZrEhXZ1af2hI8jtVKy69y3Y eTtrYMaa/DF7vPvp/xtIIGxaupabpYFlrThPq+9KhxX/qdx8ka4YsIV7Kq2R9xXI2u+o WuJjf5j94GKLW+NPeztvB3MudydlQZRDfy+zPDD8RVOM65bQat4LlHupmwbr7kBNIETC fv/g== X-Gm-Message-State: APjAAAW5Yuv/BgKum+yiuwnGTWG9gXteUJ0aaYq4fXt55zJC/czJlYLw bPXsk3sK1wlWxhrhc/Pxo22q X-Google-Smtp-Source: APXvYqwbbo/4qUx0B75Z+6vf5RMDetUUgiXIGNxu0BUIybz4DM7zZkrA55Pk8rFoWmSXnorI4J21TQ== X-Received: by 2002:a17:902:7784:: with SMTP id o4mr9841334pll.152.1552739728582; Sat, 16 Mar 2019 05:35:28 -0700 (PDT) Received: from lithium.mbobrowski.org ([103.230.158.220]) by smtp.gmail.com with ESMTPSA id d86sm15173984pfm.18.2019.03.16.05.35.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Mar 2019 05:35:27 -0700 (PDT) Date: Sat, 16 Mar 2019 23:35:21 +1100 From: Matthew Bobrowski To: Jan Kara Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, amir73il@gmail.com Subject: Re: [RFC PATCH 1/1] fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events Message-ID: <20190316123519.GA27736@lithium.mbobrowski.org> References: <20190313150755.GF9108@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313150755.GF9108@quack2.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Thanks for the feedback Jan! On Wed, Mar 13, 2019 at 04:07:55PM +0100, Jan Kara wrote: > Thanks for the manpage updates! Some small comments below. > > On Tue 12-03-19 13:48:29, Matthew Bobrowski wrote: > > +.TP > > +.B FAN_MOVED_FROM > > +Create an event when a marked file or directory is moved from the current > > +location. > > +.TP > > +.B FAN_MOVED_TO > > +Create an event when a marked file or directory is moved to a new > > +location. > > For these two events (like other directory events), marked thing is > actually again the parent directory - i.e., these events trigger is > something is moved to / from marked directory. So I think it would be > clearer and use the same language like e.g. for FAN_CREATE and speak about > marked parent directory. Sure, what changing this to: -- .B FAN_MOVED_FROM Create an event when a file or directory has been moved from a marked parent directory. .TP .B FAN_MOVED_TO Create an event when a file or directory has been moved to a marked parent directory. -- Do you think that's better? I think it's cleaner, but also at the same time more precise. > > Without this flag, only events for files are created. > > +The > > +.BR FAN_ONDIR > > +flag is reported in an event mask only if the > > +.I fanotify_fd > > +file descriptor has been initialized with the flag > > +.BR FAN_REPORT_FID . > > +In the context of directory entry events, such as > > +.BR FAN_CREATE , > > +.BR FAN_DELETE > > +and > > +.BR FAN_MOVE > > Maybe too early to speak about FAN_MOVE here as it's not defined yet? I'd > rather explicitely use FAN_MOVE_FROM and FAN_MOVE_TO here. Yes, that makes more sense. Let's change it to what you've recommended. > > diff --git a/man7/fanotify.7 b/man7/fanotify.7 > > index 74246063e..039764d30 100644 > > --- a/man7/fanotify.7 > > +++ b/man7/fanotify.7 > ... > > +.B FAN_ATTRIB > > +A file or directory metadata was changed. > > +.TP > > +.B FAN_CREATE > > +A child file or directory was created in a watched parent. > > +.TP > > +.B FAN_DELETE > > +A child file or directory was deleted in a watched parent. > > +.TP > > +.B FAN_DELETE_SELF > > +A watched file or directory was deleted. > > +.TP > > +.B FAN_MOVED_FROM > > +A watched file or directory was moved from the current location. > > +.TP > > +.B FAN_MOVED_TO > > +A watched file or directory was moved to a new location. > > The same comment here about parent directory being actually marked. Sure, intending to change this to: -- .B FAN_MOVED_FROM A file or directory has been moved from a watched parent directory. .TP .B FAN_MOVED_TO A file or directory has been moved to a watched parent directory. -- Thoughts? > > +.TP > > +.I hdr > > +This is a structure of type > > +.IR fanotify_event_info_header . > > +It is a generic header that contains information used to describe the type > > +of event. > > "type of event" seems a bit unfortunate wording here since I'd expect that > to be FAN_CREATE or whatever. I'd rather choose something like "used to > describe additional information attached to the event". Yes, that's much better wording. > > +For example, when an fanotify file descriptor is created using > > +.B FAN_REPORT_FID > > +the > > +.I info_type > > +field of this header is set to > > +.BR FAN_EVENT_INFO_TYPE_FID . > > +Event listeners can use this field to check that events of the correct > > +type are being received. > > I think here you should also speak about the 'len' field in the header > which can be used to skip additional information that is not understood / > uninteresting for the receiver of the event. I don't have any objections to add this as I do believe mentioning it has added benefit. Perhaps we could consider adding in a section which describes all the fanotify_event_info_header fields? Maybe it's not necessary though, and just mentioning these two fields here would be enough. Thoughts? > > +.TP > > +.I fsid > > +This is a unique identifier of the filesystem containing the object > > +associated with the event. > > +It is a structure of type > > +.I __kernel_fsid_t > > +and contains the same value as > > +.I f_fsid > > +when calling > > +.BR statfs (2). > > +.TP > > +.I file_handle > > +This is a variable length structure of type > > +.IR file_handle . > > +It is an opaque handle that corresponds to a specified object on a > > +filesystem as returned by > > +.BR name_at_handle_at (2) . > > name_to_handle_at (2) Woops. > > +.PP > > +The second example program output was captured from fanotify_fid. > > +There are two discrete invocations to this program with each invocation > > +accommodating a different action performed on a watched object. > > +This first session shows a mark being placed on > > +.IR /home/user . > > +This is followed by a subsequent regular file > > +.IR /home/user/testfile.txt > > +being created. > > +This results in a > > +.B FAN_CREATE > > +event being created and reported against the files parent watched > ^^^ file's ? Woops * 2. -- Matthew Bobrowski