]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
Cleanup warnings at ras-aer-handler.c
authorMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 23 May 2013 17:26:07 +0000 (14:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 23 May 2013 17:26:07 +0000 (14:26 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Makefile.am
bitfield.c
bitfield.h
ras-aer-handler.c
ras-mce-handler.c
ras-mce-handler.h

index e6fd1b1dad8c8ef290c61eb9bf86adde2af9b14f..bc6059b468d709b99bb8b714a6996318bf82ee85 100644 (file)
@@ -3,7 +3,8 @@ SUBDIRS = libtrace util man
 EXTRA_DIST = misc/rasdaemon.service misc/ras-mc-ctl.service
 
 sbin_PROGRAMS = rasdaemon
-rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c
+rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c \
+                   bitfield.c
 if WITH_SQLITE3
    rasdaemon_SOURCES += ras-record.c
 endif
@@ -12,7 +13,7 @@ if WITH_AER
 endif
 if WITH_MCE
    rasdaemon_SOURCES += ras-mce-handler.c mce-intel.c mce-amd-k8.c \
-                       bitfield.c mce-intel-p4-p6.c mce-intel-nehalem.c \
+                       mce-intel-p4-p6.c mce-intel-nehalem.c \
                        mce-intel-dunnington.c mce-intel-tulsa.c \
                        mce-intel-sb.c mce-intel-ivb.c
 endif
index 4085df379d28068d569f65c5ff146acc6a20a5b1..b2895b425d33554293728555bff07e4a16b85e30 100644 (file)
 #include "ras-mce-handler.h"
 #include "bitfield.h"
 
-char *reserved_3bits[8];
-char *reserved_1bit[2];
-char *reserved_2bits[4];
+unsigned bitfield_msg(char *buf, size_t len, const char **bitarray,
+                     unsigned array_len,
+                     unsigned bit_offset, unsigned ignore_bits,
+                     uint64_t status)
+{
+       int i, n;
+       char *p = buf;
+
+       len--;
+
+       for (i = 0; i < array_len; i++) {
+               if (status & ignore_bits)
+                       continue;
+               if (status & (1 <<  (i + bit_offset))) {
+                       if (p != buf) {
+                               n = snprintf(p, len, ", ");
+                               len -= n;
+                               p += n;
+                       }
+                       if (!bitarray[i])
+                               n = snprintf(p, len, "BIT%d", i + bit_offset);
+                       else
+                               n = snprintf(p, len, "%s", bitarray[i]);
+                       len -= n;
+                       p += n;
+               }
+       }
+
+       *p = 0;
+       return p - buf;
+}
 
 static uint64_t bitmask(uint64_t i)
 {
@@ -41,7 +69,6 @@ void decode_bitfield(struct mce_event *e, uint64_t status,
                     struct field *fields)
 {
        struct field *f;
-       char buf[60];
 
        for (f = fields; f->str; f++) {
                uint64_t v = (status >> f->start_bit) & bitmask(f->stringlen - 1);
@@ -52,7 +79,7 @@ void decode_bitfield(struct mce_event *e, uint64_t status,
                        if (v == 0)
                                continue;
                        mce_snprintf(e->error_msg, "<%u:%llx>",
-                                    f->start_bit, v);
+                                    f->start_bit, (long long)v);
                }
        }
 }
index 05392d4126132c9902127e913eb2f27ece20fc29..c7dfeb1fb8d8e13b55ff00e75cebf78e5fb67904 100644 (file)
@@ -17,6 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
 
+#include <stdint.h>
+
 /* Generic bitfield decoder */
 
 struct field {
@@ -40,6 +42,8 @@ struct numfield {
 #define HEXNUMBER(start, end, name) { start, end, name, "%Lx", 0 }
 #define HEXNUMBERFORCE(start, end, name) { start, end, name, "%Lx", 1 }
 
+struct mce_event;
+
 void decode_bitfield(struct mce_event *e, uint64_t status,
                     struct field *fields);
 void decode_numfield(struct mce_event *e, uint64_t status,
@@ -52,3 +56,10 @@ static inline int test_prefix(int nr, uint32_t value)
 {
        return ((value >> nr) == 1);
 }
+
+/* Ancillary routines */
+
+unsigned bitfield_msg(char *buf, size_t len, const char **bitarray,
+                     unsigned array_len,
+                     unsigned bit_offset, unsigned ignore_bits,
+                     uint64_t status);
index 6f13fbf9e6884fa491c1cf6ec4eac1a6fa4c7189..ec63e2a5a0331ad3c15b52478d30f810a3c856c5 100644 (file)
@@ -23,6 +23,7 @@
 #include "ras-aer-handler.h"
 #include "ras-record.h"
 #include "ras-logger.h"
+#include "bitfield.h"
 
 static const char *aer_errors[32] = {
        /* Correctable errors */
index c1e88a654b39a835c4cd754e780e476414be585b..6014753bb8a971625b42ced0bcc1f1343e5795cd 100644 (file)
@@ -203,37 +203,6 @@ int register_mce_handler(struct ras_events *ras)
  * End of mcelog's code
  */
 
-unsigned bitfield_msg(char *buf, size_t len, char **bitarray, unsigned array_len,
-                     unsigned bit_offset, unsigned ignore_bits,
-                     uint64_t status)
-{
-       int i, n;
-       char *p = buf;
-
-       len--;
-
-       for (i = 0; i < array_len; i++) {
-               if (status & ignore_bits)
-                       continue;
-               if (status & (1 <<  (i + bit_offset))) {
-                       if (p != buf) {
-                               n = snprintf(p, len, ", ");
-                               len -= n;
-                               p += n;
-                       }
-                       if (!bitarray[i])
-                               n = snprintf(p, len, "BIT%d", i + bit_offset);
-                       else
-                               n = snprintf(p, len, "%s", bitarray[i]);
-                       len -= n;
-                       p += n;
-               }
-       }
-
-       *p = 0;
-       return p - buf;
-}
-
 static void report_mce_event(struct ras_events *ras,
                             struct pevent_record *record,
                             struct trace_seq *s, struct mce_event *e)
index 7a7fd450b2eb79d9fc3ea6ab0030d5f568b15c7b..dc28f092b6aeeb71be02b597321904ec84204ded 100644 (file)
@@ -102,12 +102,6 @@ int ras_mce_event_handler(struct trace_seq *s,
                          struct pevent_record *record,
                          struct event_format *event, void *context);
 
-/* Ancillary routines */
-
-unsigned bitfield_msg(char *buf, size_t len, char **bitarray, unsigned array_len,
-                     unsigned bit_offset, unsigned ignore_bits,
-                     uint64_t status);
-
 /* Per-CPU-type decoders for Intel CPUs */
 void p4_decode_model(struct mce_event *e);
 void core2_decode_model(struct mce_event *e);