Increase MAX_CPUS to 512. Use the full magic number for cpu number, not
authorJens Axboe <axboe@wiggum>
Fri, 26 Aug 2005 12:06:49 +0000 (14:06 +0200)
committerJens Axboe <axboe@wiggum>
Fri, 26 Aug 2005 12:06:49 +0000 (14:06 +0200)
just the bottom 8 bits.

blkparse.c
blktrace.c

index 818f44f449731fb1196f590cdbbb7843f3e64baa..491ad39d714f16ff23a854881267ad4d8272b08d 100644 (file)
@@ -9,7 +9,7 @@
 
 #define NELEMS(pfi) ((pfi)->stat.st_size / sizeof(struct blk_io_trace))
 
-#define MAX_CPUS       (1 << 8)        /* only 8 bits for now */
+#define MAX_CPUS       (512)
 
 struct per_file_info {
        int cpu;
@@ -363,7 +363,12 @@ int main(int argc, char *argv[])
        printf("\n\n");
 
        for (i = 0, tip = traces; i < nelems; i++, tip++) {
-               int cpu = tip->magic & 0xff;
+               int cpu = tip->magic;
+
+               if (cpu >= MAX_CPUS) {
+                       fprintf(stderr, "CPU number too large (%d)\n", cpu);
+                       return 1;
+               }
 
                current = &per_file_info[cpu];
 
index 3083f0483a6590a525265577d8e9d329c0a4da98..c7150f24c19233247da921057db7d00bdf9f30a4 100644 (file)
@@ -194,7 +194,7 @@ void *extract(void *arg)
                }
 
                /* version is verified, stuff with CPU number now */
-               t.magic = (t.magic & ~0xff) | tip->cpu;
+               t.magic = tip->cpu;
                ret = write(ofd, &t, sizeof(t));
                if (ret < 0) {
                        perror(op);