[lkml]   [2010]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 4/4] fanotify: Expose the file changes to the user
    On Mon, 2010-11-29 at 19:51 +0300, Alexey Zaytsev wrote:

    [rewriting history!]
    > struct fanotify_event_metadata {
    > __u32 event_len; /* Including the options */
    > __u8 vers;
    > __u8 options_offset; /* Aka header length */
    > __u16 reserved;
    > __aligned_u64 mask;
    > __s32 fd;
    > __s32 pid;
    > /* Options go here. */
    > };

    > and let's make both vers and options_offset u8, just in case we need the
    > other 2 bytes in the future:

    So the last discussion is around vers and options_offset.

    Alexy: Tvrtko:
    __u8 vers; __u16 vers;
    __u8 options_offset; __u16 options_offset;
    __u16 unused;

    The only type of long option that first comes to mind is a filename. A
    filename could easily blow out the __u8 options_offset. I probably
    shouldn't put that in the event_metadata since it wouldn't be fixed
    length and it wouldn't allow fixed offset extention of the
    event_metadata, so maybe I shouldn't worry about it. I'm trying to
    think of reasons why __u8 isn't adequate other than my usual "just make
    it bigger than we ever need"

    You'll notice I'm using __u64 for the mask, even though we don't come
    close to filling up an __u32 at this point.

    Even though I can't think of a likely reason __u8 is bad I think I like
    the 'Tvrtko' option better. I think we should do a compromise:

    __u8 vers;
    __u8 unused;
    __u16 options_offset;

    If we ever overload vers we can expand into another field. Would could
    change unused into vers2 and define the version as vers + vers2; vers2
    could even exist somewhere else in the metadata. That can be done once
    we get to version 254 while maintaining backwards compat beyond 255. If
    we ever overflow options_offset we are screwed since old userspace
    wouldn't know how to handle things.

    So, if you want to send me a patch that implements the above (along with
    the obvious version bump to 3, I'll queue it up for this merge window
    even though we have an ABI compatible solution.


     \ /
      Last update: 2010-11-29 19:23    [W:0.031 / U:53.096 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site