summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-14 21:09:39 +0000
committerRoland McGrath <roland@gnu.org>2002-03-14 21:09:39 +0000
commit443155698d67c86699ebf24a53900198ad084ea2 (patch)
tree57e7add9bb79ddc99a32bdc424a1781cb03bab6f /libstore
parent09b8c00be38115b1dfe151d1133d97518ea7f40a (diff)
2002-02-08 Roland McGrath <roland@frob.com>
* Makefile (store-types): New variable. (all): Depend on $(store-types:%=libstore_%.a). (libstore_%.so.$(hurd-version)): New pattern rule. ($(store-types:%=libstore_%.a): libstore_%.a): New static pattern rule to create `-lstore_TYPE' pseudo-objects (linker scripts) for each type. (libstore.so-LDLIBS): New variable, adds -ldl. (GUNZIP_OBJS, BUNZIP2_OBJS): New variables. (UNZIP_OBJS): Variable removed, replaced by those two. (OBJS): Update use. (libstore_gunzip.so.$(hurd-version)): Depend on PIC $(GUNZIP_OBJS). (libstore_bunzip2.so.$(hurd-version)): Depend on PIC $(BUNZIP2_OBJS). * unknown.c: Add STORE_STD_CLASS decl. * bunzip2.c: Likewise. * copy.c: Likewise. * device.c: Likewise. * file.c: Likewise. * gunzip.c: Likewise. * memobj.c: Likewise. * module.c: Likewise. * mvol.c: Likewise. * nbd.c: Likewise. * open.c: Likewise. * part.c: Likewise. * remap.c: Likewise. * stripe.c: Likewise. * stripe.c: Likewise. * task.c: Likewise. * typed.c: Likewise. * typed.c: Likewise. * unknown.c: Likewise. * url.c: Likewise. * zero.c: Likewise. 2002-01-19 Roland McGrath <roland@frob.com> * url.c (find_url_class): Function removed. (store_url_open): Use store_typed_open after validating syntax. (store_url_decode): Use store_find_class and store_module_find_class. * url.c (url_decode): Renamed to store_url_decode, made public. (store_url_open_class): Changed use. * store.h: Declare store_url_decode. * decode.c (store_decode): Call store_url_decode for STORAGE_NETWORK as a special case. 2001-12-28 Roland McGrath <roland@frob.com> * module.c: New file. * store.h (store_module_open, store_module_find_class, store_module_decode): Declare them. * argp.c (parse_opt): Leave PARSED->classes null here instead of defaulting to store_std_classes. (find_class): Default null class-list parameter to store_std_classes here instead. If no matches when defaulted, try calling store_module_open_class too. * typed.c (store_typed_open): If no match when search list is store_std_classes, try calling store_module_open_class too. * url.c (find_url_class): Likewise. * decode.c (store_decode): If no match when search list is store_std_classes, try calling store_module_decode too.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/url.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/libstore/url.c b/libstore/url.c
index 30f996e8..9b5f524e 100644
--- a/libstore/url.c
+++ b/libstore/url.c
@@ -1,6 +1,6 @@
/* Support for opening stores named in URL syntax.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001,02 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -22,22 +22,6 @@
#include <string.h>
#include <stdlib.h>
-static const struct store_class *
-find_url_class (const char *name, const struct store_class *const *classes)
-{
- const struct store_class *const *cl;
- const char *clname_end = strchr (name, ':');
-
- if (clname_end == name || clname_end == 0)
- return 0;
-
- for (cl = classes ?: store_std_classes; *cl; cl++)
- if (strlen ((*cl)->name) == (clname_end - name)
- && strncmp (name, (*cl)->name, (clname_end - name)) == 0)
- return *cl;
-
- return 0;
-}
/* Similar to store_typed_open, but NAME must be in URL format,
i.e. a class name followed by a ':' and any type-specific name.
@@ -49,21 +33,16 @@ store_url_open (const char *name, int flags,
const struct store_class *const *classes,
struct store **store)
{
- const struct store_class *cl = find_url_class (name, classes);
-
- if (cl == 0)
+ if (name == 0 || name[0] == ':' || strchr (name, ':') == 0)
return EINVAL;
- if (! cl->open)
- /* CL cannot be opened. */
- return EOPNOTSUPP;
-
- return (*cl->open) (name, flags, classes, store);
+ return store_typed_open (name, flags, classes, store);
}
-static error_t
-url_decode (struct store_enc *enc, const struct store_class *const *classes,
- struct store **store)
+error_t
+store_url_decode (struct store_enc *enc,
+ const struct store_class *const *classes,
+ struct store **store)
{
const struct store_class *cl;
@@ -83,7 +62,11 @@ url_decode (struct store_enc *enc, const struct store_class *const *classes,
return err;
/* Find the class matching this name. */
- cl = find_url_class (dummy.name, classes);
+ cl = store_find_class (dummy.name, strchr (dummy.name, ':'), classes);
+# pragma weak store_module_find_class
+ if (cl == 0 && store_module_find_class)
+ err = store_module_find_class (dummy.name, strchr (dummy.name, ':'),
+ &cl);
free (dummy.name);
free (dummy.misc);
@@ -104,5 +87,6 @@ const struct store_class store_url_open_class =
{
STORAGE_NETWORK, "url",
open: store_url_open,
- decode: url_decode
+ decode: store_url_decode
};
+STORE_STD_CLASS (url_open);