[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] part type interface
From: |
Neal H Walfield |
Subject: |
Re: [PATCH] part type interface |
Date: |
Sun, 07 Oct 2001 21:38:12 +0200 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7 |
>> The correct solution, would appear to be to return EINVAL if libparted
>> is not available. This patch does that:
>
> I think this is almost right... but the error shouldn't be EINVAL. A
> user shouldn't get EINVAL just because he requests a feature that
> isn't installed. Perhaps EOPNOTSUPP?
Of course; please excuse the brain fart. This should be a bit better:
2001-10-07 Neal H Walfield <neal@cs.uml.edu>
* Makefile: Always build parted.o, parted_p.o and
parted_pic.o.
* part.c [! HAVE_LIBPARTED]: Do not include <parted/parted.h>
or <parted/device_gnu.h>.
(store_part_create) [! HAVE_LIBPARTED]: Fail returning EOPNOTSUPP.
(store_part_open) [! HAVE_LIBPARTED]: Likewise.
* std.c (store_std_classes): Always include store_part_class.
Index: Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/libstore/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- Makefile 2001/10/01 01:04:57 1.22
+++ Makefile 2001/10/07 18:48:47
@@ -40,20 +40,16 @@ CPPFLAGS += -I$(srcdir)/../exec
include ../Makeconf
-ifeq (,$(strip $(PARTED_LIBS)))
-# Configure didn't find the Parted libraries, so we have no "part" store type.
+ifneq (,$(strip $(PARTED_LIBS)))
-parted.o parted_p.o parted_pic.o:
- $(CC) -o $@ -c -x c /dev/null
-
-else
-
# We have Parted, so link against it. For the static libraries,
# we slurp in all the Parted code we need and stuff it into one
# object file along with our code that uses it.
libstore.so-LDFLAGS += $(PARTED_LIBS)
+endif
+
parted.o: part.o $(..)config.make
$(CC) -nostdlib -r -o $@ $< $(PARTED_LIBS)
@@ -62,5 +58,3 @@ parted_p.o: part_p.o $(..)config.make
parted_pic.o: part_pic.o
ln -f $< $@
-
-endif
Index: part.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libstore/part.c,v
retrieving revision 1.2
diff -u -p -r1.2 part.c
--- part.c 2001/10/01 18:46:38 1.2
+++ part.c 2001/10/07 18:53:52
@@ -23,12 +23,15 @@
#include <errno.h>
#include <assert.h>
#include <cthreads.h>
-#include <hurd/store.h>
+#include <string.h>
+#include <error.h>
+#ifdef HAVE_LIBPARTED
#include <parted/parted.h>
#include <parted/device_gnu.h>
-#include <string.h>
-#include <error.h>
+#endif
+
+#include "store.h"
#define NEED_PARTED_VERSION "1.5.4"
@@ -38,6 +41,9 @@ error_t
store_part_create (struct store *source, int index, int flags,
struct store **store)
{
+#ifndef HAVE_LIBPARTED
+ return EOPNOTSUPP;
+#else
static struct mutex parted_lock = MUTEX_INITIALIZER;
static int version_check;
error_t err = 0;
@@ -153,6 +159,7 @@ out:
err = store_remap (source, &run, 1, store);
return err;
+#endif /* HAVE_LIBPARTED */
}
/* Open the part NAME. NAME consists of a partition number, a ':', a another
@@ -166,6 +173,9 @@ store_part_open (const char *name, int f
const struct store_class *const *classes,
struct store **store)
{
+#ifndef HAVE_LIBPARTED
+ return EOPNOTSUPP;
+#else
int part;
char *endp;
struct store *source;
@@ -188,6 +198,7 @@ store_part_open (const char *name, int f
}
return err;
+#endif /* HAVE_LIBPARTED */
}
const struct store_class
Index: libstore/std.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libstore/std.c,v
retrieving revision 1.8
diff -u -p -r1.8 std.c
--- libstore/std.c 2001/09/28 06:12:38 1.8
+++ libstore/std.c 2001/10/07 15:40:13
@@ -24,9 +24,7 @@ const struct store_class *const
store_std_classes[] =
{
&store_device_class,
-#if HAVE_PARTED_PARTED_H
&store_part_class,
-#endif
&store_file_class,
&store_zero_class,
&store_task_class,
- [PATCH] part type interface, Neal H Walfield, 2001/10/07
- Re: [PATCH] part type interface, Thomas Bushnell, BSG, 2001/10/07
- Re: [PATCH] part type interface,
Neal H Walfield <=
- Re: [PATCH] part type interface, Roland McGrath, 2001/10/07
- Re: [PATCH] part type interface, Thomas Bushnell, BSG, 2001/10/07
- Re: [PATCH] part type interface, Roland McGrath, 2001/10/07
- Re: [PATCH] part type interface, Thomas Bushnell, BSG, 2001/10/07
- Re: [PATCH] part type interface, Neal H Walfield, 2001/10/07
- Re: [PATCH] part type interface, Thomas Bushnell, BSG, 2001/10/07
- Re: [PATCH] part type interface, Neal H Walfield, 2001/10/07
- Re: [PATCH] part type interface, Thomas Bushnell, BSG, 2001/10/07
- Re: [PATCH] part type interface, Roland McGrath, 2001/10/07
- Re: [PATCH] part type interface, Roland McGrath, 2001/10/07