diff options
author | Roland McGrath <roland@gnu.org> | 2001-04-01 01:38:29 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-04-01 01:38:29 +0000 |
commit | 6bbbcf8a52bb16ac57a2e17107e8db61dbb6c947 (patch) | |
tree | a777b237c7ba61b0b6d40fdd3cfe3f44838f9c24 /ext2fs/hyper.c | |
parent | fef7bab7f18aaf5a3141344d07a72e931623c0dc (diff) |
2001-03-03 Roland McGrath <roland@frob.com>
* 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.
Diffstat (limited to 'ext2fs/hyper.c')
-rw-r--r-- | ext2fs/hyper.c | 16 |
1 files 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 <miles@gnu.org> This program is free software; you can redistribute it and/or @@ -24,13 +23,13 @@ #include <hurd/store.h> #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 |