parted: add my current patchset

Builds but doesn't work yet (keeps crashing and catching SIGSEGV).
This commit is contained in:
François Revol
2015-12-22 02:19:32 +01:00
parent 940109128e
commit e7fd865e08

View File

@@ -0,0 +1,310 @@
From 8a3bdcae63f930cff0200f033e50eaa2fe8f8cef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Thu, 22 Jul 2010 14:02:34 +0200
Subject: [PATCH 1/7] build: Add Haiku as a supported OS
using the BeOS backend which should be compatible.
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index b04eb3f..00a991b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,8 @@ case "$host_os" in
linux*) OS=linux ;;
gnu*) OS=gnu ;;
beos*) OS=beos ;;
- *) AC_MSG_ERROR([Unknown or unsupported OS "$host_os". Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
+ haiku*) OS=beos ;;
+ *) AC_MSG_ERROR([Unknown or unsupported OS "$host_os". Only "linux", "gnu", "beos" and "haiku" are supported in this version of GNU Parted.]) ;;
esac
AC_SUBST([OS])
--
2.2.2
From 46e8c05bb09e9bcfe690039cd22f6a3988dbcd8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 00:32:27 +0100
Subject: [PATCH 2/7] libparted: fix ZETA check
Haiku doesn't define those.
---
libparted/arch/beos.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libparted/arch/beos.c b/libparted/arch/beos.c
index 6a8a5ae..168f58b 100644
--- a/libparted/arch/beos.c
+++ b/libparted/arch/beos.c
@@ -33,7 +33,7 @@
#include <drivers/Drivers.h>
/* ZETA R1+ APIs */
-#if B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
+#if defined(B_ZETA_VERSION) && B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
# include <device/ata_info.h>
#endif
@@ -102,7 +102,7 @@ _flush_cache(PedDevice* dev)
}
}
-#if B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
+#if defined(B_ZETA_VERSION) && B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
static int
_device_init_ata(PedDevice* dev)
{
@@ -218,7 +218,7 @@ _device_init_blkdev(PedDevice* dev)
{
int type;
-#if B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
+#if defined(B_ZETA_VERSION) && B_ZETA_VERSION >= B_ZETA_VERSION_1_0_0
if (!(type=_device_init_ata(dev)))
#endif
type = _device_init_generic_blkdev(dev);
--
2.2.2
From 0cfd6f520aa3da1b6da6e45b0509857c6a1ba567 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 00:35:19 +0100
Subject: [PATCH 3/7] xfs: define loff_t for platforms lacking it
It's not a POSIX type.
---
libparted/fs/xfs/platform_defs.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libparted/fs/xfs/platform_defs.h b/libparted/fs/xfs/platform_defs.h
index 2b55752..b754979 100644
--- a/libparted/fs/xfs/platform_defs.h
+++ b/libparted/fs/xfs/platform_defs.h
@@ -51,6 +51,10 @@
# define constpp char * const *
#endif
+#ifdef __HAIKU__
+typedef off_t loff_t;
+#endif
+
typedef loff_t xfs_off_t;
typedef uint64_t xfs_ino_t;
typedef uint32_t xfs_dev_t;
--
2.2.2
From 662700691d3bebc085ca36f0674f6261640c25b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 01:01:53 +0100
Subject: [PATCH 4/7] libparted: fix Haiku build
---
libparted/arch/beos.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/libparted/arch/beos.c b/libparted/arch/beos.c
index 168f58b..da05f2e 100644
--- a/libparted/arch/beos.c
+++ b/libparted/arch/beos.c
@@ -270,7 +270,6 @@ done:
static PedDevice*
beos_new (const char* path)
{
- struct stat stat_info;
PedDevice* dev;
PED_ASSERT(path != NULL);
@@ -423,12 +422,17 @@ beos_read (const PedDevice* dev, void* buffer, PedSector start, PedSector count)
{
case PED_EXCEPTION_IGNORE:
return 1;
+
case PED_EXCEPTION_RETRY:
break /* out of switch */;
+
case PED_EXCEPTION_UNHANDLED:
ped_exception_catch ();
case PED_EXCEPTION_CANCEL:
return 0;
+ default:
+ PED_ASSERT (0);
+ break;
}
}
@@ -442,7 +446,7 @@ beos_read (const PedDevice* dev, void* buffer, PedSector start, PedSector count)
if (status > 0)
{
read_length -= status;
- buffer += status;
+ buffer = (char *) buffer + status;
continue;
}
@@ -457,12 +461,17 @@ beos_read (const PedDevice* dev, void* buffer, PedSector start, PedSector count)
{
case PED_EXCEPTION_IGNORE:
return 1;
+
case PED_EXCEPTION_RETRY:
break;
+
case PED_EXCEPTION_UNHANDLED:
ped_exception_catch ();
case PED_EXCEPTION_CANCEL:
return 0;
+ default:
+ PED_ASSERT (0);
+ break;
}
}
@@ -508,12 +517,17 @@ beos_write (PedDevice* dev, const void* buffer, PedSector start,
{
case PED_EXCEPTION_IGNORE:
return 1;
+
case PED_EXCEPTION_RETRY:
break;
+
case PED_EXCEPTION_UNHANDLED:
ped_exception_catch ();
case PED_EXCEPTION_CANCEL:
return 0;
+ default:
+ PED_ASSERT (0);
+ break;
}
}
@@ -531,7 +545,7 @@ beos_write (PedDevice* dev, const void* buffer, PedSector start,
if (status > 0)
{
write_length -= status;
- buffer += status;
+ buffer = (char *) buffer + status;
continue;
}
@@ -545,12 +559,17 @@ beos_write (PedDevice* dev, const void* buffer, PedSector start,
{
case PED_EXCEPTION_IGNORE:
return 1;
+
case PED_EXCEPTION_RETRY:
break;
+
case PED_EXCEPTION_UNHANDLED:
ped_exception_catch ();
case PED_EXCEPTION_CANCEL:
return 0;
+ default:
+ PED_ASSERT (0);
+ break;
}
}
#endif /* !READ_ONLY */
--
2.2.2
From 9c306e4985dfbfb94ec9b207a38749ad7ccbc2cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 01:02:22 +0100
Subject: [PATCH 5/7] build: use -lnetwork on Haiku, not -lsocket
---
configure.ac | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 00a991b..3d88448 100644
--- a/configure.ac
+++ b/configure.ac
@@ -487,11 +487,18 @@ fi
dnl BeOS/ZETA/Haiku:
-if test "$OS" = beos; then
- dnl Include the socket library, as it is a depedency of libuuid
- dnl and so also of us (due to socket() call in libuuid)
- OS_LIBS="$OS_LIBS -lsocket"
-fi
+case "$host_os" in
+ beos*)
+ dnl Include the socket library, as it is a depedency of libuuid
+ dnl and so also of us (due to socket() call in libuuid)
+ OS_LIBS="$OS_LIBS -lsocket"
+ ;;
+ haiku*)
+ dnl Include the socket library, as it is a depedency of libuuid
+ dnl and so also of us (due to socket() call in libuuid)
+ OS_LIBS="$OS_LIBS -lnetwork"
+ ;;
+esac
AC_SUBST([OS_LIBS])
--
2.2.2
From 811bf6b4276df9d58407531c7615ebfd00858b26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 01:48:40 +0100
Subject: [PATCH 6/7] parted: replace deprecated CPPFunction by
rl_completion_func_t
---
parted/ui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/ui.c b/parted/ui.c
index 22790bb..5eafb2b 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1474,7 +1474,7 @@ init_readline (void)
#ifdef HAVE_LIBREADLINE
if (!opt_script_mode) {
rl_initialize ();
- rl_attempted_completion_function = (CPPFunction*) complete_function;
+ rl_attempted_completion_function = (rl_completion_func_t*) complete_function;
readline_state.in_readline = 0;
}
#endif
--
2.2.2
From a3cb2ab877064c01f8e6c67e59a44ab8455576a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Dec 2015 02:02:37 +0100
Subject: [PATCH 7/7] libparted: Haiku doesn't define __BEOS__ anymore
---
libparted/architecture.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/architecture.c b/libparted/architecture.c
index b339dc4..901399e 100644
--- a/libparted/architecture.c
+++ b/libparted/architecture.c
@@ -31,7 +31,7 @@ ped_set_architecture ()
#ifdef linux
extern PedArchitecture ped_linux_arch;
const PedArchitecture* arch = &ped_linux_arch;
-#elif defined(__BEOS__)
+#elif defined(__BEOS__) || defined(__HAIKU__)
extern PedArchitecture ped_beos_arch;
const PedArchitecture* arch = &ped_beos_arch;
#else
--
2.2.2