[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Otavio Salvador otavio at alioth.debian.org
Sun Jul 19 15:50:14 UTC 2009


 configure.ac                 |    1 +
 libparted/Makefile.am        |   10 +++++++++-
 libparted/arch/linux.c       |   19 +------------------
 libparted/arch/linux.h       |   39 +++++++++++++++++++++++++++++++++++++++
 libparted/labels/Makefile.am |    4 ++--
 libparted/labels/dasd.c      |    4 ++--
 libparted/labels/fdasd.c     |    2 +-
 7 files changed, 55 insertions(+), 24 deletions(-)

New commits:
commit 6b96e557531db279d30cd3d592f3ce46eba24b5b
Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Sun Jul 19 09:03:59 2009 -0300

    Avoid compilation failure on s390
    
    To export LinuxSpecific stuff for labels, in this case fdasd, we now
    provide arch/linux.h. This aids in avoiding code duplication.
    
    * configure.ac: add BUILD_LINUX conditional.
    * libparted/Makefile.am: conditionally use linux.h.
    * libparted/arch/linux.c: move LinuxSpecific stuff to linux.h.
    * libparted/arch/linux.h: New file.
    * libparted/labels/Makefile.am: include from libparted as well.
    * libparted/labels/dasd.c: use arch/linux.h and use dev->path for
      error message.
    * libparted/labels/fdasd.c: include linux.h and drop an unused
      variable.

diff --git a/configure.ac b/configure.ac
index 36342d5..f2fd34e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -474,6 +474,7 @@ AC_CHECK_HEADER([execinfo.h], [
 ])
 
 AM_CONDITIONAL([COMPILE_FOR_S390], [test "$host_cpu" = s390 || test "$host_cpu" = s390x])
+AM_CONDITIONAL([BUILD_LINUX], [test "$OS" = linux])
 
 dnl check for "check", unit testing library/header
 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index c46cbd1..c58081e 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -9,6 +9,12 @@ else
 SUBDIRS_CHECK =
 endif
 
+if BUILD_LINUX
+ARCH_SOURCE = arch/$(OS).c arch/$(OS).h
+else
+ARCH_SOURCE = arch/$(OS).c
+endif
+
 SUBDIRS       = labels fs . $(SUBDIRS_CHECK)
 
 
@@ -30,9 +36,11 @@ libparted_la_SOURCES  = debug.c			\
 			cs/constraint.c		\
 			cs/natmath.c		\
 			arch/blkpg.h		\
-			arch/$(OS).c
+			$(ARCH_SOURCE)
+
 
 EXTRA_libparted_la_SOURCES    = arch/linux.c		\
+				arch/linux.h	\
 				arch/gnu.c \
 				arch/beos.c
 
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 66fdd37..8f220e0 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -18,6 +18,7 @@
 #define PROC_DEVICES_BUFSIZ 16384
 
 #include <config.h>
+#include <arch/linux.h>
 
 #include <parted/parted.h>
 #include <parted/debug.h>
@@ -75,24 +76,6 @@
 #define RW_MODE (O_RDWR)
 #endif
 
-#if defined(__s390__) || defined(__s390x__)
-#  include <parted/fdasd.h>
-#endif
-
-#define LINUX_SPECIFIC(dev)	((LinuxSpecific*) (dev)->arch_specific)
-
-typedef	struct _LinuxSpecific	LinuxSpecific;
-
-struct _LinuxSpecific {
-	int	fd;
-	char*	dmtype;         /**< device map target type */
-#if defined(__s390__) || defined(__s390x__)
-	unsigned int real_sector_size;
-	/* IBM internal dasd structure (i guess ;), required. */
-	struct fdasd_anchor *anchor;
-#endif
-};
-
 struct hd_geometry {
         unsigned char heads;
         unsigned char sectors;
diff --git a/libparted/arch/linux.h b/libparted/arch/linux.h
new file mode 100644
index 0000000..b0ec448
--- /dev/null
+++ b/libparted/arch/linux.h
@@ -0,0 +1,39 @@
+/* libparted - a library for manipulating disk partitions
+    Copyright (C) 2009 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/>.
+*/
+
+#ifndef PED_ARCH_LINUX_H_INCLUDED
+#define PED_ARCH_LINUX_H_INCLUDED
+
+#if defined(__s390__) || defined(__s390x__)
+#  include <parted/fdasd.h>
+#endif
+
+#define LINUX_SPECIFIC(dev)	((LinuxSpecific*) (dev)->arch_specific)
+
+typedef	struct _LinuxSpecific	LinuxSpecific;
+
+struct _LinuxSpecific {
+	int	fd;
+	char*	dmtype;         /**< device map target type */
+#if defined(__s390__) || defined(__s390x__)
+	unsigned int real_sector_size;
+	/* IBM internal dasd structure (i guess ;), required. */
+	struct fdasd_anchor *anchor;
+#endif
+};
+
+#endif /* PED_ARCH_LINUX_H_INCLUDED */
diff --git a/libparted/labels/Makefile.am b/libparted/labels/Makefile.am
index d4fe198..6bbe2bf 100644
--- a/libparted/labels/Makefile.am
+++ b/libparted/labels/Makefile.am
@@ -1,5 +1,5 @@
 # This file is part of GNU Parted
-# Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
 #
 # This file may be modified and/or distributed without restriction.
 
@@ -9,7 +9,7 @@ else
 S390_SRCS =
 endif
 
-partedincludedir      =	-I$(top_srcdir)/lib -I$(top_srcdir)/include
+partedincludedir      =	-I$(top_srcdir)/lib -I$(top_srcdir)/include -I$(top_srcdir)/libparted
 noinst_LTLIBRARIES    =	liblabels.la
 
 liblabels_la_SOURCES = \
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 3a0bb32..489f9ad 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -38,7 +38,7 @@
 
 #include <parted/vtoc.h>
 #include <parted/fdasd.h>
-#include <parted/linux.h>
+#include <arch/linux.h>
 
 #include <libintl.h>
 #if ENABLE_NLS
@@ -242,7 +242,7 @@ dasd_probe (const PedDevice *dev)
  error_cleanup:
 	fdasd_cleanup(&anchor);
 	ped_exception_throw(PED_EXCEPTION_ERROR,PED_EXCEPTION_IGNORE_CANCEL,
-			    "Error while probing device %s.", dev->name);
+			    "Error while probing device %s.", dev->path);
 
 	return 0;
 }
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 40ba8c9..0311bdc 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -17,6 +17,7 @@
  */
 
 #include <config.h>
+#include <arch/linux.h>
 #include <parted/vtoc.h>
 #include <parted/fdasd.h>
 
@@ -773,7 +774,6 @@ fdasd_get_geometry (fdasd_anchor_t *anc, int f)
 	PDEBUG
 	int blksize = 0;
 	dasd_information_t dasd_info;
-	char s[LINE_LENGTH];
 
 	if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
 		fdasd_error(anc, unable_to_ioctl,



More information about the Parted-commits mailing list