• Amir Goldstein's avatar
    fanotify: use struct fanotify_info to parcel the variable size buffer · f454fa61
    Amir Goldstein authored
    An fanotify event name is always recorded relative to a dir fh.
    Encapsulate the name_len member of fanotify_name_event in a new struct
    fanotify_info, which describes the parceling of the variable size
    buffer of an fanotify_name_event.
    
    The dir_fh member of fanotify_name_event is renamed to _dir_fh and is not
    accessed directly, but via the fanotify_info_dir_fh() accessor.
    Although the dir_fh len information is already available in struct
    fanotify_fh, we store it also in dif_fh_totlen member of fanotify_info,
    including the size of fanotify_fh header, so we know the offset of the
    name in the buffer without looking inside the dir_fh.
    
    We also add a file_fh_totlen member to allow packing another file handle
    in the variable size buffer after the dir_fh and before the name.
    We are going to use that space to store the child fid.
    
    Link: https://lore.kernel.org/r/20200716084230.30611-10-amir73il@gmail.comSigned-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    f454fa61
fanotify.h 7.37 KB