2 * sa_conv.c: Convert an old format sa file to the up-to-date format.
3 * (C) 1999-2021 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
35 # define _(string) gettext(string)
37 # define _(string) (string)
40 extern int endian_mismatch;
41 extern unsigned int user_hz;
42 extern unsigned int act_types_nr[];
43 extern unsigned int rec_types_nr[];
44 extern unsigned int hdr_types_nr[];
46 unsigned int oact_types_nr[] = {OLD_FILE_ACTIVITY_ULL_NR, OLD_FILE_ACTIVITY_UL_NR, OLD_FILE_ACTIVITY_U_NR};
49 ***************************************************************************
50 * Read and upgrade file's magic data section.
53 * @dfile System activity data file name.
54 * @stdfd File descriptor for STDOUT.
57 * @fd File descriptor for sa datafile to convert.
58 * @file_magic File's magic structure.
59 * @hdr_size Size of header structure read from file.
61 * Format magic number of file to convert, converted to
64 * TRUE if data read from file don't match current machine's
68 * -1 on error, 0 otherwise.
69 ***************************************************************************
71 int upgrade_magic_section(char dfile[], int *fd, int stdfd, struct file_magic *file_magic,
72 unsigned int *hdr_size, int *previous_format, int *endian_mismatch)
75 unsigned int fm_types_nr[] = {FILE_MAGIC_ULL_NR, FILE_MAGIC_UL_NR, FILE_MAGIC_U_NR};
77 /* Open and read sa magic structure */
78 sa_open_read_magic(fd, dfile, file_magic, TRUE, endian_mismatch, FALSE);
80 switch (file_magic->format_magic) {
83 case FORMAT_MAGIC_SWAPPED:
84 *previous_format = FORMAT_MAGIC;
88 case FORMAT_MAGIC_2171:
89 case FORMAT_MAGIC_2171_SWAPPED:
90 *previous_format = FORMAT_MAGIC_2171;
93 case FORMAT_MAGIC_2173:
94 case FORMAT_MAGIC_2173_SWAPPED:
95 *previous_format = FORMAT_MAGIC_2173;
99 fprintf(stderr, _("Cannot convert the format of this file\n"));
104 fprintf(stderr, "file_magic: ");
105 if (*previous_format == FORMAT_MAGIC_2171) {
107 * We have read too many bytes: file_magic structure
108 * was smaller with previous sysstat versions.
109 * Go back 4 (unsigned int header_size) + 64 (char pad[64]) bytes.
111 if (lseek(*fd, -68, SEEK_CUR) < 0) {
112 fprintf(stderr, "\nlseek: %s\n", strerror(errno));
117 /* Set format magic number to that of current version */
118 file_magic->format_magic = (*endian_mismatch ? FORMAT_MAGIC_SWAPPED
121 /* Save original header structure's size */
122 *hdr_size = file_magic->header_size;
124 /* Fill new structure members */
125 file_magic->header_size = FILE_HEADER_SIZE;
126 file_magic->hdr_types_nr[0] = FILE_HEADER_ULL_NR;
127 file_magic->hdr_types_nr[1] = FILE_HEADER_UL_NR;
128 file_magic->hdr_types_nr[2] = FILE_HEADER_U_NR;
129 memset(file_magic->pad, 0, sizeof(unsigned char) * FILE_MAGIC_PADDING);
131 /* Indicate that file has been upgraded */
132 enum_version_nr(&fm);
133 file_magic->upgraded = (fm.sysstat_patchlevel << 8) +
134 fm.sysstat_sublevel + 1;
136 memcpy(&fm, file_magic, FILE_MAGIC_SIZE);
137 /* Restore endianness before writing */
138 if (*endian_mismatch) {
139 /* Start swapping at field "header_size" position */
140 swap_struct(fm_types_nr, &(fm.header_size), 0);
143 /* Write file's magic structure */
144 if (write_all(stdfd, &fm, FILE_MAGIC_SIZE) != FILE_MAGIC_SIZE) {
145 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
148 fprintf(stderr, "OK\n");
154 ***************************************************************************
155 * Upgrade file_header structure (from 0x2171 format to current format).
158 * @buffer File's header structure (as read from file).
160 * Format magic number of file to convert.
162 * TRUE if data read from file don't match current
163 * machine's endianness.
166 * @file_hdr File's header structure (up-to-date format).
167 * @arch_64 TRUE if file's data come from a 64-bit machine.
168 * @vol_act_nr Number of volatile activity structures following a restart
169 * record for 0x2173 file format.
170 ***************************************************************************
172 void upgrade_file_header(void *buffer, struct file_header *file_hdr, int previous_format,
173 int endian_mismatch, int *arch_64, unsigned int *vol_act_nr)
175 struct file_header_2171 *f_hdr_2171 = (struct file_header_2171 *) buffer;
176 struct file_header_2173 *f_hdr_2173 = (struct file_header_2173 *) buffer;
177 unsigned int hdr_2171_types_nr[] = {FILE_HEADER_2171_ULL_NR, FILE_HEADER_2171_UL_NR, FILE_HEADER_2171_U_NR};
178 unsigned int hdr_2173_types_nr[] = {FILE_HEADER_2173_ULL_NR, FILE_HEADER_2173_UL_NR, FILE_HEADER_2173_U_NR};
181 memset(file_hdr, 0, FILE_HEADER_SIZE);
182 file_hdr->sa_hz = HZ;
184 if (previous_format == FORMAT_MAGIC_2171) {
185 *arch_64 = (f_hdr_2171->sa_sizeof_long == SIZEOF_LONG_64BIT);
187 /* Normalize endianness for f_hdr_2171 structure */
188 if (endian_mismatch) {
189 swap_struct(hdr_2171_types_nr, f_hdr_2171, *arch_64);
192 file_hdr->sa_ust_time = (unsigned long long) f_hdr_2171->sa_ust_time;
193 /* sa_cpu_nr field will be updated later */
194 file_hdr->sa_act_nr = f_hdr_2171->sa_act_nr;
195 file_hdr->sa_year = (int) f_hdr_2171->sa_year;
196 file_hdr->sa_day = f_hdr_2171->sa_day;
197 file_hdr->sa_month = f_hdr_2171->sa_month;
198 file_hdr->sa_sizeof_long = f_hdr_2171->sa_sizeof_long;
199 strncpy(file_hdr->sa_sysname, f_hdr_2171->sa_sysname, sizeof(file_hdr->sa_sysname));
200 file_hdr->sa_sysname[sizeof(file_hdr->sa_sysname) - 1] = '\0';
201 strncpy(file_hdr->sa_nodename, f_hdr_2171->sa_nodename, sizeof(file_hdr->sa_nodename));
202 file_hdr->sa_nodename[sizeof(file_hdr->sa_nodename) - 1] = '\0';
203 strncpy(file_hdr->sa_release, f_hdr_2171->sa_release, sizeof(file_hdr->sa_release));
204 file_hdr->sa_release[sizeof(file_hdr->sa_release) - 1] = '\0';
205 strncpy(file_hdr->sa_machine, f_hdr_2171->sa_machine, sizeof(file_hdr->sa_machine));
206 file_hdr->sa_machine[sizeof(file_hdr->sa_machine) - 1] = '\0';
209 else if (previous_format == FORMAT_MAGIC_2173) {
210 *arch_64 = (f_hdr_2173->sa_sizeof_long == SIZEOF_LONG_64BIT);
212 /* Normalize endianness for f_hdr_2171 structure */
213 if (endian_mismatch) {
214 swap_struct(hdr_2173_types_nr, f_hdr_2173, *arch_64);
217 file_hdr->sa_ust_time = (unsigned long long) f_hdr_2173->sa_ust_time;
218 /* sa_cpu_nr field will be updated later */
219 file_hdr->sa_act_nr = f_hdr_2173->sa_act_nr;
220 file_hdr->sa_year = (int) f_hdr_2173->sa_year;
221 file_hdr->sa_day = f_hdr_2173->sa_day;
222 file_hdr->sa_month = f_hdr_2173->sa_month;
223 file_hdr->sa_sizeof_long = f_hdr_2173->sa_sizeof_long;
224 strncpy(file_hdr->sa_sysname, f_hdr_2173->sa_sysname, UTSNAME_LEN);
225 file_hdr->sa_sysname[UTSNAME_LEN - 1] = '\0';
226 strncpy(file_hdr->sa_nodename, f_hdr_2173->sa_nodename, UTSNAME_LEN);
227 file_hdr->sa_nodename[UTSNAME_LEN - 1] = '\0';
228 strncpy(file_hdr->sa_release, f_hdr_2173->sa_release, UTSNAME_LEN);
229 file_hdr->sa_release[UTSNAME_LEN - 1] = '\0';
230 strncpy(file_hdr->sa_machine, f_hdr_2173->sa_machine, UTSNAME_LEN);
231 file_hdr->sa_machine[UTSNAME_LEN - 1] = '\0';
233 *vol_act_nr = f_hdr_2173->sa_vol_act_nr;
236 for (i = 0; i < 3; i++) {
237 file_hdr->act_types_nr[i] = act_types_nr[i];
238 file_hdr->rec_types_nr[i] = rec_types_nr[i];
240 file_hdr->act_size = FILE_ACTIVITY_SIZE;
241 file_hdr->rec_size = RECORD_HEADER_SIZE;
244 * Note: @extra_next and @sa_tzname[] members are set to zero
245 * because file_hdr has been memset'd to zero.
250 ***************************************************************************
251 * Read and upgrade file's header section.
254 * @dfile System activity data file name.
255 * @fd File descriptor for sa datafile to convert.
256 * @stdfd File descriptor for STDOUT.
257 * @act Array of activities.
258 * @file_magic File's magic structure.
259 * @hdr_size Size of header structure read from file.
261 * Format magic number of file to convert.
263 * TRUE if data read from file don't match current machine's
267 * @file_hdr File's header structure (up-to-date format).
268 * @arch_64 TRUE if file's data come from a 64-bit machine.
269 * @vol_act_nr Number of volatile activity structures following a restart
270 * record for 0x2173 file format.
272 * Activity list in file.
275 * -1 on error, 0 otherwise.
276 ***************************************************************************
278 int upgrade_header_section(char dfile[], int fd, int stdfd, struct activity *act[],
279 struct file_magic *file_magic, struct file_header *file_hdr,
280 unsigned int hdr_size, int previous_format, int *arch_64,
281 int endian_mismatch, unsigned int *vol_act_nr,
282 struct old_file_activity **ofile_actlst)
284 struct old_file_activity *ofal;
285 struct file_header fh;
287 unsigned int a_cpu = FALSE;
290 fprintf(stderr, "file_header: ");
292 /* Read file header structure */
293 n = (previous_format == FORMAT_MAGIC_2171 ? FILE_HEADER_SIZE_2171
295 SREALLOC(buffer, char, n);
296 sa_fread(fd, buffer, (size_t) n, HARD_SIZE, UEOF_STOP);
298 /* Upgrade file_header structure */
299 upgrade_file_header(buffer, file_hdr, previous_format,
300 endian_mismatch, arch_64, vol_act_nr);
305 if (file_hdr->sa_act_nr > MAX_NR_ACT)
308 /* Read file activity list */
309 SREALLOC(*ofile_actlst, struct old_file_activity, OLD_FILE_ACTIVITY_SIZE * file_hdr->sa_act_nr);
310 ofal = *ofile_actlst;
312 for (i = 0; i < file_hdr->sa_act_nr; i++, ofal++) {
314 sa_fread(fd, ofal, OLD_FILE_ACTIVITY_SIZE, HARD_SIZE, UEOF_STOP);
316 /* Normalize endianness for file_activity structures */
317 if (endian_mismatch) {
318 swap_struct(oact_types_nr, ofal, *arch_64);
321 if ((ofal->nr < 1) || (ofal->nr2 < 1))
323 * Every activity, known or unknown,
324 * should have at least one item and sub-item.
328 if ((p = get_activity_position(act, ofal->id, RESUME_IF_NOT_FOUND)) >= 0) {
329 /* This is a known activity, maybe with an unknown format */
331 if ((ofal->id == A_CPU) && !a_cpu) {
333 * We have found the CPU activity: Set sa_cpu_nr field
334 * in file_header structure that should contains the
335 * number of CPU when the file was created.
337 file_hdr->sa_cpu_nr = ofal->nr;
342 if (!ofal->size || (ofal->size > MAX_ITEM_STRUCT_SIZE))
346 * When upgrading a file:
347 * ofal->size : Size of an item for current activity, as
348 * read from the file.
349 * act[p]->msize: Size of the buffer in memory where an item
350 * for current activity, as read from the file,
351 * will be saved. We have:
352 * act[p]->msize >= {ofal->size ; act[p]->fsize}
353 * act[p]->fsize: Size of an item for current activity with
357 /* Size of activity in file is larger than up-to-date activity size */
358 if (ofal->size > act[p]->msize) {
359 act[p]->msize = ofal->size;
362 * Don't set act[p]->fsize! Should retain the size of an item
363 * for up-to-date format!
366 if ((ofal->id == A_IRQ) && (ofal->magic < ACTIVITY_MAGIC_BASE + 2)) {
367 /* Special processing for A_IRQ activity */
368 act[p]->nr_ini = 1; /* Only CPU "all" */
369 act[p]->nr2 = ofal->nr; /* Number of interrupts in file */
372 act[p]->nr_ini = ofal->nr;
373 act[p]->nr2 = ofal->nr2;
380 * CPU activity should always be in file for versions older than 11.7.1
381 * and have a known format (expected magical number).
383 fprintf(stderr, _("\nCPU activity not found in file. Aborting...\n"));
387 memcpy(&fh, file_hdr, FILE_HEADER_SIZE);
388 /* Restore endianness before writing */
389 if (endian_mismatch) {
390 /* Start swapping at field "header_size" position */
391 swap_struct(hdr_types_nr, &fh, *arch_64);
394 /* Write file_header structure */
395 if ((n = write_all(stdfd, &fh, FILE_HEADER_SIZE)) != FILE_HEADER_SIZE) {
396 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
400 fprintf(stderr, "OK\n");
406 fprintf(stderr, _("\nInvalid data found. Aborting...\n"));
413 ***************************************************************************
414 * Convert a long integer value to a long long integer value.
415 * The long integer value may be 32 or 64-bit wide and come from a 32 or
416 * 64-bit architecture.
418 * Note: Consider the value 0x01020304 read on a 32-bit machine.
419 * Big-endian, saved as: 01 02 03 04
420 * Lille-endian, saved as: 04 03 02 01
421 * The value should be saved as a 64-bit value and endianness should be
423 * Big-endian: 00 00 00 00 01 02 03 04
424 * Little-endian: 04 03 02 01 00 00 00 00
427 * @buffer Address of value to convert.
429 * TRUE if data read from file don't match current machine's
431 * @arch_64 TRUE if file's data come from a 64-bit machine.
432 ***************************************************************************
434 unsigned long long moveto_long_long(void *buffer, int endian_mismatch, int arch_64)
437 unsigned long long *ull_int, ull_i;
440 ull_int = (unsigned long long *) buffer;
444 u_int = (unsigned int *) buffer;
445 if (endian_mismatch) {
446 ull_i = (unsigned long long) *u_int;
447 return (ull_i >> 32) | (ull_i << 32);
450 return (unsigned long long) *u_int;
455 ***************************************************************************
456 * Upgrade stats_cpu structure (from ACTIVITY_MAGIC_BASE format to
457 * ACTIVITY_MAGIC_BASE + 1 format).
460 * @act Array of activities.
461 * @p Position of activity in array.
462 * @st_size Size of the structure read from file.
463 ***************************************************************************
465 void upgrade_stats_cpu(struct activity *act[], int p, int st_size)
468 struct stats_cpu *scc;
469 struct stats_cpu_8a *scp;
471 for (i = 0; i < act[p]->nr_ini; i++) {
473 * For previous structure's format: Use msize (which has possibly been set to
474 * the size of the structure read from disk if it's greater than that of
475 * current format: See upgrade_header_section()).
476 * For current structure format: Use fsize. This is the normal size of
477 * structure's up-to-date format that will be written to file.
479 scp = (struct stats_cpu_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
480 scc = (struct stats_cpu *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
482 scc->cpu_user = scp->cpu_user;
483 scc->cpu_nice = scp->cpu_nice;
484 scc->cpu_sys = scp->cpu_sys;
485 scc->cpu_idle = scp->cpu_idle;
486 scc->cpu_iowait = scp->cpu_iowait;
487 scc->cpu_steal = scp->cpu_steal;
488 scc->cpu_hardirq = scp->cpu_hardirq;
489 scc->cpu_softirq = scp->cpu_softirq;
490 scc->cpu_guest = scp->cpu_guest;
492 if (st_size >= STATS_CPU_8A_SIZE) {
493 /* guest_nice field has been added without a structure format change */
494 scc->cpu_guest_nice = scp->cpu_guest_nice;
500 ***************************************************************************
501 * Upgrade stats_pcsw structure (from ACTIVITY_MAGIC_BASE format to
502 * ACTIVITY_MAGIC_BASE + 1 format).
505 * @act Array of activities.
506 * @p Position of activity in array.
507 ***************************************************************************
509 void upgrade_stats_pcsw(struct activity *act[], int p)
511 struct stats_pcsw *spc = (struct stats_pcsw *) act[p]->buf[1];
512 struct stats_pcsw_8a *spp = (struct stats_pcsw_8a *) act[p]->buf[0];
514 spc->context_switch = spp->context_switch;
516 * Copy a long into a long. Take into account that file may have been
517 * created on a 64-bit machine and we may be converting on a 32-bit machine.
519 memcpy(&spc->processes, &spp->processes, 8);
523 ***************************************************************************
524 * Upgrade stats_irq structure (from ACTIVITY_MAGIC_BASE format to
525 * ACTIVITY_MAGIC_BASE + 1 format).
528 * @act Array of activities.
529 * @p Position of activity in array.
530 * @magic Structure format magic value.
531 ***************************************************************************
533 void upgrade_stats_irq(struct activity *act[], int p, unsigned int magic)
536 struct stats_irq *sic;
538 if (magic == ACTIVITY_MAGIC_BASE) {
539 struct stats_irq_8a *sip;
541 /* For each interrupt saved in the file to convert */
542 for (i = 0; i < act[p]->nr2; i++) {
543 sip = (struct stats_irq_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
544 sic = (struct stats_irq *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
546 /* Hum... Probably something to do if there is an endian mismatch... */
547 sic->irq_nr = (unsigned int) sip->irq_nr;
549 /* This is interrupts "sum" */
550 strcpy(sic->irq_name, K_LOWERSUM);
553 sprintf(sic->irq_name, "%d", i - 1);
558 struct stats_irq_8b *sip;
560 for (i = 0; i < act[p]->nr2; i++) {
561 sip = (struct stats_irq_8b *) ((char *) act[p]->buf[0] + i * act[p]->msize);
562 sic = (struct stats_irq *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
564 /* Endian mismatch should be tested before... */
565 sic->irq_nr = (unsigned int) sip->irq_nr;
567 /* This is interrupts "sum" */
568 strcpy(sic->irq_name, K_LOWERSUM);
571 sprintf(sic->irq_name, "%d", i - 1);
578 ***************************************************************************
579 * Upgrade stats_io structure (from ACTIVITY_MAGIC_BASE format to
580 * ACTIVITY_MAGIC_BASE + 1 format).
583 * @act Array of activities.
584 * @p Position of activity in array.
586 * TRUE if data read from file don't match current machine's
588 ***************************************************************************
590 void upgrade_stats_io(struct activity *act[], int p, int endian_mismatch)
592 struct stats_io *sic = (struct stats_io *) act[p]->buf[1];
593 struct stats_io_8a *sip = (struct stats_io_8a *) act[p]->buf[0];
595 sic->dk_drive = moveto_long_long(&sip->dk_drive, endian_mismatch, FALSE);
596 sic->dk_drive_rio = moveto_long_long(&sip->dk_drive_rio, endian_mismatch, FALSE);
597 sic->dk_drive_wio = moveto_long_long(&sip->dk_drive_wio, endian_mismatch, FALSE);
598 sic->dk_drive_rblk = moveto_long_long(&sip->dk_drive_rblk, endian_mismatch, FALSE);
599 sic->dk_drive_wblk = moveto_long_long(&sip->dk_drive_wblk, endian_mismatch, FALSE);
603 ***************************************************************************
604 * Upgrade stats_memory structure (from ACTIVITY_MAGIC_BASE format to
605 * ACTIVITY_MAGIC_BASE + 1 format).
608 * @act Array of activities.
609 * @p Position of activity in array.
610 * @st_size Size of the structure read from file.
612 * TRUE if data read from file don't match current machine's
614 * @arch_64 TRUE if file's data come from a 64-bit machine.
615 ***************************************************************************
617 void upgrade_stats_memory(struct activity *act[], int p, int st_size,
618 int endian_mismatch, int arch_64)
620 struct stats_memory *smc = (struct stats_memory *) act[p]->buf[1];
621 struct stats_memory_8a *smp = (struct stats_memory_8a *) act[p]->buf[0];
623 smc->frmkb = moveto_long_long(&smp->frmkb, endian_mismatch, arch_64);
624 smc->bufkb = moveto_long_long(&smp->bufkb, endian_mismatch, arch_64);
625 smc->camkb = moveto_long_long(&smp->camkb, endian_mismatch, arch_64);
626 smc->tlmkb = moveto_long_long(&smp->tlmkb, endian_mismatch, arch_64);
627 smc->frskb = moveto_long_long(&smp->frskb, endian_mismatch, arch_64);
628 smc->tlskb = moveto_long_long(&smp->tlskb, endian_mismatch, arch_64);
629 smc->caskb = moveto_long_long(&smp->caskb, endian_mismatch, arch_64);
630 smc->comkb = moveto_long_long(&smp->comkb, endian_mismatch, arch_64);
631 smc->activekb = moveto_long_long(&smp->activekb, endian_mismatch, arch_64);
632 smc->inactkb = moveto_long_long(&smp->inactkb, endian_mismatch, arch_64);
634 /* Some fields have been added without a structure format change */
635 if (st_size >= STATS_MEMORY_8A_1_SIZE) {
636 smc->dirtykb = moveto_long_long(&smp->dirtykb, endian_mismatch, arch_64);
638 if (st_size >= STATS_MEMORY_8A_2_SIZE) {
639 smc->anonpgkb = moveto_long_long(&smp->anonpgkb, endian_mismatch, arch_64);
640 smc->slabkb = moveto_long_long(&smp->slabkb, endian_mismatch, arch_64);
641 smc->kstackkb = moveto_long_long(&smp->kstackkb, endian_mismatch, arch_64);
642 smc->pgtblkb = moveto_long_long(&smp->pgtblkb, endian_mismatch, arch_64);
643 smc->vmusedkb = moveto_long_long(&smp->vmusedkb, endian_mismatch, arch_64);
645 if (st_size >= STATS_MEMORY_8A_SIZE) {
646 smc->availablekb = moveto_long_long(&(smp->availablekb), endian_mismatch, arch_64);;
651 ***************************************************************************
652 * Upgrade stats_ktables structure (from ACTIVITY_MAGIC_BASE format to
653 * ACTIVITY_MAGIC_BASE + 1 format).
656 * @act Array of activities.
657 * @p Position of activity in array.
659 * TRUE if data read from file don't match current machine's
661 ***************************************************************************
663 void upgrade_stats_ktables(struct activity *act[], int p, int endian_mismatch)
665 struct stats_ktables *skc = (struct stats_ktables *) act[p]->buf[1];
666 struct stats_ktables_8a *skp = (struct stats_ktables_8a *) act[p]->buf[0];
668 skc->file_used = moveto_long_long(&skp->file_used, endian_mismatch, FALSE);
669 skc->inode_used = moveto_long_long(&skp->inode_used, endian_mismatch, FALSE);
670 skc->dentry_stat = moveto_long_long(&skp->dentry_stat, endian_mismatch, FALSE);
671 skc->pty_nr = moveto_long_long(&skp->pty_nr, endian_mismatch, FALSE);
675 ***************************************************************************
676 * Upgrade stats_queue structure (from ACTIVITY_MAGIC_BASE or
677 * ACTIVITY_MAGIC_BASE + 1 format to ACTIVITY_MAGIC_BASE + 2 format).
680 * @act Array of activities.
681 * @p Position of activity in array.
682 * @magic Structure format magic value.
684 * TRUE if data read from file don't match current machine's
686 * @arch_64 TRUE if file's data come from a 64-bit machine.
687 ***************************************************************************
689 void upgrade_stats_queue(struct activity *act[], int p, unsigned int magic,
690 int endian_mismatch, int arch_64)
692 struct stats_queue *sqc = (struct stats_queue *) act[p]->buf[1];
694 if (magic == ACTIVITY_MAGIC_BASE) {
695 struct stats_queue_8a *sqp = (struct stats_queue_8a *) act[p]->buf[0];
697 sqc->nr_running = moveto_long_long(&sqp->nr_running, endian_mismatch, arch_64);
698 sqc->procs_blocked = 0ULL; /* New field */
699 sqc->nr_threads = moveto_long_long(&sqp->nr_threads, endian_mismatch, FALSE);
700 sqc->load_avg_1 = sqp->load_avg_1;
701 sqc->load_avg_5 = sqp->load_avg_5;
702 sqc->load_avg_15 = sqp->load_avg_15;
705 struct stats_queue_8b *sqp = (struct stats_queue_8b *) act[p]->buf[0];
707 sqc->nr_running = moveto_long_long(&sqp->nr_running, endian_mismatch, arch_64);
708 sqc->procs_blocked = moveto_long_long(&sqp->procs_blocked, endian_mismatch, arch_64);
709 sqc->nr_threads = moveto_long_long(&sqp->nr_threads, endian_mismatch, FALSE);
710 sqc->load_avg_1 = sqp->load_avg_1;
711 sqc->load_avg_5 = sqp->load_avg_5;
712 sqc->load_avg_15 = sqp->load_avg_15;
717 ***************************************************************************
718 * Upgrade stats_serial structure (from ACTIVITY_MAGIC_BASE format to
719 * ACTIVITY_MAGIC_BASE + 1 format).
722 * @act Array of activities.
723 * @p Position of activity in array.
724 * @st_size Size of the structure read from file.
726 * TRUE if data read from file don't match current machine's
730 * Number of serial line structures that actually need to be written to
732 ***************************************************************************
734 int upgrade_stats_serial(struct activity *act[], int p, size_t st_size, int endian_mismatch)
738 struct stats_serial *ssc;
740 /* Copy TTY stats to target structure */
741 memcpy(act[p]->buf[1], act[p]->buf[0], (size_t) act[p]->nr_ini * st_size);
743 for (i = 0; i < act[p]->nr_ini; i++) {
744 ssc = (struct stats_serial *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
746 /* Line number now starts at 0 instead of 1 */
747 line = (endian_mismatch ? __builtin_bswap32(ssc->line) : ssc->line);
751 ssc->line = (endian_mismatch ? __builtin_bswap32(line) : line);
758 ***************************************************************************
759 * Upgrade stats_disk structure (from ACTIVITY_MAGIC_BASE format to
760 * ACTIVITY_MAGIC_BASE + 1 format).
763 * @act Array of activities.
764 * @p Position of activity in array.
765 * @magic Structure format magic value.
767 * TRUE if data read from file don't match current machine's
769 * @arch_64 TRUE if file's data come from a 64-bit machine.
770 ***************************************************************************
772 void upgrade_stats_disk(struct activity *act[], int p, unsigned int magic,
773 int endian_mismatch, int arch_64)
776 struct stats_disk *sdc;
778 if (magic == ACTIVITY_MAGIC_BASE) {
779 struct stats_disk_8a *sdp;
781 for (i = 0; i < act[p]->nr_ini; i++) {
782 sdp = (struct stats_disk_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
783 sdc = (struct stats_disk *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
785 sdc->nr_ios = moveto_long_long(&sdp->nr_ios, endian_mismatch, arch_64);
786 sdc->rd_sect = (unsigned long) sdp->rd_sect;
787 sdc->wr_sect = (unsigned long) sdp->wr_sect;
788 sdc->rd_ticks = (unsigned int) sdp->rd_ticks;
789 sdc->wr_ticks = (unsigned int) sdp->wr_ticks;
790 sdc->tot_ticks = (unsigned int) sdp->tot_ticks;
791 sdc->rq_ticks = (unsigned int) sdp->rq_ticks;
792 sdc->major = sdp->major;
793 sdc->minor = sdp->minor;
797 struct stats_disk_8b *sdp;
799 for (i = 0; i < act[p]->nr_ini; i++) {
800 sdp = (struct stats_disk_8b *) ((char *) act[p]->buf[0] + i * act[p]->msize);
801 sdc = (struct stats_disk *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
803 sdc->nr_ios = sdp->nr_ios;
804 memcpy(&sdc->rd_sect, &sdp->rd_sect, 8);
805 memcpy(&sdc->wr_sect, &sdp->wr_sect, 8);
806 sdc->rd_ticks = sdp->rd_ticks;
807 sdc->wr_ticks = sdp->wr_ticks;
808 sdc->tot_ticks = sdp->tot_ticks;
809 sdc->rq_ticks = sdp->rq_ticks;
810 sdc->major = sdp->major;
811 sdc->minor = sdp->minor;
817 ***************************************************************************
818 * Upgrade stats_net_dev structure (from ACTIVITY_MAGIC_BASE or
819 * ACTIVITY_MAGIC_BASE + 1 format to ACTIVITY_MAGIC_BASE + 3 format).
822 * @act Array of activities.
823 * @p Position of activity in array.
824 * @magic Structure format magic value.
826 * TRUE if data read from file don't match current machine's
828 * @arch_64 TRUE if file's data come from a 64-bit machine.
829 ***************************************************************************
831 void upgrade_stats_net_dev(struct activity *act[], int p, unsigned int magic,
832 int endian_mismatch, int arch_64)
835 struct stats_net_dev *sndc;
837 if (magic == ACTIVITY_MAGIC_BASE) {
838 struct stats_net_dev_8a *sndp;
840 for (i = 0; i < act[p]->nr_ini; i++) {
841 sndp = (struct stats_net_dev_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
842 sndc = (struct stats_net_dev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
844 sndc->rx_packets = moveto_long_long(&sndp->rx_packets, endian_mismatch, arch_64);
845 sndc->tx_packets = moveto_long_long(&sndp->tx_packets, endian_mismatch, arch_64);
846 sndc->rx_bytes = moveto_long_long(&sndp->rx_bytes, endian_mismatch, arch_64);
847 sndc->tx_bytes = moveto_long_long(&sndp->tx_bytes, endian_mismatch, arch_64);
848 sndc->rx_compressed = moveto_long_long(&sndp->rx_compressed, endian_mismatch, arch_64);
849 sndc->tx_compressed = moveto_long_long(&sndp->tx_compressed, endian_mismatch, arch_64);
850 sndc->multicast = moveto_long_long(&sndp->multicast, endian_mismatch, arch_64);
851 sndc->speed = 0; /* New field */
852 strncpy(sndc->interface, sndp->interface, sizeof(sndc->interface));
853 sndc->interface[sizeof(sndc->interface) - 1] = '\0';
854 sndc->duplex = '\0'; /* New field */
857 else if (magic == ACTIVITY_MAGIC_BASE + 1) {
858 struct stats_net_dev_8b *sndp;
860 for (i = 0; i < act[p]->nr_ini; i++) {
861 sndp = (struct stats_net_dev_8b *) ((char *) act[p]->buf[0] + i * act[p]->msize);
862 sndc = (struct stats_net_dev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
864 sndc->rx_packets = sndp->rx_packets;
865 sndc->tx_packets = sndp->tx_packets;
866 sndc->rx_bytes = sndp->rx_bytes;
867 sndc->tx_bytes = sndp->tx_bytes;
868 sndc->rx_compressed = sndp->rx_compressed;
869 sndc->tx_compressed = sndp->tx_compressed;
870 sndc->multicast = sndp->multicast;
871 sndc->speed = 0; /* New field */
872 strncpy(sndc->interface, sndp->interface, sizeof(sndc->interface));
873 sndc->interface[sizeof(sndc->interface) - 1] = '\0';
874 sndc->duplex = '\0'; /* New field */
878 struct stats_net_dev_8c *sndp;
880 for (i = 0; i < act[p]->nr_ini; i++) {
881 sndp = (struct stats_net_dev_8c *) ((char *) act[p]->buf[0] + i * act[p]->msize);
882 sndc = (struct stats_net_dev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
884 sndc->rx_packets = sndp->rx_packets;
885 sndc->tx_packets = sndp->tx_packets;
886 sndc->rx_bytes = sndp->rx_bytes;
887 sndc->tx_bytes = sndp->tx_bytes;
888 sndc->rx_compressed = sndp->rx_compressed;
889 sndc->tx_compressed = sndp->tx_compressed;
890 sndc->multicast = sndp->multicast;
891 sndc->speed = sndp->speed;
892 strncpy(sndc->interface, sndp->interface, sizeof(sndc->interface));
893 sndc->interface[sizeof(sndc->interface) - 1] = '\0';
894 sndc->duplex = sndp->duplex;
900 ***************************************************************************
901 * Upgrade stats_net_edev structure (from ACTIVITY_MAGIC_BASE format to
902 * ACTIVITY_MAGIC_BASE + 1 format).
905 * @act Array of activities.
906 * @p Position of activity in array.
907 * @magic Structure format magic value.
909 * TRUE if data read from file don't match current machine's
911 * @arch_64 TRUE if file's data come from a 64-bit machine.
912 ***************************************************************************
914 void upgrade_stats_net_edev(struct activity *act[], int p, unsigned int magic,
915 int endian_mismatch, int arch_64)
918 struct stats_net_edev *snedc;
920 if (magic == ACTIVITY_MAGIC_BASE) {
921 struct stats_net_edev_8a *snedp;
923 for (i = 0; i < act[p]->nr_ini; i++) {
924 snedp = (struct stats_net_edev_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
925 snedc = (struct stats_net_edev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
927 snedc->collisions = moveto_long_long(&snedp->collisions, endian_mismatch, arch_64);
928 snedc->rx_errors = moveto_long_long(&snedp->rx_errors, endian_mismatch, arch_64);
929 snedc->tx_errors = moveto_long_long(&snedp->tx_errors, endian_mismatch, arch_64);
930 snedc->rx_dropped = moveto_long_long(&snedp->rx_dropped, endian_mismatch, arch_64);
931 snedc->tx_dropped = moveto_long_long(&snedp->tx_dropped, endian_mismatch, arch_64);
932 snedc->rx_fifo_errors = moveto_long_long(&snedp->rx_fifo_errors, endian_mismatch, arch_64);
933 snedc->tx_fifo_errors = moveto_long_long(&snedp->tx_fifo_errors, endian_mismatch, arch_64);
934 snedc->rx_frame_errors = moveto_long_long(&snedp->rx_frame_errors, endian_mismatch, arch_64);
935 snedc->tx_carrier_errors = moveto_long_long(&snedp->tx_carrier_errors, endian_mismatch, arch_64);
936 strncpy(snedc->interface, snedp->interface, sizeof(snedc->interface));
937 snedc->interface[sizeof(snedc->interface) - 1] = '\0';
941 struct stats_net_edev_8b *snedp;
943 for (i = 0; i < act[p]->nr_ini; i++) {
944 snedp = (struct stats_net_edev_8b *) ((char *) act[p]->buf[0] + i * act[p]->msize);
945 snedc = (struct stats_net_edev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
947 snedc->collisions = snedp->collisions;
948 snedc->rx_errors = snedp->rx_errors;
949 snedc->tx_errors = snedp->tx_errors;
950 snedc->rx_dropped = snedp->rx_dropped;
951 snedc->tx_dropped = snedp->tx_dropped;
952 snedc->rx_fifo_errors = snedp->rx_fifo_errors;
953 snedc->tx_fifo_errors = snedp->tx_fifo_errors;
954 snedc->rx_frame_errors = snedp->rx_frame_errors;
955 snedc->tx_carrier_errors = snedp->tx_carrier_errors;
956 strncpy(snedc->interface, snedp->interface, sizeof(snedc->interface));
957 snedc->interface[sizeof(snedc->interface) - 1] = '\0';
963 ***************************************************************************
964 * Upgrade stats_net_ip structure (from ACTIVITY_MAGIC_BASE format to
965 * ACTIVITY_MAGIC_BASE + 1 format).
968 * @act Array of activities.
969 * @p Position of activity in array.
970 * @magic Structure format magic value.
972 * TRUE if data read from file don't match current machine's
974 * @arch_64 TRUE if file's data come from a 64-bit machine.
975 ***************************************************************************
977 void upgrade_stats_net_ip(struct activity *act[], int p, unsigned int magic,
978 int endian_mismatch, int arch_64)
980 struct stats_net_ip *snic = (struct stats_net_ip *) act[p]->buf[1];
982 if (magic == ACTIVITY_MAGIC_BASE) {
983 struct stats_net_ip_8a *snip = (struct stats_net_ip_8a *) act[p]->buf[0];
985 snic->InReceives = moveto_long_long(&snip->InReceives, endian_mismatch, arch_64);
986 snic->ForwDatagrams = moveto_long_long(&snip->ForwDatagrams, endian_mismatch, arch_64);
987 snic->InDelivers = moveto_long_long(&snip->InDelivers, endian_mismatch, arch_64);
988 snic->OutRequests = moveto_long_long(&snip->OutRequests, endian_mismatch, arch_64);
989 snic->ReasmReqds = moveto_long_long(&snip->ReasmReqds, endian_mismatch, arch_64);
990 snic->ReasmOKs = moveto_long_long(&snip->ReasmOKs, endian_mismatch, arch_64);
991 snic->FragOKs = moveto_long_long(&snip->FragOKs, endian_mismatch, arch_64);
992 snic->FragCreates = moveto_long_long(&snip->FragCreates, endian_mismatch, arch_64);
995 struct stats_net_ip_8b *snip = (struct stats_net_ip_8b *) act[p]->buf[0];
997 snic->InReceives = snip->InReceives;
998 snic->ForwDatagrams = snip->ForwDatagrams;
999 snic->InDelivers = snip->InDelivers;
1000 snic->OutRequests = snip->OutRequests;
1001 snic->ReasmReqds = snip->ReasmReqds;
1002 snic->ReasmOKs = snip->ReasmOKs;
1003 snic->FragOKs = snip->FragOKs;
1004 snic->FragCreates = snip->FragCreates;
1009 ***************************************************************************
1010 * Upgrade stats_net_eip structure (from ACTIVITY_MAGIC_BASE format to
1011 * ACTIVITY_MAGIC_BASE + 1 format).
1014 * @act Array of activities.
1015 * @p Position of activity in array.
1016 * @magic Structure format magic value.
1018 * TRUE if data read from file don't match current machine's
1020 * @arch_64 TRUE if file's data come from a 64-bit machine.
1021 ***************************************************************************
1023 void upgrade_stats_net_eip(struct activity *act[], int p, unsigned int magic,
1024 int endian_mismatch, int arch_64)
1026 struct stats_net_eip *sneic = (struct stats_net_eip *) act[p]->buf[1];
1028 if (magic == ACTIVITY_MAGIC_BASE) {
1029 struct stats_net_eip_8a *sneip = (struct stats_net_eip_8a *) act[p]->buf[0];
1031 sneic->InHdrErrors = moveto_long_long(&sneip->InHdrErrors, endian_mismatch, arch_64);
1032 sneic->InAddrErrors = moveto_long_long(&sneip->InAddrErrors, endian_mismatch, arch_64);
1033 sneic->InUnknownProtos = moveto_long_long(&sneip->InUnknownProtos, endian_mismatch, arch_64);
1034 sneic->InDiscards = moveto_long_long(&sneip->InDiscards, endian_mismatch, arch_64);
1035 sneic->OutDiscards = moveto_long_long(&sneip->OutDiscards, endian_mismatch, arch_64);
1036 sneic->OutNoRoutes = moveto_long_long(&sneip->OutNoRoutes, endian_mismatch, arch_64);
1037 sneic->ReasmFails = moveto_long_long(&sneip->ReasmFails, endian_mismatch, arch_64);
1038 sneic->FragFails = moveto_long_long(&sneip->FragFails, endian_mismatch, arch_64);
1041 struct stats_net_eip_8b *sneip = (struct stats_net_eip_8b *) act[p]->buf[0];
1043 sneic->InHdrErrors = sneip->InHdrErrors;
1044 sneic->InAddrErrors = sneip->InAddrErrors;
1045 sneic->InUnknownProtos = sneip->InUnknownProtos;
1046 sneic->InDiscards = sneip->InDiscards;
1047 sneic->OutDiscards = sneip->OutDiscards;
1048 sneic->OutNoRoutes = sneip->OutNoRoutes;
1049 sneic->ReasmFails = sneip->ReasmFails;
1050 sneic->FragFails = sneip->FragFails;
1055 ***************************************************************************
1056 * Upgrade stats_net_ip6 structure (from ACTIVITY_MAGIC_BASE format to
1057 * ACTIVITY_MAGIC_BASE + 1 format).
1060 * @act Array of activities.
1061 * @p Position of activity in array.
1062 * @magic Structure format magic value.
1064 * TRUE if data read from file don't match current machine's
1066 * @arch_64 TRUE if file's data come from a 64-bit machine.
1067 ***************************************************************************
1069 void upgrade_stats_net_ip6(struct activity *act[], int p, unsigned int magic,
1070 int endian_mismatch, int arch_64)
1072 struct stats_net_ip6 *snic6 = (struct stats_net_ip6 *) act[p]->buf[1];
1074 if (magic == ACTIVITY_MAGIC_BASE) {
1075 struct stats_net_ip6_8a *snip6 = (struct stats_net_ip6_8a *) act[p]->buf[0];
1077 snic6->InReceives6 = moveto_long_long(&snip6->InReceives6, endian_mismatch, arch_64);
1078 snic6->OutForwDatagrams6 = moveto_long_long(&snip6->OutForwDatagrams6, endian_mismatch, arch_64);
1079 snic6->InDelivers6 = moveto_long_long(&snip6->InDelivers6, endian_mismatch, arch_64);
1080 snic6->OutRequests6 = moveto_long_long(&snip6->OutRequests6, endian_mismatch, arch_64);
1081 snic6->ReasmReqds6 = moveto_long_long(&snip6->ReasmReqds6, endian_mismatch, arch_64);
1082 snic6->ReasmOKs6 = moveto_long_long(&snip6->ReasmOKs6, endian_mismatch, arch_64);
1083 snic6->InMcastPkts6 = moveto_long_long(&snip6->InMcastPkts6, endian_mismatch, arch_64);
1084 snic6->OutMcastPkts6 = moveto_long_long(&snip6->OutMcastPkts6, endian_mismatch, arch_64);
1085 snic6->FragOKs6 = moveto_long_long(&snip6->FragOKs6, endian_mismatch, arch_64);
1086 snic6->FragCreates6 = moveto_long_long(&snip6->FragCreates6, endian_mismatch, arch_64);
1089 struct stats_net_ip6_8b *snip6 = (struct stats_net_ip6_8b *) act[p]->buf[0];
1091 snic6->InReceives6 = snip6->InReceives6;
1092 snic6->OutForwDatagrams6 = snip6->OutForwDatagrams6;
1093 snic6->InDelivers6 = snip6->InDelivers6;
1094 snic6->OutRequests6 = snip6->OutRequests6;
1095 snic6->ReasmReqds6 = snip6->ReasmReqds6;
1096 snic6->ReasmOKs6 = snip6->ReasmOKs6;
1097 snic6->InMcastPkts6 = snip6->InMcastPkts6;
1098 snic6->OutMcastPkts6 = snip6->OutMcastPkts6;
1099 snic6->FragOKs6 = snip6->FragOKs6;
1100 snic6->FragCreates6 = snip6->FragCreates6;
1105 ***************************************************************************
1106 * Upgrade stats_net_eip6 structure (from ACTIVITY_MAGIC_BASE format to
1107 * ACTIVITY_MAGIC_BASE + 1 format).
1110 * @act Array of activities.
1111 * @p Position of activity in array.
1112 * @magic Structure format magic value.
1114 * TRUE if data read from file don't match current machine's
1116 * @arch_64 TRUE if file's data come from a 64-bit machine.
1117 ***************************************************************************
1119 void upgrade_stats_net_eip6(struct activity *act[], int p, unsigned int magic,
1120 int endian_mismatch, int arch_64)
1122 struct stats_net_eip6 *sneic6 = (struct stats_net_eip6 *) act[p]->buf[1];
1124 if (magic == ACTIVITY_MAGIC_BASE) {
1125 struct stats_net_eip6_8a *sneip6 = (struct stats_net_eip6_8a *) act[p]->buf[0];
1127 sneic6->InHdrErrors6 = moveto_long_long(&sneip6->InHdrErrors6, endian_mismatch, arch_64);
1128 sneic6->InAddrErrors6 = moveto_long_long(&sneip6->InAddrErrors6, endian_mismatch, arch_64);
1129 sneic6->InUnknownProtos6 = moveto_long_long(&sneip6->InUnknownProtos6, endian_mismatch, arch_64);
1130 sneic6->InTooBigErrors6 = moveto_long_long(&sneip6->InTooBigErrors6, endian_mismatch, arch_64);
1131 sneic6->InDiscards6 = moveto_long_long(&sneip6->InDiscards6, endian_mismatch, arch_64);
1132 sneic6->OutDiscards6 = moveto_long_long(&sneip6->OutDiscards6, endian_mismatch, arch_64);
1133 sneic6->InNoRoutes6 = moveto_long_long(&sneip6->InNoRoutes6, endian_mismatch, arch_64);
1134 sneic6->OutNoRoutes6 = moveto_long_long(&sneip6->OutNoRoutes6, endian_mismatch, arch_64);
1135 sneic6->ReasmFails6 = moveto_long_long(&sneip6->ReasmFails6, endian_mismatch, arch_64);
1136 sneic6->FragFails6 = moveto_long_long(&sneip6->FragFails6, endian_mismatch, arch_64);
1137 sneic6->InTruncatedPkts6 = moveto_long_long(&sneip6->InTruncatedPkts6, endian_mismatch, arch_64);
1140 struct stats_net_eip6_8b *sneip6 = (struct stats_net_eip6_8b *) act[p]->buf[0];
1142 sneic6->InHdrErrors6 = sneip6->InHdrErrors6;
1143 sneic6->InAddrErrors6 = sneip6->InAddrErrors6;
1144 sneic6->InUnknownProtos6 = sneip6->InUnknownProtos6;
1145 sneic6->InTooBigErrors6 = sneip6->InTooBigErrors6;
1146 sneic6->InDiscards6 = sneip6->InDiscards6;
1147 sneic6->OutDiscards6 = sneip6->OutDiscards6;
1148 sneic6->InNoRoutes6 = sneip6->InNoRoutes6;
1149 sneic6->OutNoRoutes6 = sneip6->OutNoRoutes6;
1150 sneic6->ReasmFails6 = sneip6->ReasmFails6;
1151 sneic6->FragFails6 = sneip6->FragFails6;
1152 sneic6->InTruncatedPkts6 = sneip6->InTruncatedPkts6;
1157 ***************************************************************************
1158 * Upgrade stats_huge structure (from ACTIVITY_MAGIC_BASE format to
1159 * ACTIVITY_MAGIC_BASE + 1 format).
1162 * @act Array of activities.
1163 * @p Position of activity in array.
1165 * TRUE if data read from file don't match current machine's
1167 * @arch_64 TRUE if file's data come from a 64-bit machine.
1168 ***************************************************************************
1170 void upgrade_stats_huge(struct activity *act[], int p,
1171 int endian_mismatch, int arch_64)
1173 struct stats_huge *shc = (struct stats_huge *) act[p]->buf[1];
1174 struct stats_huge_8a *shp = (struct stats_huge_8a *) act[p]->buf[0];
1176 shc->frhkb = moveto_long_long(&shp->frhkb, endian_mismatch, arch_64);
1177 shc->tlhkb = moveto_long_long(&shp->tlhkb, endian_mismatch, arch_64);
1181 ***************************************************************************
1182 * Upgrade stats_pwr_wghfreq structure (from ACTIVITY_MAGIC_BASE format to
1183 * ACTIVITY_MAGIC_BASE + 1 format).
1186 * @act Array of activities.
1187 * @p Position of activity in array.
1188 ***************************************************************************
1190 void upgrade_stats_pwr_wghfreq(struct activity *act[], int p)
1194 struct stats_pwr_wghfreq *spc, *spc_k;
1195 struct stats_pwr_wghfreq_8a *spp, *spp_k;
1197 for (i = 0; i < act[p]->nr_ini; i++) {
1198 spp = (struct stats_pwr_wghfreq_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize * act[p]->nr2);
1199 spc = (struct stats_pwr_wghfreq *) ((char *) act[p]->buf[1] + i * act[p]->fsize * act[p]->nr2);
1201 for (k = 0; k < act[p]->nr2; k++) {
1202 spp_k = (struct stats_pwr_wghfreq_8a *) ((char *) spp + k * act[p]->msize);
1205 spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * act[p]->fsize);
1207 spc_k->time_in_state = spp_k->time_in_state;
1208 memcpy(&spc_k->freq, &spp_k->freq, 8);
1214 ***************************************************************************
1215 * Upgrade stats_filesystem structure (from ACTIVITY_MAGIC_BASE format to
1216 * ACTIVITY_MAGIC_BASE + 1 format).
1219 * @act Array of activities.
1220 * @p Position of activity in array.
1221 * @st_size Size of the structure read from file.
1222 ***************************************************************************
1224 void upgrade_stats_filesystem(struct activity *act[], int p, int st_size)
1227 struct stats_filesystem *sfc;
1228 struct stats_filesystem_8a *sfp;
1230 for (i = 0; i < act[p]->nr_ini; i++) {
1231 sfp = (struct stats_filesystem_8a *) ((char *) act[p]->buf[0] + i * act[p]->msize);
1232 sfc = (struct stats_filesystem *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1234 sfc->f_blocks = sfp->f_blocks;
1235 sfc->f_bfree = sfp->f_bfree;
1236 sfc->f_bavail = sfp->f_bavail;
1237 sfc->f_files = sfp->f_files;
1238 sfc->f_ffree = sfp->f_ffree;
1239 strncpy(sfc->fs_name, sfp->fs_name, sizeof(sfc->fs_name));
1240 sfc->fs_name[sizeof(sfc->fs_name) - 1] = '\0';
1242 if (st_size <= STATS_FILESYSTEM_8A_1_SIZE) {
1243 /* mountp didn't exist with older versions */
1244 sfc->mountp[0] = '\0';
1247 strncpy(sfc->mountp, sfp->mountp, sizeof(sfc->mountp));
1248 sfc->mountp[sizeof(sfc->mountp) - 1] = '\0';
1254 ***************************************************************************
1255 * Count number of stats_disk structures that need to be written.
1258 * @act Array of activities.
1259 * @p Position of activity in array.
1260 ***************************************************************************
1262 __nr_t count_stats_disk(struct activity *act[], int p)
1266 struct stats_disk *sdc;
1268 for (i = 0; i < act[p]->nr_ini; i++) {
1269 sdc = (struct stats_disk *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1270 if (!(sdc->major + sdc->minor))
1280 ***************************************************************************
1281 * Count number of stats_net_dev structures that need to be written.
1284 * @act Array of activities.
1285 * @p Position of activity in array.
1286 ***************************************************************************
1288 __nr_t count_stats_net_dev(struct activity *act[], int p)
1292 struct stats_net_dev *sndc;
1294 for (i = 0; i < act[p]->nr_ini; i++) {
1295 sndc = (struct stats_net_dev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1296 if (!strcmp(sndc->interface, ""))
1306 ***************************************************************************
1307 * Count number of stats_net_edev structures that need to be written.
1310 * @act Array of activities.
1311 * @p Position of activity in array.
1312 ***************************************************************************
1314 __nr_t count_stats_net_edev(struct activity *act[], int p)
1318 struct stats_net_edev *snedc;
1320 for (i = 0; i < act[p]->nr_ini; i++) {
1321 snedc = (struct stats_net_edev *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1322 if (!strcmp(snedc->interface, ""))
1332 ***************************************************************************
1333 * Count number of stats_pwr_usb structures that need to be written.
1336 * @act Array of activities.
1337 * @p Position of activity in array.
1338 ***************************************************************************
1340 __nr_t count_stats_pwr_usb(struct activity *act[], int p)
1344 struct stats_pwr_usb *suc;
1346 for (i = 0; i < act[p]->nr_ini; i++) {
1347 suc = (struct stats_pwr_usb *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1358 ***************************************************************************
1359 * Count number of stats_filesystem structures that need to be written.
1362 * @act Array of activities.
1363 * @p Position of activity in array.
1364 ***************************************************************************
1366 __nr_t count_stats_filesystem(struct activity *act[], int p)
1370 struct stats_filesystem *sfc;
1372 for (i = 0; i < act[p]->nr_ini; i++) {
1373 sfc = (struct stats_filesystem *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1384 ***************************************************************************
1385 * Count number of stats_fchost structures that need to be written.
1388 * @act Array of activities.
1389 * @p Position of activity in array.
1390 ***************************************************************************
1392 __nr_t count_stats_fchost(struct activity *act[], int p)
1396 struct stats_fchost *sfcc;
1398 for (i = 0; i < act[p]->nr_ini; i++) {
1399 sfcc = (struct stats_fchost *) ((char *) act[p]->buf[1] + i * act[p]->fsize);
1400 if (!sfcc->fchost_name[0])
1410 ***************************************************************************
1411 * Upgrade file's activity list section.
1414 * @stdfd File descriptor for STDOUT.
1415 * @act Array of activities.
1416 * @file_hdr Pointer on file_header structure.
1417 * @ofile_actlst Activity list in file.
1419 * TRUE if data read from file don't match current machine's
1421 * @arch_64 TRUE if file's data come from a 64-bit machine.
1424 * @file_actlst Activity list with up-to-date format.
1427 * -1 on error, 0 otherwise.
1428 ***************************************************************************
1430 int upgrade_activity_section(int stdfd, struct activity *act[],
1431 struct file_header *file_hdr,
1432 struct old_file_activity *ofile_actlst,
1433 struct file_activity **file_actlst,
1434 int endian_mismatch, int arch_64)
1437 struct old_file_activity *ofal;
1438 struct file_activity *fal, fa;
1440 fprintf(stderr, "file_activity: ");
1442 SREALLOC(*file_actlst, struct file_activity, FILE_ACTIVITY_SIZE * file_hdr->sa_act_nr);
1444 ofal = ofile_actlst;
1446 for (i = 0; i < file_hdr->sa_act_nr; i++, ofal++, fal++) {
1448 /* Every activity should be known at the moment (may change in the future) */
1449 p = get_activity_position(act, ofal->id, EXIT_IF_NOT_FOUND);
1452 if ((ofal->id == A_IRQ) && (ofal->magic < ACTIVITY_MAGIC_BASE + 2)) {
1453 /* Special processing for A_IRQ activity */
1454 fal->nr = 1; /* Only CPU "all" */
1455 /* The number of interrupts is the 2nd dimension of the matrix */
1456 fal->nr2 = ofal->nr;
1460 fal->nr2 = ofal->nr2;
1462 fal->magic = act[p]->magic; /* Update activity magic number */
1463 fal->has_nr = HAS_COUNT_FUNCTION(act[p]->options);
1464 /* Also update its size, which may have changed with recent versions */
1465 fal->size = act[p]->fsize;
1466 for (j = 0; j < 3; j++) {
1467 fal->types_nr[j] = act[p]->gtypes_nr[j];
1470 memcpy(&fa, fal, FILE_ACTIVITY_SIZE);
1471 /* Restore endianness before writing */
1472 if (endian_mismatch) {
1473 /* Start swapping at field "header_size" position */
1474 swap_struct(act_types_nr, &fa, arch_64);
1478 * Even unknown activities must be written
1479 * (they are counted in sa_act_nr).
1481 if (write_all(stdfd, &fa, FILE_ACTIVITY_SIZE) != FILE_ACTIVITY_SIZE) {
1482 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
1485 fprintf(stderr, "%s ", act[p]->name);
1488 fprintf(stderr, "OK\n");
1494 ***************************************************************************
1495 * Upgrade a record header.
1498 * @fd File descriptor for sa datafile to convert.
1499 * @stdfd File descriptor for STDOUT.
1500 * @orec_hdr Record's header structure to convert.
1502 * TRUE if data read from file don't match current machine's
1504 * @arch_64 TRUE if file's data come from a 64-bit machine.
1507 * -1 on error, 0 otherwise.
1508 ***************************************************************************
1510 int upgrade_record_header(int fd, int stdfd, struct old_record_header *orec_hdr,
1511 int endian_mismatch, int arch_64)
1513 struct record_header rec_hdr;
1515 memset(&rec_hdr, 0, sizeof(struct record_header));
1517 /* Convert current record header */
1518 rec_hdr.uptime_cs = orec_hdr->uptime0 * 100 / HZ; /* Uptime in cs, not jiffies */
1519 rec_hdr.ust_time = (unsigned long long) orec_hdr->ust_time;
1520 rec_hdr.record_type = orec_hdr->record_type;
1521 rec_hdr.hour = orec_hdr->hour;
1522 rec_hdr.minute = orec_hdr->minute;
1523 rec_hdr.second = orec_hdr->second;
1525 /* Restore endianness before writing */
1526 if (endian_mismatch) {
1527 swap_struct(rec_types_nr, &rec_hdr, arch_64);
1530 /* Write record header */
1531 if (write_all(stdfd, &rec_hdr, RECORD_HEADER_SIZE) != RECORD_HEADER_SIZE) {
1532 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
1536 fprintf(stderr, "H");
1542 ***************************************************************************
1543 * Upgrade a COMMENT record.
1546 * @fd File descriptor for sa datafile to convert.
1547 * @stdfd File descriptor for STDOUT.
1550 * -1 on error, 0 otherwise.
1551 ***************************************************************************
1553 int upgrade_comment_record(int fd, int stdfd)
1555 char file_comment[MAX_COMMENT_LEN];
1557 /* Read the COMMENT record */
1558 sa_fread(fd, file_comment, sizeof(file_comment), HARD_SIZE, UEOF_STOP);
1559 file_comment[sizeof(file_comment) - 1] = '\0';
1561 /* Then write it. No changes at this time */
1562 if (write_all(stdfd, file_comment, sizeof(file_comment)) != sizeof(file_comment)) {
1563 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
1567 fprintf(stderr, "C");
1573 ***************************************************************************
1574 * Upgrade a RESTART record.
1577 * @fd File descriptor for sa datafile to convert.
1578 * @stdfd File descriptor for STDOUT.
1579 * @act Array of activities.
1580 * @file_hdr Pointer on file_header structure.
1582 * TRUE is sa datafile has an old format which is no longer
1583 * compatible with current one.
1585 * TRUE if data read from file don't match current machine's
1587 * @arch_64 TRUE if file's data come from a 64-bit machine.
1588 * @vol_act_nr Number of volatile activity structures.
1591 * -1 on error, 0 otherwise.
1592 ***************************************************************************
1594 int upgrade_restart_record(int fd, int stdfd, struct activity *act[],
1595 struct file_header *file_hdr, int previous_format,
1596 int endian_mismatch, int arch_64, unsigned int vol_act_nr)
1600 struct old_file_activity ofile_act;
1601 /* Number of cpu read in the activity list. See upgrade_header_section() */
1602 __nr_t cpu_nr = file_hdr->sa_cpu_nr;
1604 if (previous_format == FORMAT_MAGIC_2173) {
1606 * For versions from 10.3.1 to 11.6.x,
1607 * the restart record is followed by a list
1608 * of volatile activity structures. Among them is A_CPU activity.
1610 for (i = 0; i < vol_act_nr; i++) {
1611 sa_fread(fd, &ofile_act, OLD_FILE_ACTIVITY_SIZE, HARD_SIZE, UEOF_STOP);
1613 /* Normalize endianness for file_activity structures */
1614 if (endian_mismatch) {
1615 swap_struct(oact_types_nr, &ofile_act, arch_64);
1618 if (ofile_act.id && (ofile_act.nr > 0)) {
1619 p = get_activity_position(act, ofile_act.id, EXIT_IF_NOT_FOUND);
1620 act[p]->nr_ini = ofile_act.nr;
1622 if (ofile_act.id == A_CPU) {
1623 cpu_nr = ofile_act.nr;
1627 /* Reallocate structures */
1628 allocate_structures(act);
1631 /* Restore endianness before writing */
1632 if (endian_mismatch) {
1633 cpu_nr = __builtin_bswap32(cpu_nr);
1636 /* Write new number of CPU following the restart record */
1637 if (write_all(stdfd, &cpu_nr, sizeof(__nr_t)) != sizeof(__nr_t)) {
1638 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
1642 fprintf(stderr, "R");
1648 ***************************************************************************
1649 * Upgrade a record which is not a COMMENT or a RESTART one.
1652 * @fd File descriptor for sa datafile to convert.
1653 * @stdfd File descriptor for STDOUT.
1654 * @act Array of activities.
1655 * @file_hdr Pointer on file_header structure (up-to-date format).
1657 * Activity list in file.
1658 * @file_actlst Activity list in file (up-to-date format).
1660 * TRUE if data read from file don't match current machine's
1662 * @arch_64 TRUE if file's data come from a 64-bit machine.
1665 * -1 on error, 0 otherwise.
1666 ***************************************************************************
1668 int upgrade_common_record(int fd, int stdfd, struct activity *act[], struct file_header *file_hdr,
1669 struct old_file_activity *ofile_actlst, struct file_activity *file_actlst,
1670 int endian_mismatch, int arch_64)
1673 __nr_t nr_struct, nr;
1674 struct old_file_activity *ofal = ofile_actlst;
1675 struct file_activity *fal = file_actlst;
1679 * This is not a special record, so read the extra fields,
1680 * even if the format of the activity is unknown.
1682 for (i = 0; i < file_hdr->sa_act_nr; i++, ofal++, fal++) {
1684 /* Every activity should be known at the moment (may change in the future) */
1685 p = get_activity_position(act, fal->id, EXIT_IF_NOT_FOUND);
1687 /* Warning: Stats structures keep their original endianness here */
1688 if ((act[p]->nr_ini > 0) &&
1689 ((act[p]->nr_ini > 1) || (act[p]->nr2 > 1)) &&
1690 (act[p]->msize > ofal->size)) {
1691 for (j = 0; j < act[p]->nr_ini; j++) {
1692 for (k = 0; k < act[p]->nr2; k++) {
1694 (char *) act[p]->buf[0] + (j * act[p]->nr2 + k) * act[p]->msize,
1695 (size_t) ofal->size, HARD_SIZE, UEOF_STOP);
1699 else if (act[p]->nr_ini > 0) {
1700 sa_fread(fd, act[p]->buf[0],
1701 (size_t) ofal->size * (size_t) act[p]->nr_ini * (size_t) act[p]->nr2,
1702 HARD_SIZE, UEOF_STOP);
1705 nr_struct = act[p]->nr_ini;
1707 * NB: Cannot upgrade a stats structure with
1708 * a magic number higher than currently known.
1710 if (ofal->magic < act[p]->magic) {
1713 /* Known activity but old format */
1717 upgrade_stats_cpu(act, p, ofal->size);
1721 upgrade_stats_pcsw(act, p);
1725 upgrade_stats_irq(act, p, ofal->magic);
1729 upgrade_stats_io(act, p, endian_mismatch);
1733 upgrade_stats_queue(act, p, ofal->magic,
1734 endian_mismatch, arch_64);
1738 upgrade_stats_memory(act, p, ofal->size,
1739 endian_mismatch, arch_64);
1743 upgrade_stats_ktables(act, p, endian_mismatch);
1747 nr_struct = upgrade_stats_serial(act, p, ofal->size,
1752 upgrade_stats_disk(act, p, ofal->magic,
1753 endian_mismatch, arch_64);
1757 upgrade_stats_net_dev(act, p, ofal->magic,
1758 endian_mismatch, arch_64);
1762 upgrade_stats_net_edev(act, p, ofal->magic,
1763 endian_mismatch, arch_64);
1767 upgrade_stats_net_ip(act, p, ofal->magic,
1768 endian_mismatch, arch_64);
1772 upgrade_stats_net_eip(act, p, ofal->magic,
1773 endian_mismatch, arch_64);
1777 upgrade_stats_net_ip6(act, p, ofal->magic,
1778 endian_mismatch, arch_64);
1782 upgrade_stats_net_eip6(act, p, ofal->magic,
1783 endian_mismatch, arch_64);
1787 upgrade_stats_huge(act, p, endian_mismatch, arch_64);
1791 upgrade_stats_pwr_wghfreq(act, p);
1795 upgrade_stats_filesystem(act, p, ofal->size);
1801 /* Known activity with current up-to-date format */
1802 for (j = 0; j < act[p]->nr_ini; j++) {
1803 for (k = 0; k < act[p]->nr2; k++) {
1804 memcpy((char *) act[p]->buf[1] + (j * act[p]->nr2 + k) * act[p]->msize,
1805 (char *) act[p]->buf[0] + (j * act[p]->nr2 + k) * act[p]->msize,
1817 * Nothing to do: Use current nr_struct value set to
1818 * act[p]->nr_ini above (value is "1" for A_IRQ: See
1819 * upgrade_header_section()).
1824 /* Nothing to do: Already done in upgrade_stats_serial() */
1828 nr_struct = count_stats_disk(act, p);
1832 nr_struct = count_stats_net_dev(act, p);
1836 nr_struct = count_stats_net_edev(act, p);
1840 nr_struct = count_stats_pwr_usb(act, p);
1844 nr_struct = count_stats_filesystem(act, p);
1848 nr_struct = count_stats_fchost(act, p);
1852 /* Restore endianness before writing */
1853 if (endian_mismatch) {
1854 nr = __builtin_bswap32(nr_struct);
1860 /* Write number of structures for current activity */
1861 if (write_all(stdfd, &nr, sizeof(__nr_t)) != sizeof(__nr_t))
1864 fprintf(stderr, "n");
1867 for (j = 0; j < nr_struct; j++) {
1868 for (k = 0; k < act[p]->nr2; k++) {
1869 if (write_all(stdfd,
1870 (char *) act[p]->buf[1] + (j * act[p]->nr2 + k) * act[p]->fsize,
1871 act[p]->fsize) != act[p]->fsize)
1875 fprintf(stderr, "%c", cc);
1882 fprintf(stderr, "\nwrite: %s\n", strerror(errno));
1889 ***************************************************************************
1890 * Upgrade statistics records.
1893 * @fd File descriptor for sa datafile to convert.
1894 * @stdfd File descriptor for STDOUT.
1895 * @act Array of activities.
1896 * @file_hdr Pointer on file_header structure.
1898 * Activity list in file.
1899 * @file_actlst Activity list with up-to-date format.
1901 * TRUE is sa datafile has an old format which is no longer * @endian_mismatch
1902 * TRUE if data read from file don't match current machine's
1904 * @arch_64 TRUE if file's data come from a 64-bit machine.
1906 * compatible with current one.
1908 * TRUE if data read from file don't match current machine's
1910 * @arch_64 TRUE if file's data come from a 64-bit machine.
1911 * @vol_act_nr Number of volatile activity structures.
1914 * -1 on error, 0 otherwise.
1915 ***************************************************************************
1917 int upgrade_stat_records(int fd, int stdfd, struct activity *act[], struct file_header *file_hdr,
1918 struct old_file_activity *ofile_actlst, struct file_activity *file_actlst,
1919 int previous_format, int endian_mismatch, int arch_64,
1920 unsigned int vol_act_nr)
1924 struct old_record_header orec_hdr;
1925 unsigned int orec_types_nr[] = {OLD_RECORD_HEADER_ULL_NR, OLD_RECORD_HEADER_UL_NR, OLD_RECORD_HEADER_U_NR};
1927 fprintf(stderr, _("Statistics:\n"));
1930 eosaf = sa_fread(fd, &orec_hdr, OLD_RECORD_HEADER_SIZE, SOFT_SIZE, UEOF_STOP);
1932 /* Normalize endianness */
1933 if (endian_mismatch) {
1934 swap_struct(orec_types_nr, &orec_hdr, arch_64);
1936 rtype = orec_hdr.record_type;
1939 /* Upgrade current record header */
1940 if (upgrade_record_header(fd, stdfd, &orec_hdr,
1941 endian_mismatch, arch_64) < 0)
1944 if (rtype == R_COMMENT) {
1945 /* Upgrade the COMMENT record */
1946 if (upgrade_comment_record(fd, stdfd) < 0)
1949 else if (rtype == R_RESTART) {
1950 /* Upgrade the RESTART record */
1951 if (upgrade_restart_record(fd, stdfd, act, file_hdr,
1952 previous_format, endian_mismatch,
1953 arch_64, vol_act_nr) < 0)
1957 /* Upgrade current statistics record */
1958 if (upgrade_common_record(fd, stdfd, act, file_hdr, ofile_actlst,
1959 file_actlst, endian_mismatch, arch_64) < 0)
1966 fprintf(stderr, "\n");
1972 ***************************************************************************
1973 * Close file descriptors and exit.
1976 * @fd File descriptor for sa datafile to convert.
1977 * @stdfd File descriptor for STDOUT.
1978 * @exit_code Exit code.
1979 ***************************************************************************
1981 void upgrade_exit(int fd, int stdfd, int exit_code)
1995 ***************************************************************************
1996 * Convert a sysstat activity data file from a previous version to the
1997 * up-to-date format. Presently data files from sysstat version 9.1.6 and
1998 * later are converted to current sysstat version format.
2001 * @dfile System activity data file name.
2002 * @act Array of activities.
2003 ***************************************************************************
2005 void convert_file(char dfile[], struct activity *act[])
2007 int fd = 0, stdfd = 0, previous_format = 0;
2009 unsigned int vol_act_nr = 0, hdr_size;
2010 struct file_magic file_magic;
2011 struct file_header file_hdr;
2012 struct file_activity *file_actlst = NULL;
2013 struct old_file_activity *ofile_actlst = NULL;
2016 if ((stdfd = dup(STDOUT_FILENO)) < 0) {
2018 upgrade_exit(0, 0, 2);
2021 /* Upgrade file's magic section */
2022 if (upgrade_magic_section(dfile, &fd, stdfd, &file_magic, &hdr_size,
2023 &previous_format, &endian_mismatch) < 0) {
2024 upgrade_exit(fd, stdfd, 2);
2026 if (previous_format == FORMAT_MAGIC) {
2027 /* Nothing to do at the present time */
2028 fprintf(stderr, _("\nFile format already up-to-date\n"));
2037 /* HZ set on the command line with option -O */
2040 fprintf(stderr, _("HZ: Using current value: %lu\n"), HZ);
2042 /* Upgrade file's header section */
2043 if (upgrade_header_section(dfile, fd, stdfd, act, &file_magic,
2044 &file_hdr, hdr_size, previous_format, &arch_64,
2045 endian_mismatch, &vol_act_nr, &ofile_actlst) < 0) {
2046 upgrade_exit(fd, stdfd, 2);
2049 /* Upgrade file's activity list section */
2050 if (upgrade_activity_section(stdfd, act, &file_hdr,
2051 ofile_actlst, &file_actlst,
2052 endian_mismatch, arch_64) < 0) {
2053 upgrade_exit(fd, stdfd, 2);
2056 /* Perform required allocations */
2057 allocate_structures(act);
2059 /* Upgrade statistics records */
2060 if (upgrade_stat_records(fd, stdfd, act, &file_hdr, ofile_actlst, file_actlst,
2061 previous_format, endian_mismatch, arch_64,
2063 upgrade_exit(fd, stdfd, 2);
2068 free_structures(act);
2071 _("File successfully converted to sysstat format version %s\n"),
2075 upgrade_exit(fd, stdfd, 0);