mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
ext2_inode_cnv.c:
Included <sys/vnode.h> and its prerequisite <sys/proc.h>, and cleaned up includes. The vop_t changes made the non-inclusion of vnode.h fatal instead of just sloppy. i386_bitops.h: Changed `extern inline' to `static inline'. `extern inline' is a Linuxism that stops things from compiling without -O. Fixed idempotency identifier. Misc: Added prototypes. Staticized some functions so that prototypes are unnecessary. Added casts. Cleaned up includes.
This commit is contained in:
parent
f57e65478d
commit
b9286a3a0b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12159
@ -107,6 +107,7 @@ int ext2_new_block __P ((struct mount * mp, unsigned long goal,
|
||||
long * prealloc_count,
|
||||
long * prealloc_block));
|
||||
ino_t ext2_new_inode __P ((const struct inode * dir, int mode));
|
||||
unsigned long ext2_count_free __P((struct buf *map, unsigned int numchars));
|
||||
void ext2_free_blocks (struct mount * mp, unsigned long block,
|
||||
unsigned long count);
|
||||
void ext2_free_inode (struct inode * inode);
|
||||
|
@ -24,10 +24,12 @@
|
||||
/*
|
||||
* routines to convert on disk ext2 inodes in dinodes and back
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
|
||||
|
@ -47,8 +47,6 @@
|
||||
#error Provide an bitops.h file, please !
|
||||
#endif
|
||||
|
||||
unsigned long ext2_count_free __P((struct buffer_head *, unsigned int));
|
||||
|
||||
#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
|
||||
|
||||
/* got rid of get_group_desc since it can already be found in
|
||||
@ -450,7 +448,7 @@ got_block:
|
||||
return j;
|
||||
}
|
||||
|
||||
unsigned long ext2_count_free_blocks (struct mount * mp)
|
||||
static unsigned long ext2_count_free_blocks (struct mount * mp)
|
||||
{
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
#ifdef EXT2FS_DEBUG
|
||||
@ -493,7 +491,7 @@ static inline int block_in_use (unsigned long block,
|
||||
EXT2_BLOCKS_PER_GROUP(sb), map);
|
||||
}
|
||||
|
||||
void ext2_check_blocks_bitmap (struct mount * mp)
|
||||
static void ext2_check_blocks_bitmap (struct mount * mp)
|
||||
{
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
struct buffer_head * bh;
|
||||
@ -578,4 +576,3 @@ unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars)
|
||||
nibblemap[(map->b_data[i] >> 4) & 0xf];
|
||||
return (sum);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <gnu/ext2fs/ext2_extern.h>
|
||||
#include <gnu/ext2fs/ext2_fs.h>
|
||||
#include <gnu/ext2fs/ext2_fs_sb.h>
|
||||
#include <gnu/ext2fs/fs.h>
|
||||
@ -448,7 +449,7 @@ repeat:
|
||||
return j;
|
||||
}
|
||||
|
||||
unsigned long ext2_count_free_inodes (struct mount * mp)
|
||||
static unsigned long ext2_count_free_inodes (struct mount * mp)
|
||||
{
|
||||
#ifdef EXT2FS_DEBUG
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
@ -517,4 +518,3 @@ void ext2_check_inodes_bitmap (struct mount * mp)
|
||||
unlock_super (sb);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/file.h>
|
||||
@ -56,7 +57,6 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
@ -77,6 +77,12 @@
|
||||
|
||||
extern int dirchk;
|
||||
|
||||
static void ext2_dirconv2ffs __P((struct ext2_dir_entry *e2dir,
|
||||
struct dirent *ffsdir));
|
||||
static int ext2_dirbadentry __P((struct vnode *dp,
|
||||
struct ext2_dir_entry *de,
|
||||
int entryoffsetinblock));
|
||||
|
||||
/*
|
||||
* the problem that is tackled below is the fact that FFS
|
||||
* includes the terminating zero on disk while EXT2FS doesn't
|
||||
@ -186,7 +192,8 @@ printf("ext2_readdir called uio->uio_offset %d uio->uio_resid %d count %d \n",
|
||||
dp = (struct ext2_dir_entry *)
|
||||
((char *)dp + dp->rec_len);
|
||||
error =
|
||||
uiomove(&dstdp, dstdp.d_reclen, uio);
|
||||
uiomove((caddr_t)&dstdp,
|
||||
dstdp.d_reclen, uio);
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
@ -709,7 +716,7 @@ found:
|
||||
/*
|
||||
* changed so that it confirms to ext2_check_dir_entry
|
||||
*/
|
||||
int
|
||||
static int
|
||||
ext2_dirbadentry(dp, de, entryoffsetinblock)
|
||||
struct vnode *dp;
|
||||
register struct ext2_dir_entry *de;
|
||||
|
@ -103,6 +103,10 @@ extern u_long nextgennumber;
|
||||
*/
|
||||
#define ROOTNAME "root_device"
|
||||
|
||||
static int compute_sb_data __P((struct vnode * devvp,
|
||||
struct ext2_super_block * es,
|
||||
struct ext2_sb_info * fs));
|
||||
|
||||
int
|
||||
ext2_mountroot()
|
||||
{
|
||||
|
@ -4,8 +4,8 @@
|
||||
*
|
||||
* XXX replace with Mach routines or reprogram in C
|
||||
*/
|
||||
#ifndef _I386_BITOPS_H
|
||||
#define _I386_BITOPS_H
|
||||
#ifndef _SYS_GNU_EXT2FS_I386_BITOPS_H_
|
||||
#define _SYS_GNU_EXT2FS_I386_BITOPS_H_
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
@ -25,7 +25,7 @@
|
||||
struct __dummy { unsigned long a[100]; };
|
||||
#define ADDR (*(struct __dummy *) addr)
|
||||
|
||||
extern __inline__ int set_bit(int nr, void * addr)
|
||||
static __inline__ int set_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -35,7 +35,7 @@ extern __inline__ int set_bit(int nr, void * addr)
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int clear_bit(int nr, void * addr)
|
||||
static __inline__ int clear_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -45,7 +45,7 @@ extern __inline__ int clear_bit(int nr, void * addr)
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int change_bit(int nr, void * addr)
|
||||
static __inline__ int change_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -59,7 +59,7 @@ extern __inline__ int change_bit(int nr, void * addr)
|
||||
* This routine doesn't need to be atomic, but it's faster to code it
|
||||
* this way.
|
||||
*/
|
||||
extern __inline__ int test_bit(int nr, void * addr)
|
||||
static __inline__ int test_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -72,7 +72,7 @@ extern __inline__ int test_bit(int nr, void * addr)
|
||||
/*
|
||||
* Find-bit routines..
|
||||
*/
|
||||
extern inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
static inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
{
|
||||
int res;
|
||||
|
||||
@ -96,7 +96,7 @@ extern inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
return res;
|
||||
}
|
||||
|
||||
extern inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
static inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
{
|
||||
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
|
||||
int set = 0, bit = offset & 31, res;
|
||||
@ -128,7 +128,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
extern inline unsigned long ffz(unsigned long word)
|
||||
static inline unsigned long ffz(unsigned long word)
|
||||
{
|
||||
__asm__("bsfl %1,%0"
|
||||
:"=r" (word)
|
||||
@ -142,7 +142,7 @@ extern inline unsigned long ffz(unsigned long word)
|
||||
/*
|
||||
* find the first occurrence of byte 'c', or 1 past the area if none
|
||||
*/
|
||||
extern inline char * memscan(void * addr, unsigned char c, int size)
|
||||
static inline char * memscan(void * addr, unsigned char c, int size)
|
||||
{
|
||||
if (!size)
|
||||
return addr;
|
||||
@ -156,4 +156,4 @@ extern inline char * memscan(void * addr, unsigned char c, int size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
#endif /* _I386_BITOPS_H */
|
||||
#endif /* !_SYS_GNU_EXT2FS_I386_BITOPS_H_ */
|
||||
|
@ -107,6 +107,7 @@ int ext2_new_block __P ((struct mount * mp, unsigned long goal,
|
||||
long * prealloc_count,
|
||||
long * prealloc_block));
|
||||
ino_t ext2_new_inode __P ((const struct inode * dir, int mode));
|
||||
unsigned long ext2_count_free __P((struct buf *map, unsigned int numchars));
|
||||
void ext2_free_blocks (struct mount * mp, unsigned long block,
|
||||
unsigned long count);
|
||||
void ext2_free_inode (struct inode * inode);
|
||||
|
@ -24,10 +24,12 @@
|
||||
/*
|
||||
* routines to convert on disk ext2 inodes in dinodes and back
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
|
||||
|
@ -47,8 +47,6 @@
|
||||
#error Provide an bitops.h file, please !
|
||||
#endif
|
||||
|
||||
unsigned long ext2_count_free __P((struct buffer_head *, unsigned int));
|
||||
|
||||
#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
|
||||
|
||||
/* got rid of get_group_desc since it can already be found in
|
||||
@ -450,7 +448,7 @@ got_block:
|
||||
return j;
|
||||
}
|
||||
|
||||
unsigned long ext2_count_free_blocks (struct mount * mp)
|
||||
static unsigned long ext2_count_free_blocks (struct mount * mp)
|
||||
{
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
#ifdef EXT2FS_DEBUG
|
||||
@ -493,7 +491,7 @@ static inline int block_in_use (unsigned long block,
|
||||
EXT2_BLOCKS_PER_GROUP(sb), map);
|
||||
}
|
||||
|
||||
void ext2_check_blocks_bitmap (struct mount * mp)
|
||||
static void ext2_check_blocks_bitmap (struct mount * mp)
|
||||
{
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
struct buffer_head * bh;
|
||||
@ -578,4 +576,3 @@ unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars)
|
||||
nibblemap[(map->b_data[i] >> 4) & 0xf];
|
||||
return (sum);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <gnu/ext2fs/ext2_extern.h>
|
||||
#include <gnu/ext2fs/ext2_fs.h>
|
||||
#include <gnu/ext2fs/ext2_fs_sb.h>
|
||||
#include <gnu/ext2fs/fs.h>
|
||||
@ -448,7 +449,7 @@ repeat:
|
||||
return j;
|
||||
}
|
||||
|
||||
unsigned long ext2_count_free_inodes (struct mount * mp)
|
||||
static unsigned long ext2_count_free_inodes (struct mount * mp)
|
||||
{
|
||||
#ifdef EXT2FS_DEBUG
|
||||
struct ext2_sb_info *sb = VFSTOUFS(mp)->um_e2fs;
|
||||
@ -517,4 +518,3 @@ void ext2_check_inodes_bitmap (struct mount * mp)
|
||||
unlock_super (sb);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/file.h>
|
||||
@ -56,7 +57,6 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
@ -77,6 +77,12 @@
|
||||
|
||||
extern int dirchk;
|
||||
|
||||
static void ext2_dirconv2ffs __P((struct ext2_dir_entry *e2dir,
|
||||
struct dirent *ffsdir));
|
||||
static int ext2_dirbadentry __P((struct vnode *dp,
|
||||
struct ext2_dir_entry *de,
|
||||
int entryoffsetinblock));
|
||||
|
||||
/*
|
||||
* the problem that is tackled below is the fact that FFS
|
||||
* includes the terminating zero on disk while EXT2FS doesn't
|
||||
@ -186,7 +192,8 @@ printf("ext2_readdir called uio->uio_offset %d uio->uio_resid %d count %d \n",
|
||||
dp = (struct ext2_dir_entry *)
|
||||
((char *)dp + dp->rec_len);
|
||||
error =
|
||||
uiomove(&dstdp, dstdp.d_reclen, uio);
|
||||
uiomove((caddr_t)&dstdp,
|
||||
dstdp.d_reclen, uio);
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
@ -709,7 +716,7 @@ found:
|
||||
/*
|
||||
* changed so that it confirms to ext2_check_dir_entry
|
||||
*/
|
||||
int
|
||||
static int
|
||||
ext2_dirbadentry(dp, de, entryoffsetinblock)
|
||||
struct vnode *dp;
|
||||
register struct ext2_dir_entry *de;
|
||||
|
@ -103,6 +103,10 @@ extern u_long nextgennumber;
|
||||
*/
|
||||
#define ROOTNAME "root_device"
|
||||
|
||||
static int compute_sb_data __P((struct vnode * devvp,
|
||||
struct ext2_super_block * es,
|
||||
struct ext2_sb_info * fs));
|
||||
|
||||
int
|
||||
ext2_mountroot()
|
||||
{
|
||||
|
@ -4,8 +4,8 @@
|
||||
*
|
||||
* XXX replace with Mach routines or reprogram in C
|
||||
*/
|
||||
#ifndef _I386_BITOPS_H
|
||||
#define _I386_BITOPS_H
|
||||
#ifndef _SYS_GNU_EXT2FS_I386_BITOPS_H_
|
||||
#define _SYS_GNU_EXT2FS_I386_BITOPS_H_
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
@ -25,7 +25,7 @@
|
||||
struct __dummy { unsigned long a[100]; };
|
||||
#define ADDR (*(struct __dummy *) addr)
|
||||
|
||||
extern __inline__ int set_bit(int nr, void * addr)
|
||||
static __inline__ int set_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -35,7 +35,7 @@ extern __inline__ int set_bit(int nr, void * addr)
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int clear_bit(int nr, void * addr)
|
||||
static __inline__ int clear_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -45,7 +45,7 @@ extern __inline__ int clear_bit(int nr, void * addr)
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int change_bit(int nr, void * addr)
|
||||
static __inline__ int change_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -59,7 +59,7 @@ extern __inline__ int change_bit(int nr, void * addr)
|
||||
* This routine doesn't need to be atomic, but it's faster to code it
|
||||
* this way.
|
||||
*/
|
||||
extern __inline__ int test_bit(int nr, void * addr)
|
||||
static __inline__ int test_bit(int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
@ -72,7 +72,7 @@ extern __inline__ int test_bit(int nr, void * addr)
|
||||
/*
|
||||
* Find-bit routines..
|
||||
*/
|
||||
extern inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
static inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
{
|
||||
int res;
|
||||
|
||||
@ -96,7 +96,7 @@ extern inline int find_first_zero_bit(void * addr, unsigned size)
|
||||
return res;
|
||||
}
|
||||
|
||||
extern inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
static inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
{
|
||||
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
|
||||
int set = 0, bit = offset & 31, res;
|
||||
@ -128,7 +128,7 @@ extern inline int find_next_zero_bit (void * addr, int size, int offset)
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
extern inline unsigned long ffz(unsigned long word)
|
||||
static inline unsigned long ffz(unsigned long word)
|
||||
{
|
||||
__asm__("bsfl %1,%0"
|
||||
:"=r" (word)
|
||||
@ -142,7 +142,7 @@ extern inline unsigned long ffz(unsigned long word)
|
||||
/*
|
||||
* find the first occurrence of byte 'c', or 1 past the area if none
|
||||
*/
|
||||
extern inline char * memscan(void * addr, unsigned char c, int size)
|
||||
static inline char * memscan(void * addr, unsigned char c, int size)
|
||||
{
|
||||
if (!size)
|
||||
return addr;
|
||||
@ -156,4 +156,4 @@ extern inline char * memscan(void * addr, unsigned char c, int size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
#endif /* _I386_BITOPS_H */
|
||||
#endif /* !_SYS_GNU_EXT2FS_I386_BITOPS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user