Whamcloud - gitweb
b=16777
[fs/lustre-release.git] / lustre / obdecho / echo.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/obdecho/echo.c
37  *
38  * Author: Peter Braam <braam@clusterfs.com>
39  * Author: Andreas Dilger <adilger@clusterfs.com>
40  */
41
42 #ifndef EXPORT_SYMTAB
43 # define EXPORT_SYMTAB
44 #endif
45
46 #define DEBUG_SUBSYSTEM S_ECHO
47
48 #include <obd_support.h>
49 #include <obd_class.h>
50 #include <obd_echo.h>
51 #include <lustre_debug.h>
52 #include <lustre_dlm.h>
53 #include <lprocfs_status.h>
54
55 #define ECHO_INIT_OBJID      0x1000000000000000ULL
56 #define ECHO_HANDLE_MAGIC    0xabcd0123fedc9876ULL
57
58 #define ECHO_PERSISTENT_PAGES (ECHO_PERSISTENT_SIZE >> CFS_PAGE_SHIFT)
59 static cfs_page_t *echo_persistent_pages[ECHO_PERSISTENT_PAGES];
60
61 enum {
62         LPROC_ECHO_READ_BYTES = 1,
63         LPROC_ECHO_WRITE_BYTES = 2,
64         LPROC_ECHO_LAST = LPROC_ECHO_WRITE_BYTES +1
65 };
66
67 static int echo_connect(const struct lu_env *env,
68                         struct lustre_handle *conn, struct obd_device *obd,
69                         struct obd_uuid *cluuid, struct obd_connect_data *data,
70                         void *localdata)
71 {
72         data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
73         return class_connect(conn, obd, cluuid);
74 }
75
76 static int echo_disconnect(struct obd_export *exp)
77 {
78         LASSERT (exp != NULL);
79
80         ldlm_cancel_locks_for_export(exp);
81
82         /* complete all outstanding replies */
83         spin_lock(&exp->exp_lock);
84         while (!list_empty(&exp->exp_outstanding_replies)) {
85                 struct ptlrpc_reply_state *rs =
86                         list_entry(exp->exp_outstanding_replies.next,
87                                    struct ptlrpc_reply_state, rs_exp_list);
88                 struct ptlrpc_service *svc = rs->rs_service;
89
90                 spin_lock(&svc->srv_lock);
91                 list_del_init(&rs->rs_exp_list);
92                 ptlrpc_schedule_difficult_reply(rs);
93                 spin_unlock(&svc->srv_lock);
94         }
95         spin_unlock(&exp->exp_lock);
96
97         return class_disconnect(exp);
98 }
99
100 static int echo_init_export(struct obd_export *exp)
101 {
102         return ldlm_init_export(exp);
103 }
104
105 static int echo_destroy_export(struct obd_export *exp)
106 {
107         ENTRY;
108
109         target_destroy_export(exp);
110         ldlm_destroy_export(exp);
111
112         RETURN(0);
113 }
114
115  static __u64 echo_next_id(struct obd_device *obddev)
116 {
117         obd_id id;
118
119         spin_lock(&obddev->u.echo.eo_lock);
120         id = ++obddev->u.echo.eo_lastino;
121         spin_unlock(&obddev->u.echo.eo_lock);
122
123         return id;
124 }
125
126 int echo_create(struct obd_export *exp, struct obdo *oa,
127                 struct lov_stripe_md **ea, struct obd_trans_info *oti)
128 {
129         struct obd_device *obd = class_exp2obd(exp);
130
131         if (!obd) {
132                 CERROR("invalid client cookie "LPX64"\n",
133                        exp->exp_handle.h_cookie);
134                 return -EINVAL;
135         }
136
137         if (!(oa->o_mode && S_IFMT)) {
138                 CERROR("echo obd: no type!\n");
139                 return -ENOENT;
140         }
141
142         if (!(oa->o_valid & OBD_MD_FLTYPE)) {
143                 CERROR("invalid o_valid "LPX64"\n", oa->o_valid);
144                 return -EINVAL;
145         }
146
147         oa->o_id = echo_next_id(obd);
148         oa->o_valid = OBD_MD_FLID;
149
150         return 0;
151 }
152
153 int echo_destroy(struct obd_export *exp, struct obdo *oa,
154                  struct lov_stripe_md *ea, struct obd_trans_info *oti,
155                  struct obd_export *md_exp)
156 {
157         struct obd_device *obd = class_exp2obd(exp);
158
159         ENTRY;
160         if (!obd) {
161                 CERROR("invalid client cookie "LPX64"\n",
162                        exp->exp_handle.h_cookie);
163                 RETURN(-EINVAL);
164         }
165
166         if (!(oa->o_valid & OBD_MD_FLID)) {
167                 CERROR("obdo missing FLID valid flag: "LPX64"\n", oa->o_valid);
168                 RETURN(-EINVAL);
169         }
170
171         if (oa->o_id > obd->u.echo.eo_lastino || oa->o_id < ECHO_INIT_OBJID) {
172                 CERROR("bad destroy objid: "LPX64"\n", oa->o_id);
173                 RETURN(-EINVAL);
174         }
175
176         RETURN(0);
177 }
178
179 static int echo_getattr(struct obd_export *exp, struct obd_info *oinfo)
180 {
181         struct obd_device *obd = class_exp2obd(exp);
182         obd_id id = oinfo->oi_oa->o_id;
183
184         ENTRY;
185         if (!obd) {
186                 CERROR("invalid client cookie "LPX64"\n",
187                        exp->exp_handle.h_cookie);
188                 RETURN(-EINVAL);
189         }
190
191         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
192                 CERROR("obdo missing FLID valid flag: "LPX64"\n",
193                        oinfo->oi_oa->o_valid);
194                 RETURN(-EINVAL);
195         }
196
197         obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
198         oinfo->oi_oa->o_id = id;
199
200         RETURN(0);
201 }
202
203 static int echo_setattr(struct obd_export *exp, struct obd_info *oinfo,
204                         struct obd_trans_info *oti)
205 {
206         struct obd_device *obd = class_exp2obd(exp);
207
208         ENTRY;
209         if (!obd) {
210                 CERROR("invalid client cookie "LPX64"\n",
211                        exp->exp_handle.h_cookie);
212                 RETURN(-EINVAL);
213         }
214
215         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
216                 CERROR("obdo missing FLID valid flag: "LPX64"\n",
217                        oinfo->oi_oa->o_valid);
218                 RETURN(-EINVAL);
219         }
220
221         memcpy(&obd->u.echo.eo_oa, oinfo->oi_oa, sizeof(*oinfo->oi_oa));
222
223         if (oinfo->oi_oa->o_id & 4) {
224                 /* Save lock to force ACKed reply */
225                 ldlm_lock_addref (&obd->u.echo.eo_nl_lock, LCK_NL);
226                 oti->oti_ack_locks[0].mode = LCK_NL;
227                 oti->oti_ack_locks[0].lock = obd->u.echo.eo_nl_lock;
228         }
229
230         RETURN(0);
231 }
232
233 static void
234 echo_page_debug_setup(cfs_page_t *page, int rw, obd_id id,
235                       __u64 offset, int len)
236 {
237         int   page_offset = offset & ~CFS_PAGE_MASK;
238         char *addr        = ((char *)cfs_kmap(page)) + page_offset;
239
240         if (len % OBD_ECHO_BLOCK_SIZE != 0)
241                 CERROR("Unexpected block size %d\n", len);
242
243         while (len > 0) {
244                 if (rw & OBD_BRW_READ)
245                         block_debug_setup(addr, OBD_ECHO_BLOCK_SIZE,
246                                           offset, id);
247                 else
248                         block_debug_setup(addr, OBD_ECHO_BLOCK_SIZE,
249                                           0xecc0ecc0ecc0ecc0ULL,
250                                           0xecc0ecc0ecc0ecc0ULL);
251
252                 addr   += OBD_ECHO_BLOCK_SIZE;
253                 offset += OBD_ECHO_BLOCK_SIZE;
254                 len    -= OBD_ECHO_BLOCK_SIZE;
255         }
256
257         cfs_kunmap(page);
258 }
259
260 static int
261 echo_page_debug_check(cfs_page_t *page, obd_id id,
262                       __u64 offset, int len)
263 {
264         int   page_offset = offset & ~CFS_PAGE_MASK;
265         char *addr        = ((char *)cfs_kmap(page)) + page_offset;
266         int   rc          = 0;
267         int   rc2;
268
269         if (len % OBD_ECHO_BLOCK_SIZE != 0)
270                 CERROR("Unexpected block size %d\n", len);
271
272         while (len > 0) {
273                 rc2 = block_debug_check("echo", addr, OBD_ECHO_BLOCK_SIZE,
274                                         offset, id);
275
276                 if (rc2 != 0 && rc == 0)
277                         rc = rc2;
278
279                 addr   += OBD_ECHO_BLOCK_SIZE;
280                 offset += OBD_ECHO_BLOCK_SIZE;
281                 len    -= OBD_ECHO_BLOCK_SIZE;
282         }
283
284         cfs_kunmap(page);
285
286         return (rc);
287 }
288
289 /* This allows us to verify that desc_private is passed unmolested */
290 #define DESC_PRIV 0x10293847
291
292 int echo_preprw(int cmd, struct obd_export *export, struct obdo *oa,
293                 int objcount, struct obd_ioobj *obj, int niocount,
294                 struct niobuf_remote *nb, struct niobuf_local *res,
295                 struct obd_trans_info *oti, struct lustre_capa *unused)
296 {
297         struct obd_device *obd;
298         struct niobuf_local *r = res;
299         int tot_bytes = 0;
300         int rc = 0;
301         int i;
302         ENTRY;
303
304         obd = export->exp_obd;
305         if (obd == NULL)
306                 RETURN(-EINVAL);
307
308         /* Temp fix to stop falling foul of osc_announce_cached() */
309         oa->o_valid &= ~(OBD_MD_FLBLOCKS | OBD_MD_FLGRANT);
310
311         memset(res, 0, sizeof(*res) * niocount);
312
313         CDEBUG(D_PAGE, "%s %d obdos with %d IOs\n",
314                cmd == OBD_BRW_READ ? "reading" : "writing", objcount, niocount);
315
316         if (oti)
317                 oti->oti_handle = (void *)DESC_PRIV;
318
319         for (i = 0; i < objcount; i++, obj++) {
320                 int gfp_mask = (obj->ioo_id & 1) ? CFS_ALLOC_HIGHUSER : CFS_ALLOC_STD;
321                 int ispersistent = obj->ioo_id == ECHO_PERSISTENT_OBJID;
322                 int debug_setup = (!ispersistent &&
323                                    (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
324                                    (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
325                 int j;
326
327                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, nb++, r++) {
328
329                         if (ispersistent &&
330                             (nb->offset >> CFS_PAGE_SHIFT) < ECHO_PERSISTENT_PAGES) {
331                                 r->page = echo_persistent_pages[nb->offset >>
332                                                                 CFS_PAGE_SHIFT];
333                                 /* Take extra ref so __free_pages() can be called OK */
334                                 cfs_get_page (r->page);
335                         } else {
336                                 OBD_PAGE_ALLOC(r->page, gfp_mask);
337                                 if (r->page == NULL) {
338                                         CERROR("can't get page %u/%u for id "
339                                                LPU64"\n",
340                                                j, obj->ioo_bufcnt, obj->ioo_id);
341                                         GOTO(preprw_cleanup, rc = -ENOMEM);
342                                 }
343                         }
344
345                         tot_bytes += nb->len;
346
347                         atomic_inc(&obd->u.echo.eo_prep);
348
349                         r->offset = nb->offset;
350                         r->len = nb->len;
351                         LASSERT((r->offset & ~CFS_PAGE_MASK) + r->len <= CFS_PAGE_SIZE);
352
353                         CDEBUG(D_PAGE, "$$$$ get page %p @ "LPU64" for %d\n",
354                                r->page, r->offset, r->len);
355
356                         if (cmd & OBD_BRW_READ)
357                                 r->rc = r->len;
358
359                         if (debug_setup)
360                                 echo_page_debug_setup(r->page, cmd, obj->ioo_id,
361                                                       r->offset, r->len);
362                 }
363         }
364         if (cmd & OBD_BRW_READ)
365                 lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_READ_BYTES,
366                                     tot_bytes);
367         else
368                 lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
369                                     tot_bytes);
370
371         CDEBUG(D_PAGE, "%d pages allocated after prep\n",
372                atomic_read(&obd->u.echo.eo_prep));
373
374         RETURN(0);
375
376 preprw_cleanup:
377         /* It is possible that we would rather handle errors by  allow
378          * any already-set-up pages to complete, rather than tearing them
379          * all down again.  I believe that this is what the in-kernel
380          * prep/commit operations do.
381          */
382         CERROR("cleaning up %ld pages (%d obdos)\n", (long)(r - res), objcount);
383         while (r-- > res) {
384                 cfs_kunmap(r->page);
385                 /* NB if this is a persistent page, __free_pages will just
386                  * lose the extra ref gained above */
387                 OBD_PAGE_FREE(r->page);
388                 atomic_dec(&obd->u.echo.eo_prep);
389         }
390         memset(res, 0, sizeof(*res) * niocount);
391
392         return rc;
393 }
394
395 int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa,
396                   int objcount, struct obd_ioobj *obj, int niocount,
397                   struct niobuf_local *res, struct obd_trans_info *oti, int rc)
398 {
399         struct obd_device *obd;
400         struct niobuf_local *r = res;
401         int i, vrc = 0;
402         ENTRY;
403
404         obd = export->exp_obd;
405         if (obd == NULL)
406                 RETURN(-EINVAL);
407
408         if (rc)
409                 GOTO(commitrw_cleanup, rc);
410
411         if ((cmd & OBD_BRW_RWMASK) == OBD_BRW_READ) {
412                 CDEBUG(D_PAGE, "reading %d obdos with %d IOs\n",
413                        objcount, niocount);
414         } else {
415                 CDEBUG(D_PAGE, "writing %d obdos with %d IOs\n",
416                        objcount, niocount);
417         }
418
419         if (niocount && !r) {
420                 CERROR("NULL res niobuf with niocount %d\n", niocount);
421                 RETURN(-EINVAL);
422         }
423
424         LASSERT(oti == NULL || oti->oti_handle == (void *)DESC_PRIV);
425
426         for (i = 0; i < objcount; i++, obj++) {
427                 int verify = (rc == 0 &&
428                               obj->ioo_id != ECHO_PERSISTENT_OBJID &&
429                               (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
430                               (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
431                 int j;
432
433                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, r++) {
434                         cfs_page_t *page = r->page;
435                         void *addr;
436
437                         if (page == NULL) {
438                                 CERROR("null page objid "LPU64":%p, buf %d/%d\n",
439                                        obj->ioo_id, page, j, obj->ioo_bufcnt);
440                                 GOTO(commitrw_cleanup, rc = -EFAULT);
441                         }
442
443                         addr = cfs_kmap(page);
444
445                         CDEBUG(D_PAGE, "$$$$ use page %p, addr %p@"LPU64"\n",
446                                r->page, addr, r->offset);
447
448                         if (verify) {
449                                 vrc = echo_page_debug_check(page, obj->ioo_id,
450                                                             r->offset, r->len);
451                                 /* check all the pages always */
452                                 if (vrc != 0 && rc == 0)
453                                         rc = vrc;
454                         }
455
456                         cfs_kunmap(page);
457                         /* NB see comment above regarding persistent pages */
458                         OBD_PAGE_FREE(page);
459                         atomic_dec(&obd->u.echo.eo_prep);
460                 }
461         }
462         CDEBUG(D_PAGE, "%d pages remain after commit\n",
463                atomic_read(&obd->u.echo.eo_prep));
464         RETURN(rc);
465
466 commitrw_cleanup:
467         CERROR("cleaning up %ld pages (%d obdos)\n",
468                niocount - (long)(r - res) - 1, objcount);
469         while (++r < res + niocount) {
470                 cfs_page_t *page = r->page;
471
472                 /* NB see comment above regarding persistent pages */
473                 OBD_PAGE_FREE(page);
474                 atomic_dec(&obd->u.echo.eo_prep);
475         }
476         return rc;
477 }
478
479 static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
480 {
481         struct lprocfs_static_vars lvars;
482         int                        rc;
483         int                        lock_flags = 0;
484         struct ldlm_res_id         res_id = {.name = {1}};
485         ENTRY;
486
487         spin_lock_init(&obd->u.echo.eo_lock);
488         obd->u.echo.eo_lastino = ECHO_INIT_OBJID;
489
490         obd->obd_namespace = ldlm_namespace_new(obd, "echo-tgt",
491                                                 LDLM_NAMESPACE_SERVER,
492                                                 LDLM_NAMESPACE_MODEST);
493         if (obd->obd_namespace == NULL) {
494                 LBUG();
495                 RETURN(-ENOMEM);
496         }
497
498         rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
499                                     NULL, LCK_NL, &lock_flags, NULL,
500                                     ldlm_completion_ast, NULL, NULL,
501                                     0, NULL, &obd->u.echo.eo_nl_lock);
502         LASSERT (rc == ELDLM_OK);
503
504         lprocfs_echo_init_vars(&lvars);
505         if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
506             lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
507                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
508                                      LPROCFS_CNTR_AVGMINMAX,
509                                      "read_bytes", "bytes");
510                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
511                                      LPROCFS_CNTR_AVGMINMAX,
512                                      "write_bytes", "bytes");
513         }
514
515         ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
516                             "echo_ldlm_cb_client", &obd->obd_ldlm_client);
517         RETURN(0);
518 }
519
520 static int echo_cleanup(struct obd_device *obd)
521 {
522         int leaked;
523         ENTRY;
524
525         lprocfs_obd_cleanup(obd);
526         lprocfs_free_obd_stats(obd);
527
528         ldlm_lock_decref (&obd->u.echo.eo_nl_lock, LCK_NL);
529
530         /* XXX Bug 3413; wait for a bit to ensure the BL callback has
531          * happened before calling ldlm_namespace_free() */
532         cfs_schedule_timeout (CFS_TASK_UNINT, cfs_time_seconds(1));
533
534         ldlm_namespace_free(obd->obd_namespace, NULL, obd->obd_force);
535         obd->obd_namespace = NULL;
536
537         leaked = atomic_read(&obd->u.echo.eo_prep);
538         if (leaked != 0)
539                 CERROR("%d prep/commitrw pages leaked\n", leaked);
540
541         RETURN(0);
542 }
543
544 static struct obd_ops echo_obd_ops = {
545         .o_owner           = THIS_MODULE,
546         .o_connect         = echo_connect,
547         .o_disconnect      = echo_disconnect,
548         .o_init_export     = echo_init_export,
549         .o_destroy_export  = echo_destroy_export,
550         .o_create          = echo_create,
551         .o_destroy         = echo_destroy,
552         .o_getattr         = echo_getattr,
553         .o_setattr         = echo_setattr,
554         .o_preprw          = echo_preprw,
555         .o_commitrw        = echo_commitrw,
556         .o_setup           = echo_setup,
557         .o_cleanup         = echo_cleanup
558 };
559
560 extern int echo_client_init(void);
561 extern void echo_client_exit(void);
562
563 static void
564 echo_persistent_pages_fini (void)
565 {
566         int     i;
567
568         for (i = 0; i < ECHO_PERSISTENT_PAGES; i++)
569                 if (echo_persistent_pages[i] != NULL) {
570                         OBD_PAGE_FREE(echo_persistent_pages[i]);
571                         echo_persistent_pages[i] = NULL;
572                 }
573 }
574
575 static int
576 echo_persistent_pages_init (void)
577 {
578         cfs_page_t *pg;
579         int          i;
580
581         for (i = 0; i < ECHO_PERSISTENT_PAGES; i++) {
582                 int gfp_mask = (i < ECHO_PERSISTENT_PAGES/2) ?
583                         CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER;
584
585                 OBD_PAGE_ALLOC(pg, gfp_mask);
586                 if (pg == NULL) {
587                         echo_persistent_pages_fini ();
588                         return (-ENOMEM);
589                 }
590
591                 memset (cfs_kmap (pg), 0, CFS_PAGE_SIZE);
592                 cfs_kunmap (pg);
593
594                 echo_persistent_pages[i] = pg;
595         }
596
597         return (0);
598 }
599
600 static int __init obdecho_init(void)
601 {
602         struct lprocfs_static_vars lvars;
603         int rc;
604
605         ENTRY;
606         LCONSOLE_INFO("Echo OBD driver; http://www.lustre.org/\n");
607
608         LASSERT(CFS_PAGE_SIZE % OBD_ECHO_BLOCK_SIZE == 0);
609
610         lprocfs_echo_init_vars(&lvars);
611
612         rc = echo_persistent_pages_init ();
613         if (rc != 0)
614                 goto failed_0;
615
616         rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
617                                  LUSTRE_ECHO_NAME, NULL);
618         if (rc != 0)
619                 goto failed_1;
620
621         rc = echo_client_init();
622         if (rc == 0)
623                 RETURN (0);
624
625         class_unregister_type(LUSTRE_ECHO_NAME);
626  failed_1:
627         echo_persistent_pages_fini ();
628  failed_0:
629         RETURN(rc);
630 }
631
632 static void /*__exit*/ obdecho_exit(void)
633 {
634         echo_client_exit();
635         class_unregister_type(LUSTRE_ECHO_NAME);
636         echo_persistent_pages_fini ();
637 }
638
639 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
640 MODULE_DESCRIPTION("Lustre Testing Echo OBD driver");
641 MODULE_LICENSE("GPL");
642
643 cfs_module(obdecho, "1.0.0", obdecho_init, obdecho_exit);