lkml.org 
[lkml]   [2010]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 4/4] fanotify: drops the packed attribute from userspace event metadata
Date
On Monday 23 August 2010 02:37:10 Eric Paris wrote:
> #define FANOTIFY_METADATA_VERSION 1

FANOTIFY_METADATA_VERSION should be incremented, too.

> struct fanotify_event_metadata {
> __u32 event_len;
> __u32 vers;
> __u64 mask;

We don't actually care if there are any holes in this structure; all we
care about is that the structure has the same alignment on 32-bit and
64-bit architectures.

Using type aligned_u64 here instead of __u64 will do the trick.

> +#ifdef __KERNEL__
> +/* see struct fanotify_event_metadata for the reason this exists */
> +struct fan_event_meta_packed {
> + __u32 event_len;
> + __u32 vers;
> + __u64 mask;
> + __s32 fd;
> + __s32 pid;
> +} __attribute__ ((packed));

This does not add much value; the two structures can still go out of sync
A note to be careful about changes to struct fanotify_event_metadata
should really be warning enough.

Andreas


\
 
 \ /
  Last update: 2010-08-23 18:21    [W:0.094 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site