Whamcloud - gitweb
po: update ms.po (from translationproject.org)
[tools/e2fsprogs.git] / ext2ed / disk.c
index d29c719..4612d00 100644 (file)
@@ -14,7 +14,7 @@ double check the various permissions and possible errors here.
 The major update which needs to be done here is switching to the use of the llseek system call, so that we will
 be able to support ext2 filesystems up to 4 TB. Currently, due to the standard fseek usage, we can't handle
 filesystems bigger than 4 GB. The limit is actually 2 GB because I used long rather than unsigned long long at too
-many places in the program. To conclude - This upgrade needs to be done carefuly; There are many places to change.
+many places in the program. To conclude - This upgrade needs to be done carefully; There are many places to change.
 
 First written on: April 9 1995
 
@@ -22,6 +22,7 @@ Copyright (C) 1995 Gadi Oxman
 
 */
 
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -55,7 +56,7 @@ This function is used when we need to read something from the filesystem.
                return (0);
        }
 
-#endif 
+#endif
 
        if ( (fseek (device_handle,offset,SEEK_SET))==-1) {             /* Seek to the required offset */
                wprintw (command_win,"Error - Failed to seek to offset %ld in device %s\n",offset,device_name);
@@ -67,7 +68,7 @@ This function is used when we need to read something from the filesystem.
                wprintw (command_win,"Error - Failed to read from offset %ld in device %s\n",offset,device_name);
                refresh_command_win ();return (0);
        };
-       
+
        return (1);
 }
 
@@ -83,9 +84,9 @@ If logging is enabled, we log the change before writing it to the device.
 */
 {
        char temp [80];
-       
+
        if (!write_access) {
-               wprintw (command_win,"Error - Write access not aviable (use enablewrite)\n");
+               wprintw (command_win,"Error - Write access not available (use enablewrite)\n");
                return (0);
        }
 
@@ -95,7 +96,7 @@ If logging is enabled, we log the change before writing it to the device.
                internal_error ("AllowChanges=0 yet enablewrite succeeded","disk","low_write");
                return (0);
        }
-       
+
        if (device_handle==NULL) {
                internal_error ("No device opened yet read requested","disk","low_write");
                return (0);
@@ -107,7 +108,7 @@ If logging is enabled, we log the change before writing it to the device.
                return (0);
        }
 
-#endif 
+#endif
 
        if (LogChanges)
                if (!log_changes (buffer,length,offset))
@@ -124,7 +125,7 @@ If logging is enabled, we log the change before writing it to the device.
                refresh_command_win ();return (0);
        };
 
-       wprintw (command_win,"Data written");refresh_command_win ();    
+       wprintw (command_win,"Data written");refresh_command_win ();
        return (1);
 }
 
@@ -139,29 +140,29 @@ The hex bytes are converted to text, so that they will be readable with a standa
 
 {
        unsigned char *original;
-       
+
        int i;
        time_t current_time;
        FILE *fp;
-       
+
        if ((fp=fopen (LogFile,"a+"))==NULL) {
                wprintw (command_win,"Error - Unable to open log file %s\n",LogFile);
                refresh_command_win ();return (0);
        };
 
        current_time=time (NULL);
-       
+
        fprintf (fp,"\n----- EXT2ED log begin -----\n\n");
        fprintf (fp,"Time: %s\nDevice: %s\n",ctime ((time_t *) &current_time),device_name);
        fprintf (fp,"Offset: %lu\nLength: %lu\n",offset,length);
-       
+
        original=(unsigned char *) malloc (length*sizeof (unsigned char));
 
        if (original==NULL) {
                wprintw (command_win,"Fatal error - Can\'t allocate %lu bytes!");
                refresh_command_win ();fclose (fp);return (0);
        }
-       
+
        if (!low_read (original,length,offset)) {
                fclose (fp);return (0);
        }
@@ -172,17 +173,17 @@ The hex bytes are converted to text, so that they will be readable with a standa
                if (i%16==0 && i!=0) fprintf (fp,"\n");
                fprintf (fp,"%02x ",original [i]);
        }
-       
-       fprintf (fp,"\n\nNew data:\n\n");       
-       
+
+       fprintf (fp,"\n\nNew data:\n\n");
+
        for (i=0;i<length;i++) {
                if (i%16==0 && i!=0) fprintf (fp,"\n");
                fprintf (fp,"%02x ",buffer [i]);
        }
-       
+
        fprintf (fp,"\n----- EXT2ED log end  -----\n");
 
-       fclose (fp);    
+       fclose (fp);
        return (1);
 }
 
@@ -197,17 +198,17 @@ Just read from the current position into type data.
 {
        if (device_handle==NULL) {
                printf ("Error - No device opened\n");
-               return (0);             
+               return (0);
        }
 
        if (device_offset==-1) {
                printf ("Error - No offset set\n");
                return (0);
        }
-       
+
        if (low_read (type_data.u.buffer,EXT2_MAX_BLOCK_SIZE,device_offset)==0)
                return (0);
-               
+
        if (current_type!=NULL)
                if (strcmp (current_type->name,"ext2_dir_entry")==0)
                        current_type->length=type_data.u.t_ext2_dir_entry.rec_len;
@@ -221,7 +222,7 @@ int write_type_data (void)
        if (device_handle==NULL) {
                wprintw (command_win,"Error - No device opened\n");
                refresh_command_win ();
-               return (0);             
+               return (0);
        }
 
        if (device_offset==-1) {
@@ -229,10 +230,10 @@ int write_type_data (void)
                refresh_command_win ();
                return (0);
        }
-       
+
        if (low_write (type_data.u.buffer,file_system_info.block_size,device_offset)==0)
                return (0);
-               
+
        return (1);
 }