Whamcloud - gitweb
ext2fs_set_gdt_csum(): Return an error code on errors instead of void
[tools/e2fsprogs.git] / e2fsck / ehandler.c
index b370756..16d6d4f 100644 (file)
@@ -23,16 +23,16 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
                                          unsigned long block,
                                          int count,
                                          void *data,
-                                         size_t size,
-                                         int actual,
+                                         size_t size EXT2FS_ATTR((unused)),
+                                         int actual EXT2FS_ATTR((unused)),
                                          errcode_t error)
 {
        int     i;
        char    *p;
-       ext2_filsys fs = channel->app_data;
+       ext2_filsys fs = (ext2_filsys) channel->app_data;
        e2fsck_t ctx;
 
-       ctx = fs->private;
+       ctx = (e2fsck_t) fs->priv_data;
 
        /*
         * If more than one block was read, try reading each block
@@ -50,14 +50,17 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
                return 0;
        }
        if (operation)
-               printf("Error reading block %lu (%s) while %s.  ", block,
+               printf(_("Error reading block %lu (%s) while %s.  "), block,
                       error_message(error), operation);
        else
-               printf("Error reading block %lu (%s).  ", block,
+               printf(_("Error reading block %lu (%s).  "), block,
                       error_message(error));
        preenhalt(ctx);
-       if (ask(ctx, "Ignore error", 1))
+       if (ask(ctx, _("Ignore error"), 1)) {
+               if (ask(ctx, _("Force rewrite"), 1))
+                       io_channel_write_blk(channel, block, 1, data);
                return 0;
+       }
 
        return error;
 }
@@ -66,16 +69,16 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
                                            unsigned long block,
                                            int count,
                                            const void *data,
-                                           size_t size,
-                                           int actual,
+                                           size_t size EXT2FS_ATTR((unused)),
+                                           int actual EXT2FS_ATTR((unused)),
                                            errcode_t error)
 {
        int             i;
        const char      *p;
-       ext2_filsys fs = channel->app_data;
+       ext2_filsys fs = (ext2_filsys) channel->app_data;
        e2fsck_t ctx;
        
-       ctx = fs->private;
+       ctx = (e2fsck_t) fs->priv_data;
 
        /*
         * If more than one block was written, try writing each block
@@ -94,13 +97,13 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
        }
        
        if (operation)
-               printf("Error writing block %lu (%s) while %s.  ", block,
+               printf(_("Error writing block %lu (%s) while %s.  "), block,
                       error_message(error), operation);
        else
-               printf("Error writing block %lu (%s).  ", block,
+               printf(_("Error writing block %lu (%s).  "), block,
                       error_message(error));
        preenhalt(ctx);
-       if (ask(ctx, "Ignore error", 1))
+       if (ask(ctx, _("Ignore error"), 1))
                return 0;
 
        return error;