From: Jim Meyering <meyer...@redhat.com> --- configure.ac | 1 - debug/Makefile.am | 2 +- debug/clearfat/.gitignore | 1 - debug/clearfat/Makefile.am | 15 - debug/clearfat/clearfat.c | 353 --------------------- include/parted/filesys.h | 14 - libparted/filesys.c | 562 ---------------------------------- libparted/fs/amiga/affs.c | 150 --------- libparted/fs/amiga/apfs.c | 20 -- libparted/fs/amiga/asfs.c | 10 - libparted/fs/ext2/interface.c | 56 ---- libparted/fs/fat/fat.c | 65 ---- libparted/fs/hfs/hfs.c | 82 ----- libparted/fs/jfs/jfs.c | 14 - libparted/fs/linux_swap/linux_swap.c | 69 ----- libparted/fs/nilfs2/nilfs2.c | 10 - libparted/fs/ntfs/ntfs.c | 14 - libparted/fs/reiserfs/reiserfs.c | 24 -- libparted/fs/ufs/ufs.c | 28 -- libparted/fs/xfs/xfs.c | 14 - parted/parted.c | 88 ------ po/POTFILES.in | 2 - 22 files changed, 1 insertions(+), 1593 deletions(-) delete mode 100644 debug/clearfat/.gitignore delete mode 100644 debug/clearfat/Makefile.am delete mode 100644 debug/clearfat/clearfat.c
diff --git a/configure.ac b/configure.ac index 1ed2712..2aa257a 100644 --- a/configure.ac +++ b/configure.ac @@ -643,7 +643,6 @@ doc/Makefile doc/C/Makefile doc/pt_BR/Makefile debug/Makefile -debug/clearfat/Makefile debug/test/Makefile tests/Makefile po/Makefile.in diff --git a/debug/Makefile.am b/debug/Makefile.am index 16f9fe8..eacf2e8 100644 --- a/debug/Makefile.am +++ b/debug/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = clearfat test +SUBDIRS = test AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) MAINTAINERCLEANFILES = Makefile.in diff --git a/debug/clearfat/.gitignore b/debug/clearfat/.gitignore deleted file mode 100644 index 553b44c..0000000 --- a/debug/clearfat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -clearfat diff --git a/debug/clearfat/Makefile.am b/debug/clearfat/Makefile.am deleted file mode 100644 index a07e84f..0000000 --- a/debug/clearfat/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -noinst_PROGRAMS = clearfat - -AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) -clearfat_SOURCES = clearfat.c - -clearfat_LDADD = \ - $(top_builddir)/libparted/libparted.la \ - $(INTLLIBS) $(LIBS) \ - $(PARTED_LIBS) - -partedincludedir = -I$(top_srcdir)/lib -I$(top_srcdir)/include - -INCLUDES = $(partedincludedir) $(INTLINCS) - -MAINTAINERCLEANFILES = Makefile.in diff --git a/debug/clearfat/clearfat.c b/debug/clearfat/clearfat.c deleted file mode 100644 index 7b02a34..0000000 --- a/debug/clearfat/clearfat.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - clear_fat - a tool to clear unused space (for testing purposes) - Copyright (C) 2000, 2007-2011 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <config.h> - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <getopt.h> -#include "closeout.h" -#include "configmake.h" -#include "error.h" -#include "long-options.h" -#include "progname.h" -#include "xstrtol.h" - -#include "../../libparted/fs/fat/fat.h" - -#include <locale.h> - -/* Take care of NLS matters. */ - -#include "gettext.h" -#if ! ENABLE_NLS -# undef textdomain -# define textdomain(Domainname) /* empty */ -# undef bindtextdomain -# define bindtextdomain(Domainname, Dirname) /* empty */ -#endif - -#undef _ -#define _(msgid) gettext (msgid) - -#ifndef DISCOVER_ONLY - -/* The official name of this program (e.g., no `g' prefix). */ -#define PROGRAM_NAME "clearfat" - -#define AUTHORS \ - "<http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>" - -static void -usage (int status) -{ - if (status != EXIT_SUCCESS) - fprintf (stderr, _("Try `%s --help' for more information.\n"), - program_name); - else - { - printf (_("\ -Usage: %s [OPTION]\n\ - or: %s DEVICE MINOR\n"), PROGRAM_NAME, PROGRAM_NAME); - fputs (_("\ -Clear unused space on a FAT partition (a GNU Parted testing tool).\n\ -\n\ -"), stdout); - fputs (_(" --help display this help and exit\n"), stdout); - fputs (_(" --version output version information and exit\n"), - stdout); - printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); - } - exit (status); -} - -#define CLEAR_BUFFER_SIZE (1024 * 1024) -#define CLEAR_BUFFER_SECTORS (CLEAR_BUFFER_SIZE/512) - -static char buffer [CLEAR_BUFFER_SIZE]; - -/* generic clearing code ***************************************************/ - -static int -_clear_sectors (PedGeometry* geom, PedSector start, PedSector count) -{ - PedSector pos; - PedSector to_go = count; - - for (pos = start; - pos < start + count; - pos += CLEAR_BUFFER_SECTORS, to_go -= CLEAR_BUFFER_SECTORS) { - if (!ped_geometry_write (geom, buffer, start, - PED_MIN (CLEAR_BUFFER_SECTORS, to_go))) - return 0; - } - - return 1; -} - -static int -_clear_sector_range (PedGeometry* geom, PedSector start, PedSector end) -{ - return _clear_sectors (geom, start, end - start + 1); -} - -static int -_clear_sector (PedGeometry* geom, PedSector sector) -{ - return _clear_sectors (geom, sector, 1); -} - -static int -_clear_partial_sector (PedGeometry* geom, PedSector sector, - int offset, int count) -{ - if (!ped_geometry_read (geom, buffer, sector, 1)) - goto error; - memset (buffer + offset, 0, count); - if (!ped_geometry_write (geom, buffer, sector, 1)) - goto error; - - memset (buffer, 0, 512); - return 1; - -error: - memset (buffer, 0, 512); - return 0; -} - -static int -_clear_partial_range (PedGeometry* geom, PedSector sector, int start, int end) -{ - return _clear_partial_sector (geom, sector, start, end - start + 1); -} - -static int -_clear_clusters (PedFileSystem* fs, FatCluster start, FatCluster count) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - return _clear_sectors (fs->geom, fat_cluster_to_sector(fs, start), - count * fs_info->cluster_sectors); -} - -/* FAT code ******************************************************************/ - -static void -_clear_before_fat (PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - PedSector sector; - - for (sector = 1; sector < fs_info->fat_offset; sector++) { - if (sector == fs_info->info_sector_offset) - continue; - if (sector == fs_info->boot_sector_backup_offset) - continue; - _clear_sector (fs->geom, sector); - } -} - -static int -_calc_fat_entry_offset (PedFileSystem* fs, FatCluster cluster) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - - switch (fs_info->fat_type) { - case FAT_TYPE_FAT12: - PED_ASSERT (0); - break; - - case FAT_TYPE_FAT16: - return cluster * 2; - - case FAT_TYPE_FAT32: - return cluster * 4; - } - return 0; -} - -static void -_clear_unused_fats (PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - PedSector table_start; - int table_num; - int last_active_offset; - PedSector last_active_sector; - int last_active_sector_offset; - - last_active_offset - = _calc_fat_entry_offset (fs, fs_info->fat->cluster_count); - last_active_sector = last_active_offset / 512; - last_active_sector_offset = last_active_offset % 512 + 4; - - for (table_num = 0; table_num < fs_info->fat_table_count; table_num++) { - table_start = fs_info->fat_offset - + table_num * fs_info->fat_sectors; - - if (last_active_sector_offset < 512) { - _clear_partial_range ( - fs->geom, - table_start + last_active_sector, - last_active_sector_offset, - 512); - } - - if (last_active_sector < fs_info->fat_sectors - 2) { - _clear_sector_range ( - fs->geom, - table_start + last_active_sector + 1, - table_start + fs_info->fat_sectors - 1); - } - } -} - -static int -_clear_unused_clusters (PedFileSystem* fs) -{ - FatSpecific* fs_info = FAT_SPECIFIC (fs); - FatCluster cluster; - FatCluster run_start = 0; /* shut gcc up! */ - FatCluster run_length = 0; - - for (cluster = 2; cluster < fs_info->cluster_count + 2; cluster++) { - if (fat_table_is_available (fs_info->fat, cluster)) { - if (!run_length) { - run_start = cluster; - run_length = 1; - } else { - run_length++; - } - } else { - if (run_length) - _clear_clusters (fs, run_start, run_length); - run_length = 0; - } - } - - if (run_length) - _clear_clusters (fs, run_start, run_length); - - return 1; -} - -static void -_clear_unused_fat (PedFileSystem* fs) -{ - memset (buffer, 0, CLEAR_BUFFER_SIZE); - - _clear_before_fat (fs); - _clear_unused_fats (fs); - _clear_unused_clusters (fs); -} - -/* bureaucracy ***************************************************************/ - -int -main (int argc, char* argv[]) -{ - PedDevice* dev; - PedDisk* disk; - PedPartition* part; - PedFileSystem* fs; - - set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - atexit (close_stdout); - - parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION, - usage, AUTHORS, (char const *) NULL); - if (getopt_long (argc, argv, "", NULL, NULL) != -1) - usage (EXIT_FAILURE); - - if (argc - optind < 2) - { - error (0, 0, _("too few arguments")); - usage (EXIT_FAILURE); - } - if (2 < argc - optind) - { - error (0, 0, _("too many arguments")); - usage (EXIT_FAILURE); - } - - unsigned long minor_dev_number; - if (xstrtoul (argv[2], NULL, 10, &minor_dev_number, NULL) - || INT_MAX < minor_dev_number) - { - error (0, 0, _("invalid minor device number: %s"), argv[2]); - usage (EXIT_FAILURE); - } - - dev = ped_device_get (argv [1]); - if (!dev) - goto error; - if (!ped_device_open (dev)) - goto error; - - disk = ped_disk_new (dev); - if (!disk) - goto error_close_dev; - - part = ped_disk_get_partition (disk, minor_dev_number); - if (!part) { - printf ("Couldn't find partition `%s'\n", argv[2]); - goto error_destroy_disk; - } - - fs = ped_file_system_open (&part->geom); - if (!fs) - goto error_destroy_disk; - - if (strncmp (fs->type->name, "fat", 3)) { - printf ("Not a FAT file system!\n"); - goto error_close_fs; - } - - _clear_unused_fat (fs); - - ped_file_system_close (fs); - ped_disk_destroy (disk); - ped_device_close (dev); - return 0; - -error_close_fs: - ped_file_system_close (fs); -error_destroy_disk: - ped_disk_destroy (disk); -error_close_dev: - ped_device_close (dev); -error: - return 1; -} - -#else /* DISCOVER_ONLY */ - -/* hack! */ -int -main() -{ - printf ("You must compile libparted with full read/write support\n"); - return 1; -} - -#endif /* DISCOVER_ONLY */ diff --git a/include/parted/filesys.h b/include/parted/filesys.h index 45673ee..44258f5 100644 --- a/include/parted/filesys.h +++ b/include/parted/filesys.h @@ -38,20 +38,6 @@ typedef const struct _PedFileSystemOps PedFileSystemOps; struct _PedFileSystemOps { PedGeometry* (*probe) (PedGeometry* geom); - int (*clobber) (PedGeometry* geom); - - PedFileSystem* (*open) (PedGeometry* geom); - PedFileSystem* (*create) (PedGeometry* geom, PedTimer* timer); - int (*close) (PedFileSystem* fs); - int (*check) (PedFileSystem* fs, PedTimer* timer); - PedFileSystem* (*copy) (const PedFileSystem* fs, PedGeometry* geom, - PedTimer* timer); - int (*resize) (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer); - - PedConstraint* (*get_create_constraint) (const PedDevice* dev); - PedConstraint* (*get_resize_constraint) (const PedFileSystem* fs); - PedConstraint* (*get_copy_constraint) (const PedFileSystem* fs, - const PedDevice* dev); }; /** diff --git a/libparted/filesys.c b/libparted/filesys.c index bf458e5..854b8d3 100644 --- a/libparted/filesys.c +++ b/libparted/filesys.c @@ -211,66 +211,6 @@ ped_file_system_probe_specific ( } static int -_test_open (PedFileSystemType* fs_type, PedGeometry* geom) -{ - PedFileSystem* fs; - - ped_exception_fetch_all (); - fs = fs_type->ops->open (geom); - if (fs) - fs_type->ops->close (fs); - else - ped_exception_catch (); - ped_exception_leave_all (); - return fs != NULL; -} - -static PedFileSystemType* -_probe_with_open (PedGeometry* geom, int detected_count, - PedFileSystemType* detected[]) -{ - int i; - PedFileSystemType* open_detected = NULL; - - ped_device_open (geom->dev); - - /* If one and only one file system that Parted is able to open - * can be successfully opened on this geometry, return it. - * If more than one can be, return NULL. - */ - for (i=0; i<detected_count; i++) { - if (!detected[i]->ops->open || !_test_open (detected [i], geom)) - continue; - - if (open_detected) { - ped_device_close (geom->dev); - return NULL; - } else { - open_detected = detected [i]; - } - } - - /* If no file system has been successfully opened, and - * if Parted has detected at most one unopenable file system, - * return it. - */ - if (!open_detected) - for (i=0; i<detected_count; i++) { - if (detected[i]->ops->open) - continue; - if (open_detected) { - ped_device_close (geom->dev); - return NULL; - } else { - open_detected = detected [i]; - } - } - - ped_device_close (geom->dev); - return open_detected; -} - -static int _geometry_error (const PedGeometry* a, const PedGeometry* b) { PedSector start_delta = a->start - b->start; @@ -355,507 +295,5 @@ ped_file_system_probe (PedGeometry* geom) walk = _best_match (geom, detected, detected_error, detected_count); if (walk) return walk; - return _probe_with_open (geom, detected_count, detected); -} - -/** - * This function erases all file system signatures that indicate that a - * file system occupies a given region described by \p geom. - * After this operation ped_file_system_probe() won't detect any file system. - * - * \note ped_file_system_create() calls this before creating a new file system. - * - * \return \c 1 on success, \c 0 on failure - */ -int -ped_file_system_clobber (PedGeometry* geom) -{ - PedFileSystemType* fs_type = NULL; - - PED_ASSERT (geom != NULL); - - if (!ped_device_open (geom->dev)) - goto error; - - ped_exception_fetch_all (); - while ((fs_type = ped_file_system_type_get_next (fs_type))) { - PedGeometry* probed; - - if (!fs_type->ops->clobber) - continue; - - probed = ped_file_system_probe_specific (fs_type, geom); - if (!probed) { - ped_exception_catch (); - continue; - } - ped_geometry_destroy (probed); - - if (fs_type->ops->clobber && !fs_type->ops->clobber (geom)) { - ped_exception_leave_all (); - goto error_close_dev; - } - } - ped_device_close (geom->dev); - ped_exception_leave_all (); - return 1; - -error_close_dev: - ped_device_close (geom->dev); -error: - return 0; -} - -/* This function erases all signatures that indicate the presence of - * a file system in a particular region, without erasing any data - * contained inside the "exclude" region. - */ -static int -ped_file_system_clobber_exclude (PedGeometry* geom, - const PedGeometry* exclude) -{ - PedGeometry* clobber_geom; - int status; - - if (ped_geometry_test_sector_inside (exclude, geom->start)) - return 1; - - clobber_geom = ped_geometry_duplicate (geom); - if (ped_geometry_test_overlap (clobber_geom, exclude)) - ped_geometry_set_end (clobber_geom, exclude->start - 1); - - status = ped_file_system_clobber (clobber_geom); - ped_geometry_destroy (clobber_geom); - return status; -} - -/** - * This function opens the file system stored on \p geom, if it - * can find one. - * It is often called in the following manner: - * \code - * fs = ped_file_system_open (&part.geom) - * \endcode - * - * \throws PED_EXCEPTION_ERROR if file system could not be detected - * \throws PED_EXCEPTION_ERROR if the file system is bigger than its volume - * \throws PED_EXCEPTION_NO_FEATURE if opening of a file system stored on - * \p geom is not implemented - * - * \return a PedFileSystem on success, \c NULL on failure. - */ -PedFileSystem* -ped_file_system_open (PedGeometry* geom) -{ - PedFileSystemType* type; - PedFileSystem* fs; - PedGeometry* probed_geom; - - PED_ASSERT (geom != NULL); - - if (!ped_device_open (geom->dev)) - goto error; - - type = ped_file_system_probe (geom); - if (!type) { - ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, - _("Could not detect file system.")); - goto error_close_dev; - } - - probed_geom = ped_file_system_probe_specific (type, geom); - if (!probed_geom) - goto error_close_dev; - if (!ped_geometry_test_inside (geom, probed_geom)) { - if (ped_exception_throw ( - PED_EXCEPTION_ERROR, - PED_EXCEPTION_IGNORE_CANCEL, - _("The file system is bigger than its volume!")) - != PED_EXCEPTION_IGNORE) - goto error_destroy_probed_geom; - } - - if (!type->ops->open) { - ped_exception_throw (PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Support for opening %s file systems " - "is not implemented yet."), - type->name); - goto error_destroy_probed_geom; - } - - fs = type->ops->open (probed_geom); - if (!fs) - goto error_destroy_probed_geom; - ped_geometry_destroy (probed_geom); - return fs; - -error_destroy_probed_geom: - ped_geometry_destroy (probed_geom); -error_close_dev: - ped_device_close (geom->dev); -error: - return 0; -} - -/** - * This function initializes a new file system of type \p type on - * a region described by \p geom, writing out appropriate metadata and - * signatures. If \p timer is non-NULL, it is used as the progress meter. - * - * \throws PED_EXCEPTION_NO_FEATURE if creating file system type \p type - * is not implemented yet - * - * \return a PedFileSystem on success, \c NULL on failure - */ -PedFileSystem* -ped_file_system_create (PedGeometry* geom, const PedFileSystemType* type, - PedTimer* timer) -{ - PedFileSystem* fs; - - PED_ASSERT (geom != NULL); - PED_ASSERT (type != NULL); - - if (!type->ops->create) { - ped_exception_throw (PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Support for creating %s file systems " - "is not implemented yet."), - type->name); - goto error; - } - - if (!ped_device_open (geom->dev)) - goto error; - - if (!ped_file_system_clobber (geom)) - goto error_close_dev; - fs = type->ops->create (geom, timer); - if (!fs) - goto error_close_dev; - return fs; - -error_close_dev: - ped_device_close (geom->dev); -error: - return 0; -} - -/** - * Close file system \p fs. - * - * \return \c 1 on success, \c 0 on failure - */ -int -ped_file_system_close (PedFileSystem* fs) -{ - PedDevice* dev = fs->geom->dev; - - PED_ASSERT (fs != NULL); - - if (!fs->type->ops->close (fs)) - goto error_close_dev; - ped_device_close (dev); - return 1; - -error_close_dev: - ped_device_close (dev); - return 0; -} - -/** - * Check \p fs file system for errors. - * - * \throws PED_EXCEPTION_NO_FEATURE if checking file system \p fs is - * not implemented yet - * - * \return \c 0 on failure (i.e. unfixed errors) - */ -int -ped_file_system_check (PedFileSystem* fs, PedTimer* timer) -{ - PED_ASSERT (fs != NULL); - - if (!fs->type->ops->check) { - ped_exception_throw (PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Support for checking %s file systems " - "is not implemented yet."), - fs->type->name); - return 0; - } - return fs->type->ops->check (fs, timer); -} - -static int -_raw_copy (const PedGeometry* src, PedGeometry* dest, PedTimer* timer) -{ - char* buf; - PedSector pos; - - PED_ASSERT (src != NULL); - PED_ASSERT (dest != NULL); - PED_ASSERT (src->length <= dest->length); - - buf = ped_malloc (BUFFER_SIZE * 512); /* FIXME */ - if (!buf) - goto error; - - if (!ped_device_open (src->dev)) - goto error_free_buf; - if (!ped_device_open (dest->dev)) - goto error_close_src; - - for (pos = 0; pos + BUFFER_SIZE < src->length; pos += BUFFER_SIZE) { - ped_timer_update (timer, 1.0 * pos / src->length); - if (!ped_geometry_read (src, buf, pos, BUFFER_SIZE)) - goto error_close_dest; - if (!ped_geometry_write (dest, buf, pos, BUFFER_SIZE)) - goto error_close_dest; - } - if (pos < src->length) { - ped_timer_update (timer, 1.0 * pos / src->length); - if (!ped_geometry_read (src, buf, pos, src->length - pos)) - goto error_close_dest; - if (!ped_geometry_write (dest, buf, pos, src->length - pos)) - goto error_close_dest; - } - ped_timer_update (timer, 1.0); - - ped_device_close (src->dev); - ped_device_close (dest->dev); - free (buf); - return 1; - -error_close_dest: - ped_device_close (dest->dev); -error_close_src: - ped_device_close (src->dev); -error_free_buf: - free (buf); -error: - return 0; -} - -static PedFileSystem* -_raw_copy_and_resize (const PedFileSystem* fs, PedGeometry* geom, - PedTimer* timer) -{ - PedFileSystem* new_fs; - PedTimer* sub_timer = NULL; - - ped_timer_reset (timer); - ped_timer_set_state_name (timer, _("raw block copying")); - - sub_timer = ped_timer_new_nested (timer, 0.95); - if (!_raw_copy (fs->geom, geom, sub_timer)) - goto error; - ped_timer_destroy_nested (sub_timer); - - new_fs = ped_file_system_open (geom); - if (!new_fs) - goto error; - - ped_timer_set_state_name (timer, _("growing file system")); - - sub_timer = ped_timer_new_nested (timer, 0.05); - if (!ped_file_system_resize (new_fs, geom, sub_timer)) - goto error_close_new_fs; - ped_timer_destroy_nested (sub_timer); - return new_fs; - -error_close_new_fs: - ped_file_system_close (new_fs); -error: - ped_timer_destroy_nested (sub_timer); - return NULL; -} - -/** - * Create a new file system (of the same type) on \p geom, and - * copy the contents of \p fs into the new filesystem. - * If \p timer is non-NULL, it is used as the progress meter. - * - * \throws PED_EXCEPTION_ERROR when trying to copy onto an overlapping partition - * \throws PED_EXCEPTION_NO_FEATURE if copying of file system \p fs - * is not implemented yet - * - * \return a new PedFileSystem on success, \c NULL on failure - */ -PedFileSystem* -ped_file_system_copy (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) -{ - PedFileSystem* new_fs; - - PED_ASSERT (fs != NULL); - PED_ASSERT (geom != NULL); - - if (!ped_device_open (geom->dev)) - goto error; - - if (ped_geometry_test_overlap (fs->geom, geom)) { - ped_exception_throw ( - PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, - _("Can't copy onto an overlapping partition.")); - goto error_close_dev; - } - - if (!fs->checked && fs->type->ops->check) { - if (!ped_file_system_check (fs, timer)) - goto error_close_dev; - } - - if (!ped_file_system_clobber_exclude (geom, fs->geom)) - goto error_close_dev; - - if (!fs->type->ops->copy) { - if (fs->type->ops->resize) { - if (fs->geom->length <= geom->length) - return _raw_copy_and_resize ( - fs, (PedGeometry*) geom, - timer); - - ped_exception_throw ( - PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Direct support for copying file systems is " - "not yet implemented for %s. However, " - "support for resizing is implemented. " - "Therefore, the file system can be copied if " - "the new partition is at least as big as the " - "old one. So, either shrink the partition " - "you are trying to copy, or copy to a bigger " - "partition."), - fs->type->name); - goto error_close_dev; - } else { - ped_exception_throw ( - PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Support for copying %s file systems is not " - "implemented yet."), - fs->type->name); - goto error_close_dev; - } - } - new_fs = fs->type->ops->copy (fs, geom, timer); - if (!new_fs) - goto error_close_dev; - return new_fs; - -error_close_dev: - ped_device_close (geom->dev); -error: - return NULL;; -} - -/** - * Resize \p fs to new geometry \p geom. - * - * \p geom should satisfy the ped_file_system_get_resize_constraint(). - * (This isn't asserted, so it's not a bug not to... just it's likely - * to fail ;) If \p timer is non-NULL, it is used as the progress meter. - * - * \throws PED_EXCEPTION_NO_FEATURE if resizing of file system \p fs - * is not implemented yet - * - * \return \c 0 on failure - */ -int -ped_file_system_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) -{ - PED_ASSERT (fs != NULL); - PED_ASSERT (geom != NULL); - - if (!fs->type->ops->resize) { - ped_exception_throw (PED_EXCEPTION_NO_FEATURE, - PED_EXCEPTION_CANCEL, - _("Support for resizing %s file systems " - "is not implemented yet."), - fs->type->name); - return 0; - } - if (!fs->checked && fs->type->ops->check) { - if (!ped_file_system_check (fs, timer)) - return 0; - } - if (!ped_file_system_clobber_exclude (geom, fs->geom)) - return 0; - - return fs->type->ops->resize (fs, geom, timer); -} - -/** - * This function returns a constraint on the region that all file systems - * of a particular type \p fs_type created on device \p dev with - * ped_file_system_create() must satisfy. For example, FAT16 file systems must - * be at least 32 megabytes. - * - * \return \c NULL on failure - */ -PedConstraint* -ped_file_system_get_create_constraint (const PedFileSystemType* fs_type, - const PedDevice* dev) -{ - PED_ASSERT (fs_type != NULL); - PED_ASSERT (dev != NULL); - - if (!fs_type->ops->get_create_constraint) - return NULL; - return fs_type->ops->get_create_constraint (dev); -} -/** - * Return a constraint, that represents all of the possible ways the - * file system \p fs can be resized with ped_file_system_resize(). - * This takes into account the amount of used space on - * the filesystem \p fs and the capabilities of the resize algorithm. - * Hints: - * -# if constraint->start_align->grain_size == 0, or - * constraint->start_geom->length == 1, then the start cannot be moved - * -# constraint->min_size is the minimum size you can resize the partition - * to. You might want to tell the user this ;-). - * - * \return a PedConstraint on success, \c NULL on failure - */ -PedConstraint* -ped_file_system_get_resize_constraint (const PedFileSystem* fs) -{ - PED_ASSERT (fs != NULL); - - if (!fs->type->ops->get_resize_constraint) - return NULL; - return fs->type->ops->get_resize_constraint (fs); -} - -/** - * Get the constraint on copying \p fs with ped_file_system_copy() - * to somewhere on \p dev. - * - * \return a PedConstraint on success, \c NULL on failure - */ -PedConstraint* -ped_file_system_get_copy_constraint (const PedFileSystem* fs, - const PedDevice* dev) -{ - PedGeometry full_dev; - - PED_ASSERT (fs != NULL); - PED_ASSERT (dev != NULL); - - if (fs->type->ops->get_copy_constraint) - return fs->type->ops->get_copy_constraint (fs, dev); - - if (fs->type->ops->resize) { - if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1)) - return NULL; - return ped_constraint_new ( - ped_alignment_any, ped_alignment_any, - &full_dev, &full_dev, - fs->geom->length, dev->length); - } - return NULL; } - -/** @} */ diff --git a/libparted/fs/amiga/affs.c b/libparted/fs/amiga/affs.c index 11d375c..4f3a605 100644 --- a/libparted/fs/amiga/affs.c +++ b/libparted/fs/amiga/affs.c @@ -172,198 +172,48 @@ _amufs5_probe (PedGeometry* geom) { static PedFileSystemOps _affs0_ops = { probe: _affs0_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs1_ops = { probe: _affs1_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs2_ops = { probe: _affs2_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs3_ops = { probe: _affs3_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs4_ops = { probe: _affs4_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs5_ops = { probe: _affs5_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs6_ops = { probe: _affs6_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _affs7_ops = { probe: _affs7_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs_ops = { probe: _amufs_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs0_ops = { probe: _amufs0_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs1_ops = { probe: _amufs1_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs2_ops = { probe: _amufs2_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs3_ops = { probe: _amufs3_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs4_ops = { probe: _amufs4_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _amufs5_ops = { probe: _amufs5_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; #define AFFS_BLOCK_SIZES ((int[5]){512, 1024, 2048, 4096, 0}) diff --git a/libparted/fs/amiga/apfs.c b/libparted/fs/amiga/apfs.c index d5ece60..955d213 100644 --- a/libparted/fs/amiga/apfs.c +++ b/libparted/fs/amiga/apfs.c @@ -108,29 +108,9 @@ _apfs2_probe (PedGeometry* geom) { static PedFileSystemOps _apfs1_ops = { probe: _apfs1_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; static PedFileSystemOps _apfs2_ops = { probe: _apfs2_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; #define APFS_BLOCK_SIZES ((int[2]){512, 0}) diff --git a/libparted/fs/amiga/asfs.c b/libparted/fs/amiga/asfs.c index 2cd8307..7890b2b 100644 --- a/libparted/fs/amiga/asfs.c +++ b/libparted/fs/amiga/asfs.c @@ -118,16 +118,6 @@ error_part: static PedFileSystemOps _asfs_ops = { probe: _asfs_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; PedFileSystemType _asfs_type = { diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c index 222fbe1..09257ad 100644 --- a/libparted/fs/ext2/interface.c +++ b/libparted/fs/ext2/interface.c @@ -312,70 +312,14 @@ _ext2_get_resize_constraint (const PedFileSystem* fs) static PedFileSystemOps _ext2_ops = { probe: _ext2_probe, -#ifndef DISCOVER_ONLY - clobber: _ext2_clobber, - open: _ext2_open, - create: _ext2_create, - close: _ext2_close, - check: _ext2_check, - resize: _ext2_resize, - copy: NULL, - get_create_constraint: _ext2_get_create_constraint, - get_copy_constraint: NULL, - get_resize_constraint: _ext2_get_resize_constraint -#else /* !DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemOps _ext3_ops = { probe: _ext3_probe, -#ifndef DISCOVER_ONLY - clobber: _ext2_clobber, - open: _ext2_open, - create: NULL, - close: _ext2_close, - check: _ext2_check, - resize: _ext2_resize, - copy: NULL, - get_create_constraint: _ext2_get_create_constraint, - get_copy_constraint: NULL, - get_resize_constraint: _ext2_get_resize_constraint -#else /* !DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemOps _ext4_ops = { probe: _ext4_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_copy_constraint: NULL, - get_resize_constraint: NULL }; #define EXT23_BLOCK_SIZES ((int[6]){512, 1024, 2048, 4096, 8192, 0}) diff --git a/libparted/fs/fat/fat.c b/libparted/fs/fat/fat.c index 72e568e..2c8a399 100644 --- a/libparted/fs/fat/fat.c +++ b/libparted/fs/fat/fat.c @@ -432,25 +432,6 @@ fat_close (PedFileSystem* fs) return 1; } -/* Hack: just resize the file system outside of its boundaries! */ -PedFileSystem* -fat_copy (const PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) -{ - PedFileSystem* new_fs; - - new_fs = ped_file_system_open (fs->geom); - if (!new_fs) - goto error; - if (!ped_file_system_resize (new_fs, geom, timer)) - goto error_close_new_fs; - return new_fs; - -error_close_new_fs: - ped_file_system_close (new_fs); -error: - return 0; -} - static int _compare_fats (PedFileSystem* fs) { @@ -799,56 +780,10 @@ fat_get_create_constraint_fat32 (const PedDevice* dev) static PedFileSystemOps fat16_ops = { probe: fat_probe_fat16, -#ifndef DISCOVER_ONLY - clobber: fat_clobber, - open: fat_open, - create: fat_create_fat16, - close: fat_close, - check: fat_check, - resize: fat_resize, - copy: fat_copy, - get_create_constraint: fat_get_create_constraint_fat16, - get_resize_constraint: fat_get_resize_constraint, - get_copy_constraint: fat_get_copy_constraint, -#else /* !DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL, -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemOps fat32_ops = { probe: fat_probe_fat32, -#ifndef DISCOVER_ONLY - clobber: fat_clobber, - open: fat_open, - create: fat_create_fat32, - close: fat_close, - check: fat_check, - resize: fat_resize, - copy: fat_copy, - get_create_constraint: fat_get_create_constraint_fat32, - get_resize_constraint: fat_get_resize_constraint, - get_copy_constraint: fat_get_copy_constraint, -#else /* !DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - resize: NULL, - copy: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL, -#endif /* !DISCOVER_ONLY */ }; #define FAT_BLOCK_SIZES ((int[2]){512, 0}) diff --git a/libparted/fs/hfs/hfs.c b/libparted/fs/hfs/hfs.c index 51aec12..a2d4d07 100644 --- a/libparted/fs/hfs/hfs.c +++ b/libparted/fs/hfs/hfs.c @@ -1223,96 +1223,14 @@ hfsplus_extract (PedFileSystem* fs, PedTimer* timer) static PedFileSystemOps hfs_ops = { probe: hfs_probe, -#ifndef DISCOVER_ONLY - clobber: hfs_clobber, - open: hfs_open, - create: NULL, - close: hfs_close, -#ifndef HFS_EXTRACT_FS - check: NULL, -#else - check: hfs_extract, -#endif - copy: NULL, - resize: hfs_resize, - get_create_constraint: NULL, - get_resize_constraint: hfs_get_resize_constraint, - get_copy_constraint: NULL, -#else /* DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL, -#endif /* DISCOVER_ONLY */ }; static PedFileSystemOps hfsplus_ops = { probe: hfsplus_probe, -#ifndef DISCOVER_ONLY - clobber: hfsplus_clobber, - open: hfsplus_open, - create: NULL, - close: hfsplus_close, -#ifndef HFS_EXTRACT_FS - check: NULL, -#else - check: hfsplus_extract, -#endif - copy: NULL, - resize: hfsplus_resize, - get_create_constraint: NULL, - get_resize_constraint: hfsplus_get_resize_constraint, - get_copy_constraint: NULL, -#else /* DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL, -#endif /* DISCOVER_ONLY */ }; static PedFileSystemOps hfsx_ops = { probe: hfsx_probe, -#ifndef DISCOVER_ONLY - clobber: hfs_clobber, /* NOT hfsplus_clobber ! - HFSX can't be embedded */ - open: hfsplus_open, - create: NULL, - close: hfsplus_close, -#ifndef HFS_EXTRACT_FS - check: NULL, -#else - check: hfsplus_extract, -#endif - copy: NULL, - resize: hfsplus_resize, - get_create_constraint: NULL, - get_resize_constraint: hfsplus_get_resize_constraint, - get_copy_constraint: NULL, -#else /* DISCOVER_ONLY */ - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL, -#endif /* DISCOVER_ONLY */ }; diff --git a/libparted/fs/jfs/jfs.c b/libparted/fs/jfs/jfs.c index 684f818..4364817 100644 --- a/libparted/fs/jfs/jfs.c +++ b/libparted/fs/jfs/jfs.c @@ -77,20 +77,6 @@ jfs_clobber (PedGeometry* geom) static PedFileSystemOps jfs_ops = { probe: jfs_probe, -#ifndef DISCOVER_ONLY - clobber: jfs_clobber, -#else - clobber: NULL, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemType jfs_type = { diff --git a/libparted/fs/linux_swap/linux_swap.c b/libparted/fs/linux_swap/linux_swap.c index 019d700..571433f 100644 --- a/libparted/fs/linux_swap/linux_swap.c +++ b/libparted/fs/linux_swap/linux_swap.c @@ -638,83 +638,14 @@ _swap_swsusp_clobber (PedGeometry* geom) { static PedFileSystemOps _swap_v0_ops = { probe: _swap_v0_probe, -#ifndef DISCOVER_ONLY - clobber: _swap_v0_clobber, - open: _swap_v0_open, - create: swap_create, - close: swap_close, - check: swap_check, - copy: swap_copy, - resize: swap_resize, - get_create_constraint: swap_get_create_constraint, - get_resize_constraint: swap_get_resize_constraint, - get_copy_constraint: swap_get_copy_constraint -#else - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemOps _swap_v1_ops = { probe: _swap_v1_probe, -#ifndef DISCOVER_ONLY - clobber: _swap_v1_clobber, - open: _swap_v1_open, - create: swap_create, - close: swap_close, - check: swap_check, - copy: swap_copy, - resize: swap_resize, - get_create_constraint: swap_get_create_constraint, - get_resize_constraint: swap_get_resize_constraint, - get_copy_constraint: swap_get_copy_constraint -#else - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemOps _swap_swsusp_ops = { probe: _swap_swsusp_probe, -#ifndef DISCOVER_ONLY - clobber: _swap_swsusp_clobber, - open: _swap_swsusp_open, - create: swap_create, - close: swap_close, - check: swap_check, - copy: swap_copy, - resize: swap_resize, - get_create_constraint: swap_get_create_constraint, - get_resize_constraint: swap_get_resize_constraint, - get_copy_constraint: swap_get_copy_constraint -#else - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL -#endif /* !DISCOVER_ONLY */ }; static PedFileSystemType _swap_v0_type = { diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c index 43dd64d..511b155 100644 --- a/libparted/fs/nilfs2/nilfs2.c +++ b/libparted/fs/nilfs2/nilfs2.c @@ -139,16 +139,6 @@ nilfs2_probe (PedGeometry* geom) static PedFileSystemOps nilfs2_ops = { probe: nilfs2_probe, - clobber: NULL, - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; #define NILFS2_BLOCK_SIZES ((int[5]){1024, 2048, 4096, 8192, 0}) diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c index 03d18e9..7cb1db4 100644 --- a/libparted/fs/ntfs/ntfs.c +++ b/libparted/fs/ntfs/ntfs.c @@ -63,20 +63,6 @@ ntfs_clobber (PedGeometry* geom) static PedFileSystemOps ntfs_ops = { probe: ntfs_probe, -#ifndef DISCOVER_ONLY - clobber: ntfs_clobber, -#else - clobber: NULL, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemType ntfs_type = { diff --git a/libparted/fs/reiserfs/reiserfs.c b/libparted/fs/reiserfs/reiserfs.c index cb8071d..85c83c8 100644 --- a/libparted/fs/reiserfs/reiserfs.c +++ b/libparted/fs/reiserfs/reiserfs.c @@ -791,16 +791,6 @@ static void reiserfs_ops_done() #ifdef REISER_FULL_SUPPORT static PedFileSystemOps reiserfs_full_ops = { probe: reiserfs_probe, - clobber: reiserfs_clobber, - open: reiserfs_open, - create: reiserfs_create, - close: reiserfs_close, - check: reiserfs_check, - copy: reiserfs_copy, - resize: reiserfs_resize, - get_create_constraint: reiserfs_get_create_constraint, - get_resize_constraint: reiserfs_get_resize_constraint, - get_copy_constraint: reiserfs_get_copy_constraint }; static PedFileSystemType reiserfs_full_type = { @@ -813,20 +803,6 @@ static PedFileSystemType reiserfs_full_type = { static PedFileSystemOps reiserfs_simple_ops = { probe: reiserfs_probe, -#ifdef DISCOVER_ONLY - clobber: NULL, -#else - clobber: reiserfs_clobber, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemType reiserfs_simple_type = { diff --git a/libparted/fs/ufs/ufs.c b/libparted/fs/ufs/ufs.c index d4309a8..d082b1d 100644 --- a/libparted/fs/ufs/ufs.c +++ b/libparted/fs/ufs/ufs.c @@ -259,38 +259,10 @@ ufs_clobber (PedGeometry* geom) static PedFileSystemOps ufs_ops_sun = { probe: ufs_probe_sun, -#ifndef DISCOVER_ONLY - clobber: ufs_clobber, -#else - clobber: NULL, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemOps ufs_ops_hp = { probe: ufs_probe_hp, -#ifndef DISCOVER_ONLY - clobber: ufs_clobber, -#else - clobber: NULL, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemType ufs_type_sun = { diff --git a/libparted/fs/xfs/xfs.c b/libparted/fs/xfs/xfs.c index 11a6d66..21a0c03 100644 --- a/libparted/fs/xfs/xfs.c +++ b/libparted/fs/xfs/xfs.c @@ -82,20 +82,6 @@ xfs_clobber (PedGeometry* geom) static PedFileSystemOps xfs_ops = { probe: xfs_probe, -#ifndef DISCOVER_ONLY - clobber: xfs_clobber, -#else - clobber: NULL, -#endif - open: NULL, - create: NULL, - close: NULL, - check: NULL, - copy: NULL, - resize: NULL, - get_create_constraint: NULL, - get_resize_constraint: NULL, - get_copy_constraint: NULL }; static PedFileSystemType xfs_type = { diff --git a/parted/parted.c b/parted/parted.c index 23143b9..32c2fcc 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -819,66 +819,9 @@ partition_print_flags (PedPartition* part) return res; } -/* Prints a sector out, first in compact form, and then with a percentage. - * Eg: 32Gb (40%) - */ -static void -print_sector_compact_and_percent (PedSector sector, PedDevice* dev) -{ - char* compact; - char* percent; - - if (ped_unit_get_default() == PED_UNIT_PERCENT) - compact = ped_unit_format (dev, sector); - else - compact = ped_unit_format_custom (dev, sector, - PED_UNIT_COMPACT); - - percent = ped_unit_format_custom (dev, sector, PED_UNIT_PERCENT); - - printf ("%s (%s)\n", compact, percent); - - free (compact); - free (percent); -} - static int partition_print (PedPartition* part) { - PedFileSystem* fs; - PedConstraint* resize_constraint; - char* flags; - - fs = ped_file_system_open (&part->geom); - if (!fs) - return 1; - - putchar ('\n'); - - flags = partition_print_flags (part); - - printf (_("Minor: %d\n"), part->num); - printf (_("Flags: %s\n"), flags); - printf (_("File System: %s\n"), fs->type->name); - fputs (_("Size: "), stdout); - print_sector_compact_and_percent (part->geom.length, part->geom.dev); - - resize_constraint = ped_file_system_get_resize_constraint (fs); - if (resize_constraint) { - fputs (_("Minimum size: "), stdout); - print_sector_compact_and_percent (resize_constraint->min_size, - part->geom.dev); - fputs (_("Maximum size: "), stdout); - print_sector_compact_and_percent (resize_constraint->max_size, - part->geom.dev); - ped_constraint_destroy (resize_constraint); - } - - putchar ('\n'); - - free (flags); - ped_file_system_close (fs); - return 1; } @@ -1665,37 +1608,6 @@ _init_messages () label_type_msg = str_list_convert (list); str_list_destroy (list); -/* mkfs - file system types and aliases */ - list = str_list_create (_(fs_type_msg_start), NULL); - - first = 1; - for (fs_type = ped_file_system_type_get_next (NULL); - fs_type; fs_type = ped_file_system_type_get_next (fs_type)) { - if (fs_type->ops->create == NULL) - continue; - - if (first) - first = 0; - else - str_list_append (list, ", "); - str_list_append (list, fs_type->name); - } - for (fs_alias = ped_file_system_alias_get_next (NULL); - fs_alias; fs_alias = ped_file_system_alias_get_next (fs_alias)) { - if (fs_alias->fs_type->ops->create == NULL) - continue; - - if (first) - first = 0; - else - str_list_append (list, ", "); - str_list_append (list, fs_alias->alias); - } - str_list_append (list, "\n"); - - mkfs_fs_type_msg = str_list_convert (list); - str_list_destroy (list); - /* mkpart - file system types and aliases */ list = str_list_create (_(fs_type_msg_start), NULL); diff --git a/po/POTFILES.in b/po/POTFILES.in index 60b66e6..b3c16eb 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -17,7 +17,6 @@ lib/xalloc-die.c lib/xstrtol-error.c libparted/arch/beos.c -debug/clearfat/clearfat.c partprobe/partprobe.c # libparted @@ -27,7 +26,6 @@ libparted/cs/geom.c libparted/debug.c libparted/disk.c libparted/exception.c -libparted/filesys.c libparted/fs/reiserfs/reiserfs.c libparted/labels/aix.c libparted/labels/bsd.c -- 1.7.5.2.660.g9f46c _______________________________________________ bug-parted mailing list bug-parted@gnu.org https://lists.gnu.org/mailman/listinfo/bug-parted