The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/serialize2.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #ifndef _SYS_SERIALIZE2_H_
    2 #define _SYS_SERIALIZE2_H_
    3 
    4 #ifndef _KERNEL
    5 #error "kernel only header file"
    6 #endif
    7 
    8 #ifndef _SYS_PARAM_H_
    9 #include <sys/param.h>
   10 #endif
   11 
   12 #ifndef _SYS_SYSTM_H_
   13 #include <sys/systm.h>
   14 #endif
   15 
   16 #ifndef _SYS_SERIALIZE_H_
   17 #include <sys/serialize.h>
   18 #endif
   19 
   20 static __inline void
   21 lwkt_serialize_array_enter(lwkt_serialize_t *_arr, int _arrcnt, int _s)
   22 {
   23         KASSERT(_s < _arrcnt, ("nothing to be serialized"));
   24         while (_s < _arrcnt)
   25                 lwkt_serialize_enter(_arr[_s++]);
   26 }
   27 
   28 static __inline int
   29 lwkt_serialize_array_try(lwkt_serialize_t *_arr, int _arrcnt, int _s)
   30 {
   31         int _i;
   32 
   33         KASSERT(_s < _arrcnt, ("nothing to be serialized"));
   34         for (_i = _s; _i < _arrcnt; ++_i) {
   35                 if (!lwkt_serialize_try(_arr[_i])) {
   36                         while (--_i >= _s)
   37                                 lwkt_serialize_exit(_arr[_i]);
   38                         return 0;
   39                 }
   40         }
   41         return 1;
   42 }
   43 
   44 static __inline void
   45 lwkt_serialize_array_exit(lwkt_serialize_t *_arr, int _arrcnt, int _s)
   46 {
   47         KASSERT(_arrcnt > _s, ("nothing to be deserialized"));
   48         while (--_arrcnt >= _s)
   49                 lwkt_serialize_exit(_arr[_arrcnt]);
   50 }
   51 
   52 #endif  /* !_SYS_SERIALIZE2_H_ */

Cache object: 14ead512f38a7e433f4057d053f2a1d3


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.