On Mon 24-08-20 11:03:26, Amir Goldstein wrote: > Document fanotify_init(2) flag FAN_REPORT_NAME and the format of the > event info type FAN_EVENT_INFO_TYPE_DFID_NAME. > > The fanotify_fid.c example is extended to also report the name of the > created file or sub-directory. > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> Just one spelling fix below. Otherwise feel free to add: Reviewed-by: Jan Kara <jack@xxxxxxx> Honza > diff --git a/man2/fanotify_init.2 b/man2/fanotify_init.2 > index c58ae4493..a2e2a17fc 100644 > --- a/man2/fanotify_init.2 > +++ b/man2/fanotify_init.2 > @@ -223,6 +223,60 @@ flag, no event will be reported. > See > .BR fanotify (7) > for additional details. > +.TP > +.BR FAN_REPORT_NAME " (since Linux 5.9)" > +Events for fanotify groups initialized with this flag will contain additional > +information about the name of the directory entry correlated to an event. > +This flag must be provided in conjunction with the flag > +.BR FAN_REPORT_DIR_FID . > +Providing this flag value without > +.BR FAN_REPORT_DIR_FID > +will result in the error > +.BR EINVAL . > +This flag may be combined with the flag > +.BR FAN_REPORT_FID . > +An additional record of type > +.BR FAN_EVENT_INFO_TYPE_DFID_NAME , > +which encapsulates the information about the directory entry is included > +alongside the generic event metadata structure and substitutes the additional > +information record of type > +.BR FAN_EVENT_INFO_TYPE_DFID . > +The additional record includes a file handle that identifies a directory > +filesystem object followed by a name that identifies an entry in that > +directory. > +For the directory entry modification events > +.BR FAN_CREATE , > +.BR FAN_DELETE , > +and > +.BR FAN_MOVE , > +the reported name is that of the created/deleted/moved directory entry. > +For other events that occur on a directory object, the reported file handle > +is that of the directory object itself and the reported name is '.'. > +For other events that occur on a non-directory object, the reported file handle > +is that of the parent directory object and the reported name is the name of a > +directory entry where the object was located at the time of the event. > +The rational behind this logic is that the reported directory file handle can ^^^^^^^ rationale -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR