From 493656dd3c6ca468fdf6fd908e49c1a6058e4d7f Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 11 Jan 2002 10:43:32 +0000 Subject: [PATCH] o label.c now compiles. --- lib/Makefile.in | 1 + lib/label/label.c | 32 ++++++++++++++++---------------- lib/label/label.h | 6 +++--- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lib/Makefile.in b/lib/Makefile.in index 1daa300b2..14039c89d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -34,6 +34,7 @@ SOURCES=\ format_text/flags.c \ format_text/format-text.c \ format_text/import.c \ + label/label.c \ log/log.c \ metadata/lv_manip.c \ metadata/merge.c \ diff --git a/lib/label/label.c b/lib/label/label.c index 0dbccc6e9..6a02038c7 100644 --- a/lib/label/label.c +++ b/lib/label/label.c @@ -40,7 +40,7 @@ static struct labeller_i *_alloc_li(const char *name, struct labeller *l) return li; } -static void _free_li(struct list *li) +static void _free_li(struct labeller_i *li) { dbg_free(li); } @@ -55,12 +55,12 @@ int label_init(void) void label_exit(void) { struct list *c, *n; - struct labeller_list *ll; + struct labeller_i *li; for (c = _labellers.n; c != &_labellers; c = n) { n = c->n; - ll = list_item(c, struct labeller_list); - _free_li(c); + li = list_item(c, struct labeller_i); + _free_li(li); } } @@ -91,55 +91,55 @@ struct labeller *label_get_handler(const char *name) return NULL; } -static struct labeller *_find_labeller(const char *device) +static struct labeller *_find_labeller(struct device *dev) { struct list *lih; struct labeller_i *li; list_iterate (lih, &_labellers) { li = list_item(lih, struct labeller_i); - if (li->l->ops->can_handle(device)) + if (li->l->ops->can_handle(li->l, dev)) return li->l; } - log_err("Could not find label on device '%s'.", device); + log_err("Could not find label on device '%s'.", dev_name(dev)); return NULL; } -int label_remove(const char *device) +int label_remove(struct device *dev) { struct labeller *l; - if (!(l = _find_labeller(device))) { + if (!(l = _find_labeller(dev))) { stack; return 0; } - return l->ops->remove(device); + return l->ops->remove(l, dev); } -int label_read(const char *path, struct label **result) +int label_read(struct device *dev, struct label **result) { struct labeller *l; - if (!(l = _find_labeller(device))) { + if (!(l = _find_labeller(dev))) { stack; return 0; } - return l->ops->read(device, label); + return l->ops->read(l, dev, result); } -int label_verify(const char *path) +int label_verify(struct device *dev) { struct labeller *l; - if (!(l = _find_labeller(device))) { + if (!(l = _find_labeller(dev))) { stack; return 0; } - return l->ops->verify(device); + return l->ops->verify(l, dev); } void label_free(struct label *l) diff --git a/lib/label/label.h b/lib/label/label.h index ea607b682..cc2452380 100644 --- a/lib/label/label.h +++ b/lib/label/label.h @@ -69,9 +69,9 @@ int label_register_handler(const char *name, struct labeller *handler); struct labeller *label_get_handler(const char *name); -int label_remove(const char *path); -int label_read(const char *path, struct label **result); -int label_verify(const char *path); +int label_remove(struct device *dev); +int label_read(struct device *dev, struct label **result); +int label_verify(struct device *dev); void label_free(struct label *l); /*