2
* bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project.
4
* Copyright (c) 2000-2004 Anton Altaparmakov
5
* Copyright (c) 2004-2005 Richard Russon
7
* This program/include file is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License as published
9
* by the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program/include file is distributed in the hope that it will be
13
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program (in the main directory of the Linux-NTFS
19
* distribution in the file COPYING); if not, write to the Free Software
20
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
#ifndef _NTFS_BITMAP_H
24
#define _NTFS_BITMAP_H
32
* - Operations are 8-bit only to ensure the functions work both on little
33
* and big endian machines! So don't make them 32-bit ops!
34
* - bitmap starts at bit = 0 and ends at bit = bitmap size - 1.
35
* - _Caller_ has to make sure that the bit to operate on is less than the
39
extern void ntfs_bit_set(u8 *bitmap, const u64 bit, const u8 new_value);
40
extern char ntfs_bit_get(const u8 *bitmap, const u64 bit);
41
extern char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, const u8 new_value);
42
extern int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count);
43
extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count);
46
* ntfs_bitmap_set_bit - set a bit in a bitmap
47
* @na: attribute containing the bitmap
50
* Set the @bit in the bitmap described by the attribute @na.
52
* On success return 0 and on error return -1 with errno set to the error code.
54
static __inline__ int ntfs_bitmap_set_bit(ntfs_attr *na, s64 bit)
56
return ntfs_bitmap_set_run(na, bit, 1);
60
* ntfs_bitmap_clear_bit - clear a bit in a bitmap
61
* @na: attribute containing the bitmap
64
* Clear @bit in the bitmap described by the attribute @na.
66
* On success return 0 and on error return -1 with errno set to the error code.
68
static __inline__ int ntfs_bitmap_clear_bit(ntfs_attr *na, s64 bit)
70
return ntfs_bitmap_clear_run(na, bit, 1);
73
#endif /* defined _NTFS_BITMAP_H */