]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - megaraid.h
Merge tag 'upstream/5.42+svn3521'
[mirror_smartmontools-debian.git] / megaraid.h
index fee8ddd60df37e19d7d75756c7982ff81f7ad8b0..b1f398d63acaaf312e5f35bfef0a8450588b4425 100644 (file)
@@ -63,13 +63,20 @@ typedef struct
        uint8_t   status;
 } __attribute__((packed)) megacmd_t;
 
-typedef struct {
+typedef union {
        uint8_t   *pointer;
-#if BITS_PER_LONG == 32
-       uint8_t    pad[4];
-#endif
+       uint8_t    pad[8];
 } ptr_t;
 
+// The above definition assumes sizeof(void*) <= 8.
+// This assumption also exists in the linux megaraid device driver.
+// So define a macro to check expected size of ptr_t at compile time using
+// a dummy typedef.  On size mismatch, compiler reports a negative array
+// size.  If you see an error message of this form, it means that
+// you have an unexpected pointer size on your platform and can not
+// use megaraid support in smartmontools.
+typedef char assert_sizeof_ptr_t[sizeof(ptr_t) == 8 ? 1 : -1];
+
 struct uioctl_t
 {
        uint32_t       inlen;
@@ -212,6 +219,7 @@ struct megasas_iocpacket {
        union {
                u8 raw[128];
                struct megasas_header hdr;
+               struct megasas_pthru_frame pthru;
        } frame;
 
        struct iovec sgl[MAX_IOCTL_SGE];