From 6bbbcf8a52bb16ac57a2e17107e8db61dbb6c947 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 1 Apr 2001 01:38:29 +0000 Subject: 2001-03-03 Roland McGrath * hyper.c (zeroblock, modified_global_blocks): Remove superfluous zero initializers. (allocate_mod_map): Likewise for static here. (get_hypermetadata): Don't munmap old ZEROBLOCK, just keep it. Allocate ZEROBLOCK with PROT_READ. --- ext2fs/hyper.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c index 5460f0e9..02db378e 100644 --- a/ext2fs/hyper.c +++ b/ext2fs/hyper.c @@ -1,7 +1,6 @@ /* Fetching and storing the hypermetadata (superblock and bg summary info) - Copyright (C) 1994,95,96,99, 1999 Free Software Foundation, Inc. - + Copyright (C) 1994,95,96,99,2001 Free Software Foundation, Inc. Written by Miles Bader This program is free software; you can redistribute it and/or @@ -24,13 +23,13 @@ #include #include "ext2fs.h" -vm_address_t zeroblock = 0; -char *modified_global_blocks = 0; +vm_address_t zeroblock; +char *modified_global_blocks; static void allocate_mod_map (void) { - static vm_size_t mod_map_size = 0; + static vm_size_t mod_map_size; if (modified_global_blocks && mod_map_size) /* Get rid of the old one. */ @@ -63,9 +62,6 @@ get_hypermetadata (void) if (err) ext2_panic ("can't read superblock: %s", strerror (err)); - if (zeroblock) - munmap ((caddr_t) zeroblock, block_size); - sblock = (struct ext2_super_block *) boffs_ptr (SBLOCK_OFFS); if (sblock->s_magic != EXT2_SUPER_MAGIC @@ -163,8 +159,8 @@ get_hypermetadata (void) group_desc_image = (struct ext2_group_desc *) bptr (bptr_block (sblock) + 1); /* A handy source of page-aligned zeros. */ - zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ|PROT_WRITE, - MAP_ANON, 0, 0); + if (zeroblock == 0) + zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ, MAP_ANON, 0, 0); } error_t -- cgit v1.2.3