/* Unknown activity */
continue;
- skip = FALSE;
- if (fal->magic != act[p]->magic) {
- /* Bad magical number */
- if (DISPLAY_HDR_ONLY(flags)) {
- /*
- * This is how sadf -H knows that this
- * activity has an unknown format.
- */
- act[p]->magic = ACTIVITY_MAGIC_UNKNOWN;
- }
- else {
- skip = TRUE;
- }
+ if ((fal->magic != act[p]->magic) && !DISPLAY_HDR_ONLY(flags)) {
+ skip = TRUE;
+ }
+ else {
+ skip = FALSE;
}
/* Check max value for known activities */
/*
* Number of fields of each type ("long long", or "long"
* or "int") composing the structure with statistics may
- * only increase with new sysstat versions. Here, we may
+ * only increase with new sysstat versions, unless we change
+ * the activity's magic number. Here, we may
* be reading a file created by current sysstat version,
* or by an older or a newer version.
*/
((fal->types_nr[0] <= act[p]->gtypes_nr[0]) &&
(fal->types_nr[1] <= act[p]->gtypes_nr[1]) &&
(fal->types_nr[2] <= act[p]->gtypes_nr[2]))) &&
- (act[p]->magic != ACTIVITY_MAGIC_UNKNOWN) && !DISPLAY_HDR_ONLY(flags)) {
- /*
- * This may not be an error (that's actually why we may have changed
- * the magic number for this activity above).
- * So, if the activity magic number has changed (e.g.: ACTIVITY_MAGIC_UNKNOWN)
- * and we want to display only the header, then ignore the error.
- * If we want to also display the stats then we must stop here because
- * we won't know how to map the contents of the stats structure.
- */
+ (fal->magic == act[p]->magic) && !DISPLAY_HDR_ONLY(flags)) {
#ifdef DEBUG
fprintf(stderr, "%s: id=%d file=%d,%d,%d activity=%d,%d,%d\n",
__FUNCTION__, fal->id, fal->types_nr[0], fal->types_nr[1], fal->types_nr[2],
goto format_error;
}
- if (skip)
- /*
- * This is an unknown activity and we want stats about it:
- * This is not possible so skip it.
- */
- continue;
-
for (k = 0; k < 3; k++) {
act[p]->ftypes_nr[k] = fal->types_nr[k];
}
act[p]->nr_ini = fal->nr;
act[p]->nr2 = fal->nr2;
act[p]->fsize = fal->size;
+
/*
* This is a known activity with a known format
* (magical number). Only such activities will be displayed.
* (Well, this may also be an unknown format if we have entered sadf -H.)
*/
- id_seq[j++] = fal->id;
+ if (!skip) {
+ id_seq[j++] = fal->id;
+ }
}
while (j < NR_ACT) {