• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * gen_bitmap.c --- Generic bitmap routines that used to be inlined.
3  *
4  * Copyright (C) 2001 Theodore Ts'o.
5  *
6  * %Begin-Header%
7  * This file may be redistributed under the terms of the GNU Public
8  * License.
9  * %End-Header%
10  */
11 
12 
13 #include <stdio.h>
14 #include <string.h>
15 #if HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 #include <fcntl.h>
19 #include <time.h>
20 #if HAVE_SYS_STAT_H
21 #include <sys/stat.h>
22 #endif
23 #if HAVE_SYS_TYPES_H
24 #include <sys/types.h>
25 #endif
26 
27 #include "ext2_fs.h"
28 #include "ext2fs.h"
29 
ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,__u32 bitno)30 int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
31 					 __u32 bitno)
32 {
33 	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
34 		ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
35 		return 0;
36 	}
37 	return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap);
38 }
39 
ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,blk_t bitno)40 int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
41 					   blk_t bitno)
42 {
43 	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
44 		ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
45 		return 0;
46 	}
47 	return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap);
48 }
49