[parted-devel] Deprecate ped[register|unregister]_disk_type
Debarshi Ray
debarshi.ray at gmail.com
Sat Dec 9 19:55:10 CET 2006
Here is a patch to deprecate ped_[register|unregister]_disk_type in
favour of ped_disk_type_[register|unregister]. I did this since almost
all the functions in libparted have ped_<filename> as a prefix, which
was not the case here.
The older functions are still there and they throw an exception of
type INFORMATION. We can keep them this way for some time and then
finally remove them in a 2.x release.
What do you think?
Happy hacking,
Debarshi
--
Universities are places of knowledge. The freshman each bring a
little in with them, and the seniors take none away, so knowledge
accumulates.
-------------- next part --------------
From e6618e0d7a330c982607a8829c15a35784893947 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <rishi at gnu.org>
Date: Sun, 10 Dec 2006 05:42:07 +0530
Subject: Deprecate ped_[register|unregister]_disk_type in favour of ped_disk_type_[register|unregister]. A simple renaming was done.
---
include/parted/disk.h | 10 ++++++++--
libparted/disk.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/include/parted/disk.h b/include/parted/disk.h
index 286740b..6884020 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -222,8 +222,8 @@ struct _PedDiskArchOps {
int (*disk_commit) (PedDisk* disk);
};
-extern void ped_register_disk_type (PedDiskType* type);
-extern void ped_unregister_disk_type (PedDiskType* type);
+extern void ped_disk_type_register (PedDiskType* type);
+extern void ped_disk_type_unregister (PedDiskType* type);
extern PedDiskType* ped_disk_type_get_next (PedDiskType* type);
extern PedDiskType* ped_disk_type_get (const char* name);
extern int ped_disk_type_check_feature (const PedDiskType* disk_type,
@@ -248,6 +248,12 @@ extern int ped_disk_get_primary_partitio
extern int ped_disk_get_last_partition_num (PedDisk* disk);
extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);
+/**
+ * Deprecated functions.
+ */
+extern void ped_register_disk_type (PedDiskType* type);
+extern void ped_unregister_disk_type (PedDiskType* type);
+
/** @} */
/**
diff --git a/libparted/disk.c b/libparted/disk.c
index df6b4f1..8557874 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -65,7 +65,7 @@ static int _disk_raw_add (PedDisk* disk,
static PedDiskType* disk_types = NULL;
void
-ped_register_disk_type (PedDiskType* disk_type)
+ped_disk_type_register (PedDiskType* disk_type)
{
PED_ASSERT (disk_type != NULL, return);
PED_ASSERT (disk_type->ops != NULL, return);
@@ -76,7 +76,7 @@ ped_register_disk_type (PedDiskType* dis
disk_types = (struct _PedDiskType*) disk_type;
}
-void ped_unregister_disk_type (PedDiskType* disk_type)
+void ped_disk_type_unregister (PedDiskType* disk_type)
{
PedDiskType* walk;
PedDiskType* last = NULL;
@@ -2248,5 +2248,31 @@ ped_disk_print (PedDisk* disk)
ped_partition_print (part);
}
-/** @} */
+/**
+ * Deprecated function. Use ped_disk_type_register instead.
+ */
+void
+ped_register_disk_type (PedDiskType* disk_type)
+{
+ ped_exception_throw (
+ PED_EXCEPTION_INFORMATION,
+ PED_EXCEPTION_OK,
+ _("ped_register_disk_type is deprecated. "
+ "Use ped_disk_type_register instead."));
+ ped_disk_type_register (disk_type);
+}
+
+/**
+ * Deprecated function. Use ped_disk_type_unregister instead.
+ */
+void ped_unregister_disk_type (PedDiskType* disk_type)
+{
+ ped_exception_throw (
+ PED_EXCEPTION_INFORMATION,
+ PED_EXCEPTION_OK,
+ _("ped_unregister_disk_type is deprecated. "
+ "Use ped_disk_type_unregister instead."));
+ ped_disk_type_unregister (disk_type);
+}
+/** @} */
--
1.4.2.4
More information about the parted-devel
mailing list