Add two BUG_ON() in shm_stats_file_prepare() which will trigger if
exported structures (shm_stats_file_hdr and shm_stats_file_object) change
in size, because it means that they will become incompatible with older
versions and thus precautions should be taken by the developer to ensure
compatibility with olders versions, or at least detect incompatible
versions by changing the version number to prevent bugs resulting
from inconsistent mapping between versions. The BUG_ON() may be
safely adjusted then.
Please note that it doesn't protect against accidental struct member
re-ordering if the resulting struct size is equal..
int slot;
int objects;
+ BUG_ON(sizeof(struct shm_stats_file_hdr) != 672, "shm_stats_file_hdr struct size changed, "
+ "it is part of the exported API: ensure all precautions were taken (ie: shm_stats_file "
+ "version change) before adjusting this");
+ BUG_ON(sizeof(struct shm_stats_file_object) != 544, "shm_stats_file_object struct size changed, "
+ "is is part of the exported API: ensure all precautions were taken (ie: shm_stats_file "
+ "version change) before adjusting this");
+
/* do nothing if master process or shm_stats_file not configured */
if (master || !global.shm_stats_file)
return ERR_NONE;