All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Adding Reiser4 probe *only* to GNU Parted v3.3
@ 2020-11-11  7:51 Metztli Information Technology
  0 siblings, 0 replies; only message in thread
From: Metztli Information Technology @ 2020-11-11  7:51 UTC (permalink / raw)
  To: reiserfs-devel; +Cc: Metztli Information Technology

---
 libparted/Makefile.am          |  1 +
 libparted/fs/Makefile.am       |  3 ++
 libparted/fs/reiser4/reiser4.c | 71 ++++++++++++++++++++++++++++++++++
 libparted/libparted.c          |  4 ++
 4 files changed, 79 insertions(+)
 create mode 100644 libparted/fs/reiser4/reiser4.c

diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index bcdde77..0e86ca0 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -3,6 +3,7 @@
 #
 # This file may be modified and/or distributed without restriction.
 
+AUTOMAKE_OPTIONS = subdir-objects
 SUBDIRS_CHECK =
 if HAVE_CHECK
 SUBDIRS_CHECK += tests
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index 74f275a..675c01e 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -3,6 +3,8 @@
 #
 # This file may be modified and/or distributed without restriction.
 
+AUTOMAKE_OPTIONS = subdir-objects
+
 partedincludedir = -I$(top_builddir)/include -I$(top_srcdir)/include
 
 AM_CFLAGS = $(WARN_CFLAGS)
@@ -44,6 +46,7 @@ libfs_la_SOURCES =		\
   ntfs/ntfs.c			\
   reiserfs/reiserfs.c		\
   reiserfs/reiserfs.h		\
+  reiser4/reiser4.c		\
   udf/udf.c			\
   ufs/ufs.c			\
   xfs/platform_defs.h		\
diff --git a/libparted/fs/reiser4/reiser4.c b/libparted/fs/reiser4/reiser4.c
new file mode 100644
index 0000000..0a86e0c
--- /dev/null
+++ b/libparted/fs/reiser4/reiser4.c
@@ -0,0 +1,71 @@
+/*
+    libparted - a library for manipulating disk partitions
+    Copyright (C) 2000 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 2 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, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/endian.h>
+
+#if ENABLE_NLS
+#  include <libintl.h>
+#  define _(String) dgettext (PACKAGE, String)
+#else
+#  define _(String) (String)
+#endif /* ENABLE_NLS */
+
+#include <unistd.h>
+#include <string.h>
+
+static PedGeometry*
+reiser4_probe (PedGeometry* geom)
+{
+	char	buf[512];
+
+	if (!ped_geometry_read (geom, buf, 128, 1))
+		return 0;	
+	
+	if ( strcmp( buf, "ReIsEr4" ) == 0 )
+		return ped_geometry_duplicate( geom ) ;
+
+	else
+		return NULL;
+}
+
+static PedFileSystemOps reiser4_ops = {
+	probe:		reiser4_probe,
+};
+
+static PedFileSystemType reiser4_type = {
+	next:	NULL,
+	ops:	&reiser4_ops,
+	name:	"reiser4"
+};
+
+void
+ped_file_system_reiser4_init ()
+{
+	ped_file_system_type_register (&reiser4_type);
+}
+
+void
+ped_file_system_reiser4_done ()
+{
+	ped_file_system_type_unregister (&reiser4_type);
+}
+
diff --git a/libparted/libparted.c b/libparted/libparted.c
index 00f5ff8..4cb8882 100644
--- a/libparted/libparted.c
+++ b/libparted/libparted.c
@@ -110,6 +110,7 @@ extern void ped_file_system_jfs_init (void);
 extern void ped_file_system_hfs_init (void);
 extern void ped_file_system_fat_init (void);
 extern void ped_file_system_ext2_init (void);
+extern void ped_file_system_reiser4_init (void);
 extern void ped_file_system_nilfs2_init (void);
 extern void ped_file_system_btrfs_init (void);
 extern void ped_file_system_udf_init (void);
@@ -127,6 +128,7 @@ init_file_system_types ()
 	ped_file_system_hfs_init ();
 	ped_file_system_fat_init ();
 	ped_file_system_ext2_init ();
+	ped_file_system_reiser4_init ();
 	ped_file_system_nilfs2_init ();
 	ped_file_system_btrfs_init ();
 	ped_file_system_udf_init ();
@@ -193,6 +195,7 @@ extern void ped_file_system_ntfs_done (void);
 extern void ped_file_system_reiserfs_done (void);
 extern void ped_file_system_ufs_done (void);
 extern void ped_file_system_xfs_done (void);
+extern void ped_file_system_reiser4_done (void);
 extern void ped_file_system_amiga_done (void);
 extern void ped_file_system_btrfs_done (void);
 extern void ped_file_system_udf_done (void);
@@ -210,6 +213,7 @@ done_file_system_types ()
 	ped_file_system_reiserfs_done ();
 	ped_file_system_ufs_done ();
 	ped_file_system_xfs_done ();
+	ped_file_system_reiser4_done ();
 	ped_file_system_amiga_done ();
 	ped_file_system_btrfs_done ();
 	ped_file_system_udf_done ();
-- 
2.27.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-11  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11  7:51 [PATCH] Adding Reiser4 probe *only* to GNU Parted v3.3 Metztli Information Technology

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.