Re: [RFC PATCH 1/1] fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 13, 2019 at 5:07 PM Jan Kara <jack@xxxxxxx> 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.
>
> >  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.
>
> > 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.
>
> > +.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".
>
> > +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.
>

Well, one thing I think we should avoid is to overload reader with
how those fields would be used in future expansion on the API.

There is a good example in this very man page:
event_len
      ...
      In the current implementation, the value of event_len is always
      FAN_EVENT_METADATA_LEN.  However, the API is designed to
      allow variable-length structures to be returned in the future.

So I think 'len' field should get a similar treatment -
In the current implementation, the value of len is always
event_len -  FAN_EVENT_METADATA_LEN. However, the API...

And now we see that the wording of event_len should
be fixed with this patch, because the future is here ;-)

Thanks,
Amir.



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux