linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Bobrowski <mbobrowski@mbobrowski.org>
To: Jan Kara <jack@suse.cz>
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
Date: Sat, 16 Mar 2019 23:35:21 +1100	[thread overview]
Message-ID: <20190316123519.GA27736@lithium.mbobrowski.org> (raw)
In-Reply-To: <20190313150755.GF9108@quack2.suse.cz>

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

  parent reply	other threads:[~2019-03-16 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  2:48 [RFC PATCH 0/1] fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and Directory entry events Matthew Bobrowski
2019-03-12  2:48 ` [RFC PATCH 1/1] fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events Matthew Bobrowski
2019-03-13 15:07   ` Jan Kara
2019-03-13 15:51     ` Amir Goldstein
2019-03-16 12:35     ` Matthew Bobrowski [this message]
2019-03-18 10:01       ` Jan Kara
2019-03-18 11:05         ` Amir Goldstein
2019-03-19 12:06           ` Matthew Bobrowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190316123519.GA27736@lithium.mbobrowski.org \
    --to=mbobrowski@mbobrowski.org \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).