Add an -a option to the close_filesys command which writes any changes
to the superblock or block group descriptors to all of the backup
superblock locations.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Change the root directory to be the directory
.IR filespec .
.TP
-.I close
-Close the currently open file system.
+.I close [-a]
+Close the currently open file system. If the
+.I -a
+option is specified, write out any changes to the superblock and block
+group descriptors to all of the backup superblocks, not just to the
+master superblock.
.TP
.I clri file
Clear the contents of the inode
void do_close_filesys(int argc, char **argv)
{
- if (common_args_process(argc, argv, 1, 1, "close_filesys", "", 0))
+ int c;
+
+ if (check_fs_open(argv[0]))
+ return;
+
+ reset_getopt();
+ while ((c = getopt (argc, argv, "a")) != EOF) {
+ switch (c) {
+ case 'a':
+ current_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
+ break;
+ default:
+ goto print_usage;
+ }
+ }
+
+ if (argc > optind) {
+ print_usage:
+ com_err(0, 0, "Usage: close_filesys [-a]");
return;
+ }
+
close_filesystem();
}