[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Otavio Salvador otavio at alioth.debian.org
Wed May 30 02:25:17 UTC 2007


 include/parted/fdasd.h   |    1 
 include/parted/vtoc.h    |    1 
 libparted/labels/fdasd.c |   89 ++++++++++++++++++++++-------------------------
 libparted/labels/vtoc.c  |   46 ++++++++++++------------
 4 files changed, 66 insertions(+), 71 deletions(-)

New commits:
commit 2d8ef535c5d0ac783fca0220c9e677e44250711b
Author: Benno Schulenberg <bensberg at justemail.net>
Date:   Tue May 29 20:02:25 2007 +0200

    fdasd label: Move formatting out of translatable strings.
    
    Also gettextize several missed messages, and simplify some of them.
    
    Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>

diff --git a/include/parted/fdasd.h b/include/parted/fdasd.h
index f6b1e33..283191e 100644
--- a/include/parted/fdasd.h
+++ b/include/parted/fdasd.h
@@ -143,7 +143,6 @@ struct fdasd_hd_geometry {
 #define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
 
 #define FDASD_VERSION "1.05"
-#define FDASD_ERROR "fdasd error: "
 #define DEVICE "device"
 #define DISC   "disc"
 #define PART   "part"
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 198bce2..e4ecf52 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -100,58 +100,59 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str)
 
 	switch (why) {
 		case unable_to_open_disk:
-			sprintf(error, _("%s open error\n%s\n"), 
-			FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n", _("open error"), str);
 			break;
 		case unable_to_seek_disk:
-			sprintf(error, _("%s seek error\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n", _("seek error"), str);
 			break;
 		case unable_to_read_disk:
-			sprintf(error, _("%s read error\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n", _("read error"), str);
 			break;
 		case read_only_disk:
-			sprintf(error, _("%s write error\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n", _("write error"), str);
 			break;
 		case unable_to_ioctl:
-			sprintf(error, _("%s IOCTL error\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n", _("ioctl() error"), str);
 			break;
 		case api_version_mismatch:
-			sprintf(error, _("%s API version mismatch\n%s\n"), FDASD_ERROR,str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("API version mismatch"), str);
 			break;     
 		case wrong_disk_type:
-			sprintf(error, _("%s Unsupported disk type\n%s\n"),
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Unsupported disk type"), str);
 			break; 
 		case wrong_disk_format:
-			sprintf(error, _("%s Unsupported disk format\n%s\n"),
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Unsupported disk format"), str);
 			break;   
 		case disk_in_use:
-			sprintf(error, _("%s Disk in use\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Disk is in use"), str);
 			break;      
 		case config_syntax_error:
-			sprintf(error, _("%s Config file syntax error\n%s\n"),
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Syntax error in config file"), str);
 			break;       
 		case vlabel_corrupted:
-			sprintf(error, _("%s Volume label is corrupted.\n%s\n"), 
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Volume label is corrupted"), str);
 			break;
 		case dsname_corrupted:
-			sprintf(error, _("%s a data set name is corrupted.\n%s\n"), 
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("A data set name is corrupted"), str);
 			break;
 		case malloc_failed:
-			sprintf(error, _("%s space allocation\n%s\n"),
-			        FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Memory allocation failed"), str);
 			break;
 		case device_verification_failed:
-			sprintf(error, _("%s device verification failed\n" \
-			        "The specified device is not a valid DASD device\n"),
-			        FDASD_ERROR);
+			sprintf(error, "fdasd: %s -- %s\n",
+				_("Device verification failed"),
+				_("The specified device is not a valid DASD device"));,
 			break;
 		default: 
-			sprintf(error, _("%s Fatal error\n%s\n"), FDASD_ERROR, str);
+			sprintf(error, "fdasd: %s: %s\n", _("Fatal error"), str);
 	}
 
 	ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, message);
@@ -210,18 +211,15 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
 
 	anc->f4 = malloc(sizeof(format4_label_t));
 	if (anc->f4 == NULL) 
-		fdasd_error(anc, malloc_failed, 
-			    "FMT4 DSCB memory allocation failed.");
+		fdasd_error(anc, malloc_failed, "FMT4 DSCB.");
 
 	anc->f5 = malloc(sizeof(format5_label_t));
 	if (anc->f5 == NULL) 
-		fdasd_error(anc, malloc_failed,
-			    "FMT5 DSCB memory allocation failed.");
+		fdasd_error(anc, malloc_failed, "FMT5 DSCB.");
 
 	anc->f7 = malloc(sizeof(format7_label_t));
 	if (anc->f7 == NULL) 
-		fdasd_error(anc, malloc_failed,
-			    "FMT7 DSCB memory allocation failed.");
+		fdasd_error(anc, malloc_failed, "FMT7 DSCB.");
 
 	bzero(anc->f4, sizeof(format4_label_t));
 	bzero(anc->f5, sizeof(format5_label_t));
@@ -230,7 +228,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
 	v = malloc(sizeof(volume_label_t));
 	if (v == NULL) 
 		fdasd_error(anc, malloc_failed,
-			    "Volume label memory allocation failed.");
+			    _("No room for volume label."));
 	bzero(v, sizeof(volume_label_t));
 	anc->vlabel = v;
 
@@ -238,7 +236,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
         p = malloc(sizeof(partition_info_t));
 		if (p == NULL) 
 			fdasd_error(anc, malloc_failed,
-				   "Partition info memory allocation failed.");
+				    _("No room for partition info."));
 		p->used       = 0x00;
 		p->len_trk    = 0;
 		p->start_trk  = 0;
@@ -261,8 +259,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
 
 		p->f1 = malloc(sizeof(format1_label_t));
 		if (p->f1 == NULL) 
-			fdasd_error(anc, malloc_failed,
-			    "FMT1 DSCB memory allocation failed.");
+			fdasd_error(anc, malloc_failed, "FMT1 DSCB.");
 		bzero(p->f1, sizeof(format1_label_t));
 		
 		q = p;
@@ -709,7 +706,7 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd)
 	if (anc->f4->DS4IDFMT != 0xf4) {
 		if (strncmp(anc->vlabel->volkey,vtoc_ebcdic_enc("LNX1",str,4),4) == 0)
 			return 0;
-		fdasd_error(anc, wrong_disk_format, "Invalid VTOC");
+		fdasd_error(anc, wrong_disk_format, _("Invalid VTOC."));
 	} else {
 		fdasd_process_valid_vtoc (anc, b, fd);
 	}
@@ -763,12 +760,13 @@ fdasd_check_api_version (fdasd_anchor_t *anc, int f)
 	char s[LINE_LENGTH];
  
 	if (ioctl(f, DASDAPIVER, &api) != 0)
-		fdasd_error(anc, unable_to_ioctl, "Could not retrieve API version.");
+		fdasd_error(anc, unable_to_ioctl,
+			    _("Could not retrieve API version."));
  
 	if (api != DASD_MIN_API_VERSION) {
-		sprintf(s, "The current API version '%d' doesn't " \
+		sprintf(s, _("The current API version '%d' doesn't " \
 				"match dasd driver API version " \
-				"'%d'!", api, DASD_MIN_API_VERSION);
+				"'%d'!"), api, DASD_MIN_API_VERSION);
 		fdasd_error(anc, api_version_mismatch, s);
 	}
 }                                      
@@ -786,22 +784,21 @@ fdasd_get_geometry (fdasd_anchor_t *anc, int f)
 
 	if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) 
 		fdasd_error(anc, unable_to_ioctl,
-					"Could not retrieve disk geometry information.");
+			    _("Could not retrieve disk geometry information."));
 
 	if (ioctl(f, BLKSSZGET, &blksize) != 0)
 		fdasd_error(anc, unable_to_ioctl,
-					"Could not retrieve blocksize information.");
+			    _("Could not retrieve blocksize information."));
 
 	/* get disk type */
 	if (ioctl(f, BIODASDINFO, &dasd_info) != 0) 
 		fdasd_error(anc, unable_to_ioctl, 
-					"Could not retrieve disk information.");
+			    _("Could not retrieve disk information."));
 
-	if (strncmp(dasd_info.type, "ECKD", 4) != 0) {
-		sprintf(s, "This is not an ECKD disk! This disk type " \
-				"is not supported!");
-		fdasd_error(anc,wrong_disk_type, s);
-	}
+	if (strncmp(dasd_info.type, "ECKD", 4) != 0)
+		fdasd_error(anc, wrong_disk_type,
+			    _("This is not an ECKD disk!  " \
+			      "This disk type is not supported!"));
 
 	anc->dev_type   = dasd_info.dev_type;
 	anc->blksize    = blksize;

commit 0b91e19b6dd46cab0a9b907dd8e70a4e5d2c6a71
Author: Benno Schulenberg <bensberg at justemail.net>
Date:   Tue May 29 19:55:52 2007 +0200

    vtoc label: Move formatting out of translatable strings.
    
    Also gettextize a few missed messages, and remove some whitespace.
    
    Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>

diff --git a/include/parted/vtoc.h b/include/parted/vtoc.h
index 3e79478..2e09caa 100644
--- a/include/parted/vtoc.h
+++ b/include/parted/vtoc.h
@@ -43,7 +43,6 @@
 #define VOLSER_LENGTH 6
 #define BIG_DISK_SIZE 0x10000
 
-#define VTOC_ERROR "VTOC error:"
 
 typedef struct ttr              ttr_t;
 typedef struct cchhb            cchhb_t;
diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
index bd2c905..e81bf08 100644
--- a/libparted/labels/vtoc.c
+++ b/libparted/labels/vtoc.c
@@ -160,23 +160,23 @@ vtoc_error (enum failure why, char *s1, char *s2)
 
 	switch (why) {
 		case unable_to_open:
-			sprintf(error, _("%s opening device '%s' failed.\n%s\n"),
-					VTOC_ERROR, s1, s2);
+			sprintf(error, "VTOC: %s -- %s\n%s\n",
+				_("opening of device failed"), s1, s2);
 			break;
 		case unable_to_seek:
-			sprintf(error, _("%s seeking device '%s' failed.\n%s\n"),
-					VTOC_ERROR, s1, s2);
+			sprintf(error, "VTOC: %s -- %s\n%s\n",
+				_("seeking on device failed"), s1, s2);
 			break;
 		case unable_to_write:
-			sprintf(error, _("%s writing to device '%s' failed,\n%s\n"),
-					VTOC_ERROR, s1, s2);
+			sprintf(error, "VTOC: %s -- %s\n%s\n",
+				_("writing to device failed"), s1, s2);
 			break;
 		case unable_to_read:
-			sprintf(error, _("%s reading from device '%s' failed.\n%s\n"),
-					VTOC_ERROR, s1, s2);
+			sprintf(error, "VTOC: %s -- %s\n%s\n",
+				_("reading from device failed"), s1, s2);
 			break;
 		default:
-			sprintf(error, _("Fatal error\n"));
+			sprintf(error, "VTOC: %s\n", _("Fatal error"));
 	}
 
 	ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, error);
@@ -278,14 +278,14 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start,
 
 	if (lseek(f, vlabel_start, SEEK_SET) == -1) {
 		vtoc_error(unable_to_seek, "vtoc_read_volume_label",
-				   "Could not read volume label.");
+			   _("Could not read volume label."));
 		return 1;
 	}
 
 	rc = read(f, vlabel, sizeof(volume_label_t));
 	if (rc != sizeof(volume_label_t)) {
 		vtoc_error(unable_to_read, "vtoc_read_volume_label",
-				   "Could not read volume label.");
+			   _("Could not read volume label."));
 		return 1;
 	}
 
@@ -304,12 +304,12 @@ vtoc_write_volume_label (int f, unsigned long vlabel_start,
 
 	if (lseek(f, vlabel_start, SEEK_SET) == -1)
 		vtoc_error(unable_to_seek, "vtoc_write_volume_label",
-				   "Could not write volume label.");
+			   _("Could not write volume label."));
 
 	rc = write(f, vlabel, sizeof(volume_label_t)); 
 	if (rc != sizeof(volume_label_t)) 
 		vtoc_error(unable_to_write, "vtoc_write_volume_label",
-				   "Could not write volume label.");
+			   _("Could not write volume label."));
 
 	return 0;
 }
@@ -415,34 +415,34 @@ vtoc_read_label (int f, unsigned long position, format1_label_t *f1,
 
 	if (lseek(f, position, SEEK_SET) == -1) 
 		vtoc_error(unable_to_seek, "vtoc_read_label",
-				   _("Could not read VTOC labels."));
+			   _("Could not read VTOC labels."));
 
 	if (f1 != NULL) {
 		t = sizeof(format1_label_t);
 		if (read(f, f1, t) != t) 
 			vtoc_error(unable_to_read, "vtoc_read_label",
-					   _("Could not read VTOC FMT1 DSCB."));
+				   _("Could not read VTOC FMT1 DSCB."));
 	}
 
 	if (f4 != NULL) {
 		t = sizeof(format4_label_t);
 		if (read(f, f4, t) != t) 
 			vtoc_error(unable_to_read, "vtoc_read_label",
-					   _("Could not read VTOC FMT4 DSCB."));
+				   _("Could not read VTOC FMT4 DSCB."));
 	}
 
 	if (f5 != NULL) {
 		t = sizeof(format5_label_t);
 		if (read(f, f5, t) != t)
 			vtoc_error(unable_to_read, "vtoc_read_label",
-					   _("Could not read VTOC FMT5 DSCB."));
+				   _("Could not read VTOC FMT5 DSCB."));
 	}
 
 	if (f7 != NULL) {
 		t = sizeof(format7_label_t);
 		if (read(f, f7, t) != t) 
 			vtoc_error(unable_to_read, "vtoc_read_label",
-					   _("Could not read VTOC FMT7 DSCB."));
+				   _("Could not read VTOC FMT7 DSCB."));
 	}
 }
 
@@ -459,34 +459,34 @@ vtoc_write_label (int f, unsigned long position, format1_label_t *f1,
 
 	if (lseek(f, position, SEEK_SET) == -1) 
 		vtoc_error(unable_to_seek, "vtoc_write_label",
-				   _("Could not write VTOC labels."));
+			   _("Could not write VTOC labels."));
 
 	if (f1 != NULL) {
 		t = sizeof(format1_label_t);
 		if (write(f, f1, t) != t) 
 			vtoc_error(unable_to_write, "vtoc_write_label",
-					   _("Could not write VTOC FMT1 DSCB."));
+				   _("Could not write VTOC FMT1 DSCB."));
 	}
 
 	if (f4 != NULL) {
 		t = sizeof(format4_label_t);
 		if (write(f, f4, t) != t) 
 			vtoc_error(unable_to_write, "vtoc_write_label",
-					   _("Could not write VTOC FMT4 DSCB."));
+				   _("Could not write VTOC FMT4 DSCB."));
 	}
 
 	if (f5 != NULL) {
 		t = sizeof(format5_label_t);
 		if (write(f, f5, t) != t) 
 			vtoc_error(unable_to_write, "vtoc_write_label",
-					   _("Could not write VTOC FMT5 DSCB."));
+				   _("Could not write VTOC FMT5 DSCB."));
 	}
 
 	if (f7 != NULL) {
 		t = sizeof(format7_label_t);
 		if (write(f, f7, t) != t) 
 			vtoc_error(unable_to_write, "vtoc_write_label",
-					   _("Could not write VTOC FMT7 DSCB."));
+				   _("Could not write VTOC FMT7 DSCB."));
 	}
 }
 



More information about the Parted-commits mailing list