home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / win95 / ext2tool.exe / EXT2FS / FREEFS.C < prev    next >
C/C++ Source or Header  |  1995-05-10  |  711b  |  37 lines

  1. /*
  2.  * freefs.c --- free an ext2 filesystem
  3.  * 
  4.  * Copyright (C) 1993, 1994 Theodore Ts'o.  This file may be redistributed
  5.  * under the terms of the GNU Public License.
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <unistd.h>
  10. #include <stdlib.h>
  11.  
  12. #include <errno.h>
  13. #include <linux/ext2_fs.h>
  14.  
  15. #include "ext2fs.h"
  16.  
  17. void ext2fs_free(ext2_filsys fs)
  18. {
  19.     if (!fs || (fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS))
  20.         return;
  21.     if (fs->io) {
  22.         io_channel_close(fs->io);
  23.     }
  24.     if (fs->device_name)
  25.         free(fs->device_name);
  26.     if (fs->super)
  27.         free(fs->super);
  28.     if (fs->group_desc)
  29.         free(fs->group_desc);
  30.     if (fs->block_map)
  31.         free(fs->block_map);
  32.     if (fs->inode_map)
  33.         free(fs->inode_map);
  34.     free(fs);
  35. }
  36.  
  37.