Anonymous avatar Anonymous committed e3a3fac

Fix a bug in change type function. Remove amiga and pc98 checks, and remove a work-around for these partition label types from perform_resize. (fdisk@sv.gnu.org/fdisk--main--0--patch-37)
fdisk@sv.gnu.org/fdisk--main--0--patch-37
Keywords:

Comments (0)

Files changed (5)

    They commited it before failing, anyway. It is a bit like a hack, I might make the functions
    make it themselves. I actually did, but I had a little trouble with the UI, so for now it is this way
  */
+/* FIXME */
 static int
 _disk_reread(PedPartition **part) {
 	int partnum;
 	PedSector start,end,first,last;
 	UIOpts opts = UI_WARN_COMMIT;
 	if (!((*part)->type & PED_PARTITION_EXTENDED)) {
-		if ((*part)->fs_type->ops->resize != NULL) {
+		if ((*part)->fs_type && (*part)->fs_type->ops->resize) {
 			menu_title(_("What do you want to do?"));
 			key = do_menu(resize_menu, 11, MENU_BUTTON | MENU_TITLE,resize_keys, NULL);
 		}
 		return 0;
 	else if (key == 'a')
 		type = ped_file_system_probe(&(*part)->geom);
-	if (!perform_set_system(disk,*part,type)) {
+	else if (!perform_set_system(disk,*part,type)) {
 		warning_waitkey(N_("Couldn't change the filesystem type"));
 		return 0;
 	}
 	}
 
 	info = str_list_append(info,"");
-
+	/* Position in sectors */
+	snprintf(buf,SMALLBUF,"%30s: %llds-%llds", _("Position"), 
+	         (*part)->geom.start, (*part)->geom.end);
+	info = str_list_append(info,buf);
 	/* Start and end */
 	snprintf(buf,SMALLBUF,"%30s: %s", _("Start (cyl,heads,sector)"),
 	         ped_unit_format_custom ((*part)->disk->dev, (*part)->geom.start, PED_UNIT_CHS));
 				key = 0;
 			} else {
 				key = main_plist(&selected, key);
+				/* Count which partition is now selected */
+				PedPartition *temp;
+				selnum = 0;
+				for(temp = ped_disk_next_partition(*cdisk,NULL);
+				    temp && temp != selected;
+				    temp = ped_disk_next_partition(*cdisk,temp))
+					selnum++;
 				redraw = 1;
 			}
 		}
 }
 
 
-/* FIXME: It doesn't always work as expected */
+
 int
 perform_resize (PedDisk *disk, PedPartition *part, PedSector start, PedSector end, UIOpts opts)
 {
 
 	/* FIXME: Decide when exactly we need to "fuzzify" */
 	//if (!(opts & UI_CUSTOM_VALUES) && (opts & UI_NO_FS_RESIZE)) {
+	if (opts & UI_RESIZE_INEXACT) {
 		if (part->geom.start != start)
 			fuzzify(range_start,disk->dev,NULL);
 		if (part->geom.end != end)
 			fuzzify(range_end,disk->dev,NULL);
+	}
 	//}
         if (!ped_geometry_init (&new_geom, disk->dev, start, end - start + 1))
                 goto error;
 	/* Allow the user to specify the partition type */
 	UI_SPECIFY_PART_TYPE = 4,
 	/* Option specific for each function */
-	UI_FUNCTION_SPECIFIC_1 = 8
+	UI_FUNCTION_SPECIFIC_1 = 8,
+	UI_FUNCTION_SPECIFIC_2 = 16
 };
 
 /* Specific for perform_resize: */
 #define UI_NO_FS_RESIZE UI_FUNCTION_SPECIFIC_1	/* Will only change geometry */
+#define UI_RESIZE_INEXACT UI_FUNCTION_SPECIFIC_2 /* Exact resize */
 /* Specific for perform_set: */
 #define UI_FLAG_TOGGLE UI_FUNCTION_SPECIFIC_1	/* perform_set must toggle flags */
 
-
 /* Setting of UICalls */
 extern void set_uicalls(UICalls *);
 

tests/check_advanced.c

 	srunner_run_all (sr, CK_NORMAL);
 	nf = srunner_ntests_failed(sr);
 	srunner_free(sr);
+	unlink_tempfile();
+	unlink(tempfile2_name());
 	return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }

tests/check_common.c

 	tcase_add_test(tc_chsize, test_partpos);
 	tcase_add_test(tc_chsize, test_chsize_msdos);
 	tcase_add_test(tc_chsize, test_chsize_bsd);
-	tcase_add_test(tc_chsize, test_chsize_pc98);
-	tcase_add_test(tc_chsize, test_chsize_amiga);
+	//tcase_add_test(tc_chsize, test_chsize_pc98);
+	//tcase_add_test(tc_chsize, test_chsize_amiga);
 	tcase_add_test(tc_chsize, test_chsize_gpt);
 	//tcase_add_test(tc_chsize, test_chsize_dvh);
 	tcase_add_test(tc_chsize, test_chsize_mac);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.