summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2011-12-14 17:55:56 +0000
committerEric Faurot <eric@cvs.openbsd.org>2011-12-14 17:55:56 +0000
commitd7dda3804ac2dd6cba6c9ec479c7f03a1b5cd1c8 (patch)
tree01d6d5fac761f535d5b621863b9b7f1a11f1d41c
parentd0e0f91eeb3ac2b35a0016b64cd7675c5d720a08 (diff)
make queue_fsqueue backend consistent with the backend scheme.
ok gilles@
-rw-r--r--usr.sbin/smtpd/queue_backend.c34
-rw-r--r--usr.sbin/smtpd/queue_fsqueue.c11
-rw-r--r--usr.sbin/smtpd/smtpd.h4
3 files changed, 20 insertions, 29 deletions
diff --git a/usr.sbin/smtpd/queue_backend.c b/usr.sbin/smtpd/queue_backend.c
index 94c6a4b4b59..7c5dd7e3ef0 100644
--- a/usr.sbin/smtpd/queue_backend.c
+++ b/usr.sbin/smtpd/queue_backend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_backend.c,v 1.14 2011/11/15 23:06:39 gilles Exp $ */
+/* $OpenBSD: queue_backend.c,v 1.15 2011/12/14 17:55:55 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -39,37 +39,21 @@
static int envelope_validate(struct envelope *);
/* fsqueue backend */
-int fsqueue_init(void);
-int fsqueue_message(enum queue_kind, enum queue_op, u_int32_t *);
-int fsqueue_envelope(enum queue_kind, enum queue_op , struct envelope *);
-void *fsqueue_qwalk_new(enum queue_kind, u_int32_t);
-int fsqueue_qwalk(void *, u_int64_t *);
-void fsqueue_qwalk_close(void *);
-
-
-struct queue_backend queue_backends[] = {
- { QT_FS,
- fsqueue_init,
- fsqueue_message,
- fsqueue_envelope,
- fsqueue_qwalk_new,
- fsqueue_qwalk,
- fsqueue_qwalk_close }
-};
+extern struct queue_backend queue_backend_fs;
+
struct queue_backend *
queue_backend_lookup(enum queue_type type)
{
- u_int8_t i;
-
- for (i = 0; i < nitems(queue_backends); ++i)
- if (queue_backends[i].type == type)
- break;
+ switch (type) {
+ case QT_FS:
+ return &queue_backend_fs;
- if (i == nitems(queue_backends))
+ default:
fatalx("invalid queue type");
+ }
- return &queue_backends[i];
+ return (NULL);
}
int
diff --git a/usr.sbin/smtpd/queue_fsqueue.c b/usr.sbin/smtpd/queue_fsqueue.c
index 3c95fd1e681..039dd71e794 100644
--- a/usr.sbin/smtpd/queue_fsqueue.c
+++ b/usr.sbin/smtpd/queue_fsqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fsqueue.c,v 1.21 2011/11/21 18:57:54 eric Exp $ */
+/* $OpenBSD: queue_fsqueue.c,v 1.22 2011/12/14 17:55:55 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -75,6 +75,15 @@ void fsqueue_qwalk_close(void *);
#define PATH_ENVELOPES "/envelopes"
+struct queue_backend queue_backend_fs = {
+ fsqueue_init,
+ fsqueue_message,
+ fsqueue_envelope,
+ fsqueue_qwalk_new,
+ fsqueue_qwalk,
+ fsqueue_qwalk_close
+};
+
static char *
fsqueue_getpath(enum queue_kind kind)
{
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index e3acfd5f470..5021a49130d 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.263 2011/12/13 23:55:00 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.264 2011/12/14 17:55:55 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -908,8 +908,6 @@ enum queue_op {
};
struct queue_backend {
- enum queue_type type;
-
int (*init)(void);
int (*message)(enum queue_kind, enum queue_op, u_int32_t *);
int (*envelope)(enum queue_kind, enum queue_op, struct envelope *);