Put lwkt_serialize_array_{enter,try,exit}() into its own header file;
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 12 Apr 2009 06:25:07 +0000 (14:25 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 12 Apr 2009 07:57:35 +0000 (15:57 +0800)
name it sys/serialize2.h according to our convention.

sys/dev/netif/emx/if_emx.c
sys/sys/serialize.h
sys/sys/serialize2.h [new file with mode: 0644]

index ea2aaed..728b8e1 100644 (file)
@@ -80,6 +80,7 @@
 #include <sys/proc.h>
 #include <sys/rman.h>
 #include <sys/serialize.h>
+#include <sys/serialize2.h>
 #include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
index 073258c..b179de2 100644 (file)
 #ifndef _SYS_SERIALIZE_H_
 #define _SYS_SERIALIZE_H_
 
-#ifndef _KERNEL
-#error "kernel only header file"
-#endif
-
-#ifndef _SYS_PARAM_H_
-#include <sys/param.h>
-#endif
-
-#ifndef _SYS_SYSTM_H_
-#include <sys/systm.h>
-#endif
-
 #ifndef _MACHINE_STDINT_H_
 #include <machine/stdint.h>
 #endif
@@ -66,36 +54,4 @@ void lwkt_serialize_handler_enable(lwkt_serialize_t);
 void lwkt_serialize_handler_call(lwkt_serialize_t, void (*)(void *, void *), void *, void *);
 int lwkt_serialize_handler_try(lwkt_serialize_t, void (*)(void *, void *), void *, void *);
 
-static __inline void
-lwkt_serialize_array_enter(lwkt_serialize_t *_arr, int _arrcnt, int _s)
-{
-       KASSERT(_s < _arrcnt, ("nothing to be serialized\n"));
-       while (_s < _arrcnt)
-               lwkt_serialize_enter(_arr[_s++]);
-}
-
-static __inline int
-lwkt_serialize_array_try(lwkt_serialize_t *_arr, int _arrcnt, int _s)
-{
-       int _i;
-
-       KASSERT(_s < _arrcnt, ("nothing to be serialized\n"));
-       for (_i = _s; _i < _arrcnt; ++_i) {
-               if (!lwkt_serialize_try(_arr[_i])) {
-                       while (--_i >= _s)
-                               lwkt_serialize_exit(_arr[_i]);
-                       return 0;
-               }
-       }
-       return 1;
-}
-
-static __inline void
-lwkt_serialize_array_exit(lwkt_serialize_t *_arr, int _arrcnt, int _s)
-{
-       KASSERT(_arrcnt > _s, ("nothing to be deserialized\n"));
-       while (--_arrcnt >= _s)
-               lwkt_serialize_exit(_arr[_arrcnt]);
-}
-
 #endif /* !_SYS_SERIALIZE_H_ */
diff --git a/sys/sys/serialize2.h b/sys/sys/serialize2.h
new file mode 100644 (file)
index 0000000..fb839c9
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef _SYS_SERIALIZE2_H_
+#define _SYS_SERIALIZE2_H_
+
+#ifndef _KERNEL
+#error "kernel only header file"
+#endif
+
+#ifndef _SYS_PARAM_H_
+#include <sys/param.h>
+#endif
+
+#ifndef _SYS_SYSTM_H_
+#include <sys/systm.h>
+#endif
+
+#ifndef _SYS_SERIALIZE_H_
+#include <sys/serialize.h>
+#endif
+
+static __inline void
+lwkt_serialize_array_enter(lwkt_serialize_t *_arr, int _arrcnt, int _s)
+{
+       KASSERT(_s < _arrcnt, ("nothing to be serialized\n"));
+       while (_s < _arrcnt)
+               lwkt_serialize_enter(_arr[_s++]);
+}
+
+static __inline int
+lwkt_serialize_array_try(lwkt_serialize_t *_arr, int _arrcnt, int _s)
+{
+       int _i;
+
+       KASSERT(_s < _arrcnt, ("nothing to be serialized\n"));
+       for (_i = _s; _i < _arrcnt; ++_i) {
+               if (!lwkt_serialize_try(_arr[_i])) {
+                       while (--_i >= _s)
+                               lwkt_serialize_exit(_arr[_i]);
+                       return 0;
+               }
+       }
+       return 1;
+}
+
+static __inline void
+lwkt_serialize_array_exit(lwkt_serialize_t *_arr, int _arrcnt, int _s)
+{
+       KASSERT(_arrcnt > _s, ("nothing to be deserialized\n"));
+       while (--_arrcnt >= _s)
+               lwkt_serialize_exit(_arr[_arrcnt]);
+}
+
+#endif /* !_SYS_SERIALIZE2_H_ */