aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs/ext2fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/ext2fs/ext2fs.h')
-rw-r--r--e2fsprogs/ext2fs/ext2fs.h166
1 files changed, 0 insertions, 166 deletions
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h
index 4bf5e5bba..bad2f9e58 100644
--- a/e2fsprogs/ext2fs/ext2fs.h
+++ b/e2fsprogs/ext2fs/ext2fs.h
@@ -962,172 +962,6 @@ extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
962extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, 962extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
963 struct ext2_inode *inode); 963 struct ext2_inode *inode);
964 964
965/*
966 * The actual inlined functions definitions themselves...
967 *
968 * If NO_INLINE_FUNCS is defined, then we won't try to do inline
969 * functions at all!
970 */
971#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
972#ifdef INCLUDE_INLINE_FUNCS
973#define _INLINE_ extern
974#else
975#ifdef __GNUC__
976#define _INLINE_ extern __inline__
977#else /* For Watcom C */
978#define _INLINE_ extern inline
979#endif
980#endif
981
982#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
983/*
984 * Allocate memory
985 */
986_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
987{
988 void **pp = (void **)ptr;
989
990 *pp = malloc(size);
991 if (!*pp)
992 return EXT2_ET_NO_MEMORY;
993 return 0;
994}
995
996/*
997 * Free memory
998 */
999_INLINE_ errcode_t ext2fs_free_mem(void *ptr)
1000{
1001 void **pp = (void **)ptr;
1002
1003 free(*pp);
1004 *pp = 0;
1005 return 0;
1006}
1007
1008/*
1009 * Resize memory
1010 */
1011_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
1012 unsigned long size, void *ptr)
1013{
1014 void *p;
1015 void **pp = (void **)ptr;
1016
1017 p = realloc(*pp, size);
1018 if (!p)
1019 return EXT2_ET_NO_MEMORY;
1020 *pp = p;
1021 return 0;
1022}
1023#endif /* Custom memory routines */
1024
1025/*
1026 * Mark a filesystem superblock as dirty
1027 */
1028_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
1029{
1030 fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
1031}
1032
1033/*
1034 * Mark a filesystem as changed
1035 */
1036_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
1037{
1038 fs->flags |= EXT2_FLAG_CHANGED;
1039}
1040
1041/*
1042 * Check to see if a filesystem has changed
1043 */
1044_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
1045{
1046 return (fs->flags & EXT2_FLAG_CHANGED);
1047}
1048
1049/*
1050 * Mark a filesystem as valid
1051 */
1052_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
1053{
1054 fs->flags |= EXT2_FLAG_VALID;
1055}
1056
1057/*
1058 * Mark a filesystem as NOT valid
1059 */
1060_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
1061{
1062 fs->flags &= ~EXT2_FLAG_VALID;
1063}
1064
1065/*
1066 * Check to see if a filesystem is valid
1067 */
1068_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
1069{
1070 return (fs->flags & EXT2_FLAG_VALID);
1071}
1072
1073/*
1074 * Mark the inode bitmap as dirty
1075 */
1076_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
1077{
1078 fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
1079}
1080
1081/*
1082 * Mark the block bitmap as dirty
1083 */
1084_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
1085{
1086 fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
1087}
1088
1089/*
1090 * Check to see if a filesystem's inode bitmap is dirty
1091 */
1092_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
1093{
1094 return (fs->flags & EXT2_FLAG_IB_DIRTY);
1095}
1096
1097/*
1098 * Check to see if a filesystem's block bitmap is dirty
1099 */
1100_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
1101{
1102 return (fs->flags & EXT2_FLAG_BB_DIRTY);
1103}
1104
1105/*
1106 * Return the group # of a block
1107 */
1108_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
1109{
1110 return (blk - fs->super->s_first_data_block) /
1111 fs->super->s_blocks_per_group;
1112}
1113
1114/*
1115 * Return the group # of an inode number
1116 */
1117_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
1118{
1119 return (ino - 1) / fs->super->s_inodes_per_group;
1120}
1121
1122_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
1123 struct ext2_inode *inode)
1124{
1125 return inode->i_blocks -
1126 (inode->i_file_acl ? fs->blocksize >> 9 : 0);
1127}
1128#undef _INLINE_
1129#endif
1130
1131#ifdef __cplusplus 965#ifdef __cplusplus
1132} 966}
1133#endif 967#endif