From 12c5389e858de5eeaab1c918f8125510a3058f21 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sat, 25 Oct 2008 12:50:31 +0300 Subject: [PATCH] Added counting of different file types to vm integrity tests. --- tasks/mm0/main.c | 2 ++ tasks/mm0/src/test.c | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tasks/mm0/main.c b/tasks/mm0/main.c index 790fba3..899d7eb 100644 --- a/tasks/mm0/main.c +++ b/tasks/mm0/main.c @@ -22,6 +22,7 @@ #include #include #include +#include void handle_requests(void) { @@ -54,6 +55,7 @@ void handle_requests(void) switch(tag) { case L4_IPC_TAG_SYNC: + mm0_test_global_vm_integrity(); // printf("%s: Synced with waiting thread.\n", __TASKNAME__); /* This has no receive phase */ return; diff --git a/tasks/mm0/src/test.c b/tasks/mm0/src/test.c index 942dc6c..c5c37bf 100644 --- a/tasks/mm0/src/test.c +++ b/tasks/mm0/src/test.c @@ -12,13 +12,16 @@ #include struct vm_statistics { - int tasks; - int vm_objects; + int tasks; /* All tasks counted on the system */ + int vm_objects; /* All objects counted on the system */ int shadow_objects; /* Shadows counted by hand (well almost!) */ int shadows_referred; /* Shadows that objects say they have */ - int file_objects; - int vm_files; - int tasks_total; + int file_objects; /* Objects that are found to be files */ + int vm_files; /* All files counted on the system */ + int shm_files; /* SHM files counted */ + int boot_files; /* Boot files counted */ + int vfs_files; /* VFS files counted */ + int devzero; /* Devzero count, must be 1 */ }; /* Count links in objects link list, and compare with nlinks */ @@ -69,8 +72,18 @@ int mm0_test_global_vm_integrity(void) } /* Count all registered vmfiles */ - list_for_each_entry(f, &global_vm_files.list, list) + list_for_each_entry(f, &global_vm_files.list, list) { vmstat.vm_files++; + if (f->type == VM_FILE_SHM) + vmstat.shm_files++; + else if (f->type == VM_FILE_BOOTFILE) + vmstat.boot_files++; + else if (f->type == VM_FILE_VFS) + vmstat.vfs_files++; + else if (f->type == VM_FILE_DEVZERO) + vmstat.devzero++; + else BUG(); + } if (vmstat.vm_files != global_vm_files.total) { printf("Total counted files don't match "