[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Thu Oct 1 13:12:23 UTC 2009
parted/parted.c | 22 ++++++++++++++++++++++
tests/test-lib.sh | 1 +
2 files changed, 23 insertions(+)
New commits:
commit a2f21d4ba78eab54e20721b8975151edb95e0ab4
Author: Jim Meyering <meyering at redhat.com>
Date: Thu Oct 1 15:01:52 2009 +0200
parted: issue a warning upon any use of a file-system op
* parted/parted.c (issue_fs_op_warning): New function.
(do_cp, do_mkfs, do_mkpartfs, do_move, do_resize, do_check): Call it.
* tests/test-lib.sh: Export the envvar setting,
PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1 to suppress
those warnings while running the few remaining FS-related tests.
diff --git a/parted/parted.c b/parted/parted.c
index 0dd11d2..30500db 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -444,9 +444,26 @@ help_on (char* topic)
command_print_help (cmd);
}
+/* Issue a warning about upcoming removal of FS support. */
+static void
+issue_fs_op_warning (char const *op)
+{
+ if (getenv ("PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING"))
+ return;
+ fprintf (stderr,
+ _("WARNING: you are attempting to use %s to operate on (%s) a file system.\n"
+ "%s's file system manipulation code is not as robust as what you'll find in\n"
+ "dedicated, file-system-specific packages like e2fsprogs. We recommend\n"
+ "you use %s only to manipulate partition tables, whenever possible.\n"
+ "Support for performing most types and operations on most types of file\n"
+ "systems will be removed in an upcoming release.\n"),
+ program_name, op, program_name, program_name);
+}
+
static int
do_check (PedDevice** dev)
{
+ issue_fs_op_warning ("check");
PedDisk* disk;
PedFileSystem* fs;
PedPartition* part = NULL;
@@ -483,6 +500,7 @@ error:
static int
do_cp (PedDevice** dev)
{
+ issue_fs_op_warning ("cp");
PedDisk* src_disk;
PedDisk* dst_disk;
PedPartition* src = NULL;
@@ -635,6 +653,7 @@ error:
static int
do_mkfs (PedDevice** dev)
{
+ issue_fs_op_warning ("mkfs");
PedDisk* disk;
PedPartition* part = NULL;
const PedFileSystemType* type = ped_file_system_type_get ("ext2");
@@ -863,6 +882,7 @@ error:
static int
do_mkpartfs (PedDevice** dev)
{
+ issue_fs_op_warning ("mkpartfs");
PedDisk* disk;
PedPartition* part;
PedPartitionType part_type;
@@ -1036,6 +1056,7 @@ error:
static int
do_move (PedDevice** dev)
{
+ issue_fs_op_warning ("move");
PedDisk* disk;
PedPartition* part = NULL;
PedFileSystem* fs;
@@ -1778,6 +1799,7 @@ error:
static int
do_resize (PedDevice** dev)
{
+ issue_fs_op_warning ("resize");
PedDisk *disk;
PedPartition *part = NULL;
PedFileSystem *fs;
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index ff22fbc..3deec79 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -7,6 +7,7 @@ LANG=C
LC_ALL=C
TZ=UTC
export LANG LC_ALL TZ
+export PARTED_SUPPRESS_FILE_SYSTEM_MANIPULATION_WARNING=1
. ./init.sh || { echo >&2 you must run make first; exit 1; }
More information about the Parted-commits
mailing list