~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to include/linux/netfilter/ipset/ip_set_bitmap.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __IP_SET_BITMAP_H
 
2
#define __IP_SET_BITMAP_H
 
3
 
 
4
/* Bitmap type specific error codes */
 
5
enum {
 
6
        /* The element is out of the range of the set */
 
7
        IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
 
8
        /* The range exceeds the size limit of the set type */
 
9
        IPSET_ERR_BITMAP_RANGE_SIZE,
 
10
};
 
11
 
 
12
#ifdef __KERNEL__
 
13
#define IPSET_BITMAP_MAX_RANGE  0x0000FFFF
 
14
 
 
15
/* Common functions */
 
16
 
 
17
static inline u32
 
18
range_to_mask(u32 from, u32 to, u8 *bits)
 
19
{
 
20
        u32 mask = 0xFFFFFFFE;
 
21
 
 
22
        *bits = 32;
 
23
        while (--(*bits) > 0 && mask && (to & mask) != from)
 
24
                mask <<= 1;
 
25
 
 
26
        return mask;
 
27
}
 
28
 
 
29
#endif /* __KERNEL__ */
 
30
 
 
31
#endif /* __IP_SET_BITMAP_H */