1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* ext2fs.h --- ext2fs
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
1997-04-29 20:17:09 +04:00
|
|
|
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
|
|
|
*
|
|
|
|
* %Begin-Header%
|
2010-05-18 05:31:56 +04:00
|
|
|
* This file may be redistributed under the terms of the GNU Library
|
|
|
|
* General Public License, version 2.
|
1997-04-29 20:17:09 +04:00
|
|
|
* %End-Header%
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
|
1998-02-17 01:00:37 +03:00
|
|
|
#ifndef _EXT2FS_EXT2FS_H
|
|
|
|
#define _EXT2FS_EXT2FS_H
|
|
|
|
|
2003-12-07 09:28:50 +03:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define EXT2FS_ATTR(x) __attribute__(x)
|
|
|
|
#else
|
|
|
|
#define EXT2FS_ATTR(x)
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 06:11:41 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
|
|
|
* Non-GNU C compilers won't necessarily understand inline
|
|
|
|
*/
|
1998-04-27 05:41:13 +04:00
|
|
|
#if (!defined(__GNUC__) && !defined(__WATCOMC__))
|
1997-04-29 20:17:09 +04:00
|
|
|
#define NO_INLINE_FUNCS
|
|
|
|
#endif
|
|
|
|
|
2011-06-11 19:04:42 +04:00
|
|
|
#ifndef _XOPEN_SOURCE
|
|
|
|
#define _XOPEN_SOURCE 600 /* for posix_memalign() */
|
|
|
|
#endif
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Where the master copy of the superblock is located, and how big
|
|
|
|
* superblocks are supposed to be. We define SUPERBLOCK_SIZE because
|
|
|
|
* the size of the superblock structure is not necessarily trustworthy
|
|
|
|
* (some versions have the padding set up so that the superblock is
|
|
|
|
* 1032 bytes long).
|
|
|
|
*/
|
|
|
|
#define SUPERBLOCK_OFFSET 1024
|
2011-06-11 19:04:42 +04:00
|
|
|
#define SUPERBLOCK_SIZE 1024
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
/*
|
|
|
|
* The last ext2fs revision level that this version of the library is
|
|
|
|
* able to support.
|
|
|
|
*/
|
2001-01-01 19:17:12 +03:00
|
|
|
#define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
|
1997-04-26 17:34:30 +04:00
|
|
|
|
1997-10-20 04:44:26 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
1997-04-29 18:53:37 +04:00
|
|
|
#include <sys/types.h>
|
1997-10-20 04:44:26 +04:00
|
|
|
#endif
|
|
|
|
|
2002-10-14 07:56:28 +04:00
|
|
|
#include <stdio.h>
|
Many files:
dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more paranoid
about validating the directory counts from the block group
information.
all files: Don't include stdlib.h anymore; include it in ext2_fs.h,
since that file requires stdlib.h
ChangeLog, Makefile.in, dirinfo.c:
dirinfo.c (e2fsck_add_dir_info): Use ext2fs_get_num_dirs instead of
e2fsck_get_num_dirs, which has been removed.
Makefile.in (PROGS): Remove @EXTRA_PROGS@, since we don't want to
compile and install flushb.
ChangeLog, configure.in:
Remove @EXTRA_PROGS@, since we aren't using it in 2fsck/Makefile.in anymore
ChangeLog, Makefile.in:
Install debugfs in /sbin, instead of /usr/sbin.
libext2fs.texinfo:
Update version string to be 1.12
Makefile.in:
Fix bug in find script which made the exclusion list, where a '-' was
missing from an -name option.
1997-12-01 21:24:10 +03:00
|
|
|
#include <stdlib.h>
|
2005-11-14 22:49:15 +03:00
|
|
|
#include <string.h>
|
2010-09-23 20:56:46 +04:00
|
|
|
#include <errno.h>
|
1998-02-01 16:23:02 +03:00
|
|
|
|
2011-06-11 19:04:42 +04:00
|
|
|
#ifndef __USE_XOPEN2K
|
|
|
|
/* If the "#define _XOPEN_SOURCE 600" didn't succeed in declaring
|
|
|
|
* posix_memalign(), maybe due to <features.h> or <stdlib.h> included beforej
|
|
|
|
* _XOPEN_SOURCE, declare it here to avoid compiler warnings. */
|
|
|
|
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
|
|
|
|
#endif
|
|
|
|
|
1998-02-01 16:23:02 +03:00
|
|
|
#if EXT2_FLAT_INCLUDES
|
|
|
|
#include "e2_types.h"
|
2002-10-14 07:56:28 +04:00
|
|
|
#include "ext2_fs.h"
|
2006-11-13 06:54:35 +03:00
|
|
|
#include "ext3_extents.h"
|
1998-02-01 16:23:02 +03:00
|
|
|
#else
|
2001-06-02 03:49:46 +04:00
|
|
|
#include <ext2fs/ext2_types.h>
|
2002-10-14 07:56:28 +04:00
|
|
|
#include <ext2fs/ext2_fs.h>
|
2006-11-13 06:54:35 +03:00
|
|
|
#include <ext2fs/ext3_extents.h>
|
2000-04-03 17:45:40 +04:00
|
|
|
#endif /* EXT2_FLAT_INCLUDES */
|
1997-04-26 17:58:21 +04:00
|
|
|
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
typedef __u32 ext2_ino_t;
|
1997-04-26 17:58:21 +04:00
|
|
|
typedef __u32 blk_t;
|
2007-10-14 19:23:20 +04:00
|
|
|
typedef __u64 blk64_t;
|
1998-09-03 05:22:57 +04:00
|
|
|
typedef __u32 dgrp_t;
|
1997-10-26 02:37:42 +04:00
|
|
|
typedef __u32 ext2_off_t;
|
2009-06-02 00:15:40 +04:00
|
|
|
typedef __u64 ext2_off64_t;
|
1998-06-11 00:39:43 +04:00
|
|
|
typedef __s64 e2_blkcnt_t;
|
2002-03-11 23:04:45 +03:00
|
|
|
typedef __u32 ext2_dirhash_t;
|
1997-04-26 17:21:57 +04:00
|
|
|
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
#if EXT2_FLAT_INCLUDES
|
|
|
|
#include "com_err.h"
|
|
|
|
#include "ext2_io.h"
|
|
|
|
#include "ext2_err.h"
|
2008-02-02 11:16:32 +03:00
|
|
|
#include "ext2_ext_attr.h"
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
#else
|
2001-05-21 06:54:21 +04:00
|
|
|
#include <et/com_err.h>
|
|
|
|
#include <ext2fs/ext2_io.h>
|
|
|
|
#include <ext2fs/ext2_err.h>
|
2008-02-02 11:16:32 +03:00
|
|
|
#include <ext2fs/ext2_ext_attr.h>
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1998-04-30 21:35:59 +04:00
|
|
|
/*
|
|
|
|
* Portability help for Microsoft Visual C++
|
|
|
|
*/
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define EXT2_QSORT_TYPE int __cdecl
|
|
|
|
#else
|
|
|
|
#define EXT2_QSORT_TYPE int
|
|
|
|
#endif
|
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
typedef struct struct_ext2_filsys *ext2_filsys;
|
|
|
|
|
1997-04-29 18:53:37 +04:00
|
|
|
#define EXT2FS_MARK_ERROR 0
|
|
|
|
#define EXT2FS_UNMARK_ERROR 1
|
|
|
|
#define EXT2FS_TEST_ERROR 2
|
1997-04-26 17:34:30 +04:00
|
|
|
|
1997-04-29 18:53:37 +04:00
|
|
|
typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
|
|
|
|
typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
|
|
|
|
typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
|
1997-04-26 17:34:30 +04:00
|
|
|
|
1997-04-26 18:48:50 +04:00
|
|
|
#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
|
2006-07-16 06:08:20 +04:00
|
|
|
|
1997-04-26 18:48:50 +04:00
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
2006-07-16 06:08:20 +04:00
|
|
|
* Badblocks list definitions
|
1997-04-29 20:17:09 +04:00
|
|
|
*/
|
|
|
|
|
2002-07-20 08:28:07 +04:00
|
|
|
typedef struct ext2_struct_u32_list *ext2_badblocks_list;
|
|
|
|
typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
|
|
|
|
|
|
|
|
typedef struct ext2_struct_u32_list *ext2_u32_list;
|
|
|
|
typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
|
1997-04-29 20:17:09 +04:00
|
|
|
|
|
|
|
/* old */
|
2002-07-20 08:28:07 +04:00
|
|
|
typedef struct ext2_struct_u32_list *badblocks_list;
|
|
|
|
typedef struct ext2_struct_u32_iterate *badblocks_iterate;
|
1997-04-29 20:17:09 +04:00
|
|
|
|
|
|
|
#define BADBLOCKS_FLAG_DIRTY 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ext2_dblist structure and abstractions (see dblist.c)
|
|
|
|
*/
|
2010-06-13 18:00:00 +04:00
|
|
|
struct ext2_db_entry2 {
|
|
|
|
ext2_ino_t ino;
|
|
|
|
blk64_t blk;
|
|
|
|
e2_blkcnt_t blockcnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Ye Olde 32-bit version */
|
1997-04-29 20:17:09 +04:00
|
|
|
struct ext2_db_entry {
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t ino;
|
1997-04-29 20:17:09 +04:00
|
|
|
blk_t blk;
|
|
|
|
int blockcnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ext2_struct_dblist *ext2_dblist;
|
|
|
|
|
|
|
|
#define DBLIST_ABORT 1
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
/*
|
|
|
|
* ext2_fileio definitions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define EXT2_FILE_WRITE 0x0001
|
|
|
|
#define EXT2_FILE_CREATE 0x0002
|
|
|
|
|
|
|
|
#define EXT2_FILE_MASK 0x00FF
|
|
|
|
|
|
|
|
#define EXT2_FILE_BUF_DIRTY 0x4000
|
|
|
|
#define EXT2_FILE_BUF_VALID 0x2000
|
|
|
|
|
|
|
|
typedef struct ext2_file *ext2_file_t;
|
|
|
|
|
|
|
|
#define EXT2_SEEK_SET 0
|
|
|
|
#define EXT2_SEEK_CUR 1
|
|
|
|
#define EXT2_SEEK_END 2
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
* Flags for the ext2_filsys structure and for ext2fs_open()
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
1997-04-29 20:17:09 +04:00
|
|
|
#define EXT2_FLAG_RW 0x01
|
|
|
|
#define EXT2_FLAG_CHANGED 0x02
|
|
|
|
#define EXT2_FLAG_DIRTY 0x04
|
|
|
|
#define EXT2_FLAG_VALID 0x08
|
|
|
|
#define EXT2_FLAG_IB_DIRTY 0x10
|
|
|
|
#define EXT2_FLAG_BB_DIRTY 0x20
|
1997-04-29 19:29:49 +04:00
|
|
|
#define EXT2_FLAG_SWAP_BYTES 0x40
|
|
|
|
#define EXT2_FLAG_SWAP_BYTES_READ 0x80
|
|
|
|
#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
|
|
|
|
#define EXT2_FLAG_MASTER_SB_ONLY 0x200
|
1997-04-29 20:17:09 +04:00
|
|
|
#define EXT2_FLAG_FORCE 0x400
|
2001-01-03 17:56:46 +03:00
|
|
|
#define EXT2_FLAG_SUPER_ONLY 0x800
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
#define EXT2_FLAG_JOURNAL_DEV_OK 0x1000
|
2001-05-03 08:02:29 +04:00
|
|
|
#define EXT2_FLAG_IMAGE_FILE 0x2000
|
2006-03-19 03:16:10 +03:00
|
|
|
#define EXT2_FLAG_EXCLUSIVE 0x4000
|
2006-11-13 07:26:46 +03:00
|
|
|
#define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000
|
2008-02-27 04:45:36 +03:00
|
|
|
#define EXT2_FLAG_NOFREE_ON_ERROR 0x10000
|
2009-08-22 21:27:40 +04:00
|
|
|
#define EXT2_FLAG_64BITS 0x20000
|
2009-08-24 03:20:03 +04:00
|
|
|
#define EXT2_FLAG_PRINT_PROGRESS 0x40000
|
2010-09-25 06:22:09 +04:00
|
|
|
#define EXT2_FLAG_DIRECT_IO 0x80000
|
2011-09-24 21:48:55 +04:00
|
|
|
#define EXT2_FLAG_SKIP_MMP 0x100000
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-04-26 18:48:50 +04:00
|
|
|
/*
|
|
|
|
* Special flag in the ext2 inode i_flag field that means that this is
|
|
|
|
* a new inode. (So that ext2_write_inode() can clear extra fields.)
|
|
|
|
*/
|
|
|
|
#define EXT2_NEW_INODE_FL 0x80000000
|
|
|
|
|
2000-12-09 17:39:16 +03:00
|
|
|
/*
|
|
|
|
* Flags for mkjournal
|
|
|
|
*/
|
2011-06-11 20:17:29 +04:00
|
|
|
#define EXT2_MKJOURNAL_V1_SUPER 0x0000001 /* create V1 superblock (deprecated) */
|
|
|
|
#define EXT2_MKJOURNAL_LAZYINIT 0x0000002 /* don't zero journal inode before use*/
|
2000-12-09 17:39:16 +03:00
|
|
|
|
2010-06-14 05:00:00 +04:00
|
|
|
struct opaque_ext2_group_desc;
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
struct struct_ext2_filsys {
|
1997-08-11 03:07:40 +04:00
|
|
|
errcode_t magic;
|
1997-04-26 17:21:57 +04:00
|
|
|
io_channel io;
|
|
|
|
int flags;
|
|
|
|
char * device_name;
|
|
|
|
struct ext2_super_block * super;
|
2003-12-07 09:28:50 +03:00
|
|
|
unsigned int blocksize;
|
2011-09-15 23:44:56 +04:00
|
|
|
int fragsize;
|
1998-09-03 05:22:57 +04:00
|
|
|
dgrp_t group_desc_count;
|
1997-04-26 17:21:57 +04:00
|
|
|
unsigned long desc_blocks;
|
2010-06-14 05:00:00 +04:00
|
|
|
struct opaque_ext2_group_desc * group_desc;
|
2011-07-07 21:50:22 +04:00
|
|
|
unsigned int inode_blocks_per_group;
|
1997-04-26 17:34:30 +04:00
|
|
|
ext2fs_inode_bitmap inode_map;
|
|
|
|
ext2fs_block_bitmap block_map;
|
2010-06-13 19:00:00 +04:00
|
|
|
/* XXX FIXME-64: not 64-bit safe, but not used? */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
|
|
|
|
errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
|
1997-04-26 17:21:57 +04:00
|
|
|
errcode_t (*write_bitmaps)(ext2_filsys fs);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
|
1997-04-29 18:53:37 +04:00
|
|
|
struct ext2_inode *inode);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
|
1997-04-29 18:53:37 +04:00
|
|
|
struct ext2_inode *inode);
|
2002-07-20 08:28:07 +04:00
|
|
|
ext2_badblocks_list badblocks;
|
1997-04-29 20:17:09 +04:00
|
|
|
ext2_dblist dblist;
|
1997-04-30 01:26:48 +04:00
|
|
|
__u32 stride; /* for mke2fs */
|
2000-10-27 00:24:43 +04:00
|
|
|
struct ext2_super_block * orig_super;
|
2001-05-03 08:02:29 +04:00
|
|
|
struct ext2_image_hdr * image_header;
|
2001-12-24 17:40:00 +03:00
|
|
|
__u32 umask;
|
2005-12-11 05:50:30 +03:00
|
|
|
time_t now;
|
2011-09-15 23:44:56 +04:00
|
|
|
int cluster_ratio_bits;
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
|
|
|
* Reserved for future expansion
|
|
|
|
*/
|
2011-09-15 23:44:56 +04:00
|
|
|
__u32 reserved[6];
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/*
|
1997-04-30 01:26:48 +04:00
|
|
|
* Reserved for the use of the calling application.
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void * priv_data;
|
1997-04-30 01:26:48 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Inode cache
|
|
|
|
*/
|
|
|
|
struct ext2_inode_cache *icache;
|
2004-07-29 05:11:48 +04:00
|
|
|
io_channel image_io;
|
2008-06-03 01:21:37 +04:00
|
|
|
|
2011-09-24 21:48:55 +04:00
|
|
|
/*
|
|
|
|
* Buffers for Multiple mount protection(MMP) block.
|
|
|
|
*/
|
|
|
|
void *mmp_buf;
|
|
|
|
void *mmp_cmp;
|
|
|
|
int mmp_fd;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Time at which e2fsck last updated the MMP block.
|
|
|
|
*/
|
|
|
|
long mmp_last_written;
|
|
|
|
|
2008-06-03 01:21:37 +04:00
|
|
|
/*
|
|
|
|
* More callback functions
|
|
|
|
*/
|
|
|
|
errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal,
|
|
|
|
blk64_t *ret);
|
|
|
|
void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse);
|
1997-04-26 17:21:57 +04:00
|
|
|
};
|
|
|
|
|
1998-02-01 16:23:02 +03:00
|
|
|
#if EXT2_FLAT_INCLUDES
|
|
|
|
#include "e2_bitops.h"
|
|
|
|
#else
|
2001-05-21 06:54:21 +04:00
|
|
|
#include <ext2fs/bitops.h>
|
1998-02-01 16:23:02 +03:00
|
|
|
#endif
|
1997-10-20 04:44:26 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Return flags for the block iterator functions
|
|
|
|
*/
|
|
|
|
#define BLOCK_CHANGED 1
|
|
|
|
#define BLOCK_ABORT 2
|
|
|
|
#define BLOCK_ERROR 4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Block interate flags
|
1997-04-26 17:58:21 +04:00
|
|
|
*
|
|
|
|
* BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
|
|
|
|
* function should be called on blocks where the block number is zero.
|
|
|
|
* This is used by ext2fs_expand_dir() to be able to add a new block
|
|
|
|
* to an inode. It can also be used for programs that want to be able
|
|
|
|
* to deal with files that contain "holes".
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
2006-03-18 16:26:36 +03:00
|
|
|
* BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for
|
|
|
|
* the indirect, doubly indirect, etc. blocks should be called after
|
|
|
|
* all of the blocks containined in the indirect blocks are processed.
|
1997-04-26 17:58:21 +04:00
|
|
|
* This is useful if you are going to be deallocating blocks from an
|
|
|
|
* inode.
|
1997-04-29 18:53:37 +04:00
|
|
|
*
|
|
|
|
* BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be
|
|
|
|
* called for data blocks only.
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
*
|
2008-08-28 07:07:54 +04:00
|
|
|
* BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not
|
2008-02-03 05:26:54 +03:00
|
|
|
* modify returned block number.
|
|
|
|
*
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
* BLOCK_FLAG_NO_LARGE is for internal use only. It informs
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
* ext2fs_block_iterate2 that large files won't be accepted.
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
#define BLOCK_FLAG_APPEND 1
|
1997-04-26 17:58:21 +04:00
|
|
|
#define BLOCK_FLAG_HOLE 1
|
1997-04-26 17:21:57 +04:00
|
|
|
#define BLOCK_FLAG_DEPTH_TRAVERSE 2
|
1997-04-29 18:53:37 +04:00
|
|
|
#define BLOCK_FLAG_DATA_ONLY 4
|
2008-02-03 05:26:54 +03:00
|
|
|
#define BLOCK_FLAG_READ_ONLY 8
|
1997-04-29 18:53:37 +04:00
|
|
|
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
#define BLOCK_FLAG_NO_LARGE 0x1000
|
|
|
|
|
1997-04-29 18:53:37 +04:00
|
|
|
/*
|
|
|
|
* Magic "block count" return values for the block iterator function.
|
|
|
|
*/
|
|
|
|
#define BLOCK_COUNT_IND (-1)
|
|
|
|
#define BLOCK_COUNT_DIND (-2)
|
|
|
|
#define BLOCK_COUNT_TIND (-3)
|
|
|
|
#define BLOCK_COUNT_TRANSLATOR (-4)
|
1997-04-26 17:21:57 +04:00
|
|
|
|
ChangeLog, Makefile.in, bmap.c, bmove.c, ext2fs.h, jump.funcs:
ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform with
32 bit longs, then we need to manually define __s64 and __u64, since
the current kernel header files don't define these if __STRICT_ANSI__
is defined. This is a problem if we are compiling with full GCC
warnings, since we do need 64 bit support.
Makefile.in (OBJS): Remove bmove.o from files to be built, since we're
not using ext2fs_move_blocks() and there is some question as to its
usefulness in its current form.
bmap.c (block_bmap): Remove unused function.
bmove.c (process_block): Fix -Wall warning.
ChangeLog, debugfs.c, debugfs.h, dump.c:
debugfs.h: Add declaration for do_dirty_filsys() to prevent -Wall
warnings.
debugfs.c (copy_file):
dump.c (dump_file): Fix -Wall warning caused by signed/unsigned mismatch.
1998-03-30 05:27:25 +04:00
|
|
|
#if 0
|
1997-06-09 18:51:29 +04:00
|
|
|
/*
|
|
|
|
* Flags for ext2fs_move_blocks
|
|
|
|
*/
|
2008-08-28 07:07:54 +04:00
|
|
|
#define EXT2_BMOVE_GET_DBLIST 0x0001
|
1997-06-14 11:25:40 +04:00
|
|
|
#define EXT2_BMOVE_DEBUG 0x0002
|
ChangeLog, Makefile.in, bmap.c, bmove.c, ext2fs.h, jump.funcs:
ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform with
32 bit longs, then we need to manually define __s64 and __u64, since
the current kernel header files don't define these if __STRICT_ANSI__
is defined. This is a problem if we are compiling with full GCC
warnings, since we do need 64 bit support.
Makefile.in (OBJS): Remove bmove.o from files to be built, since we're
not using ext2fs_move_blocks() and there is some question as to its
usefulness in its current form.
bmap.c (block_bmap): Remove unused function.
bmove.c (process_block): Fix -Wall warning.
ChangeLog, debugfs.c, debugfs.h, dump.c:
debugfs.h: Add declaration for do_dirty_filsys() to prevent -Wall
warnings.
debugfs.c (copy_file):
dump.c (dump_file): Fix -Wall warning caused by signed/unsigned mismatch.
1998-03-30 05:27:25 +04:00
|
|
|
#endif
|
1997-06-09 18:51:29 +04:00
|
|
|
|
2007-10-15 07:04:58 +04:00
|
|
|
/*
|
|
|
|
* Generic (non-filesystem layout specific) extents structure
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define EXT2_EXTENT_FLAGS_LEAF 0x0001
|
|
|
|
#define EXT2_EXTENT_FLAGS_UNINIT 0x0002
|
|
|
|
#define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004
|
|
|
|
|
|
|
|
struct ext2fs_extent {
|
|
|
|
blk64_t e_pblk; /* first physical block */
|
|
|
|
blk64_t e_lblk; /* first logical block extent covers */
|
|
|
|
__u32 e_len; /* number of blocks covered by extent */
|
|
|
|
__u32 e_flags; /* extent flags */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ext2_extent_handle *ext2_extent_handle_t;
|
|
|
|
typedef struct ext2_extent_path *ext2_extent_path_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags used by ext2fs_extent_get()
|
|
|
|
*/
|
|
|
|
#define EXT2_EXTENT_CURRENT 0x0000
|
|
|
|
#define EXT2_EXTENT_MOVE_MASK 0x000F
|
|
|
|
#define EXT2_EXTENT_ROOT 0x0001
|
|
|
|
#define EXT2_EXTENT_LAST_LEAF 0x0002
|
|
|
|
#define EXT2_EXTENT_FIRST_SIB 0x0003
|
|
|
|
#define EXT2_EXTENT_LAST_SIB 0x0004
|
|
|
|
#define EXT2_EXTENT_NEXT_SIB 0x0005
|
|
|
|
#define EXT2_EXTENT_PREV_SIB 0x0006
|
|
|
|
#define EXT2_EXTENT_NEXT_LEAF 0x0007
|
|
|
|
#define EXT2_EXTENT_PREV_LEAF 0x0008
|
|
|
|
#define EXT2_EXTENT_NEXT 0x0009
|
|
|
|
#define EXT2_EXTENT_PREV 0x000A
|
|
|
|
#define EXT2_EXTENT_UP 0x000B
|
|
|
|
#define EXT2_EXTENT_DOWN 0x000C
|
|
|
|
#define EXT2_EXTENT_DOWN_AND_LAST 0x000D
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags used by ext2fs_extent_insert()
|
|
|
|
*/
|
2008-05-20 19:15:27 +04:00
|
|
|
#define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */
|
|
|
|
#define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */
|
2007-10-15 07:04:58 +04:00
|
|
|
|
2008-05-21 01:13:41 +04:00
|
|
|
/*
|
|
|
|
* Flags used by ext2fs_extent_delete()
|
|
|
|
*/
|
|
|
|
#define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extnt gone */
|
|
|
|
|
2008-05-20 19:17:46 +04:00
|
|
|
/*
|
|
|
|
* Flags used by ext2fs_extent_set_bmap()
|
|
|
|
*/
|
|
|
|
#define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001
|
|
|
|
|
2007-10-15 07:04:58 +04:00
|
|
|
/*
|
|
|
|
* Data structure returned by ext2fs_extent_get_info()
|
|
|
|
*/
|
|
|
|
struct ext2_extent_info {
|
|
|
|
int curr_entry;
|
|
|
|
int curr_level;
|
|
|
|
int num_entries;
|
|
|
|
int max_entries;
|
|
|
|
int max_depth;
|
|
|
|
int bytes_avail;
|
|
|
|
blk64_t max_lblk;
|
|
|
|
blk64_t max_pblk;
|
|
|
|
__u32 max_len;
|
|
|
|
__u32 max_uninit_len;
|
|
|
|
};
|
|
|
|
|
2002-03-12 09:05:06 +03:00
|
|
|
/*
|
|
|
|
* Flags for directory block reading and writing functions
|
|
|
|
*/
|
|
|
|
#define EXT2_DIRBLOCK_V2_STRUCT 0x0001
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Return flags for the directory iterator functions
|
|
|
|
*/
|
|
|
|
#define DIRENT_CHANGED 1
|
|
|
|
#define DIRENT_ABORT 2
|
|
|
|
#define DIRENT_ERROR 3
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Directory iterator flags
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define DIRENT_FLAG_INCLUDE_EMPTY 1
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
#define DIRENT_FLAG_INCLUDE_REMOVED 2
|
1997-04-29 20:17:09 +04:00
|
|
|
|
|
|
|
#define DIRENT_DOT_FILE 1
|
|
|
|
#define DIRENT_DOT_DOT_FILE 2
|
|
|
|
#define DIRENT_OTHER_FILE 3
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
#define DIRENT_DELETED_FILE 4
|
1997-04-29 20:17:09 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Inode scan definitions
|
|
|
|
*/
|
1997-04-26 17:34:30 +04:00
|
|
|
typedef struct ext2_struct_inode_scan *ext2_inode_scan;
|
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
|
|
|
* ext2fs_scan flags
|
|
|
|
*/
|
|
|
|
#define EXT2_SF_CHK_BADBLOCKS 0x0001
|
|
|
|
#define EXT2_SF_BAD_INODE_BLK 0x0002
|
|
|
|
#define EXT2_SF_BAD_EXTRA_BYTES 0x0004
|
|
|
|
#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008
|
2006-05-09 04:17:26 +04:00
|
|
|
#define EXT2_SF_DO_LAZY 0x0010
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
/*
|
|
|
|
* ext2fs_check_if_mounted flags
|
|
|
|
*/
|
|
|
|
#define EXT2_MF_MOUNTED 1
|
|
|
|
#define EXT2_MF_ISROOT 2
|
1997-04-29 20:17:09 +04:00
|
|
|
#define EXT2_MF_READONLY 4
|
2001-12-24 23:20:22 +03:00
|
|
|
#define EXT2_MF_SWAP 8
|
2005-06-06 00:05:22 +04:00
|
|
|
#define EXT2_MF_BUSY 16
|
1997-04-26 17:58:21 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ext2/linux mode flags. We define them here so that we don't need
|
|
|
|
* to depend on the OS's sys/stat.h, since we may be compiling on a
|
|
|
|
* non-Linux system.
|
|
|
|
*/
|
|
|
|
#define LINUX_S_IFMT 00170000
|
|
|
|
#define LINUX_S_IFSOCK 0140000
|
|
|
|
#define LINUX_S_IFLNK 0120000
|
|
|
|
#define LINUX_S_IFREG 0100000
|
|
|
|
#define LINUX_S_IFBLK 0060000
|
|
|
|
#define LINUX_S_IFDIR 0040000
|
|
|
|
#define LINUX_S_IFCHR 0020000
|
|
|
|
#define LINUX_S_IFIFO 0010000
|
|
|
|
#define LINUX_S_ISUID 0004000
|
|
|
|
#define LINUX_S_ISGID 0002000
|
|
|
|
#define LINUX_S_ISVTX 0001000
|
|
|
|
|
1997-04-29 18:53:37 +04:00
|
|
|
#define LINUX_S_IRWXU 00700
|
|
|
|
#define LINUX_S_IRUSR 00400
|
|
|
|
#define LINUX_S_IWUSR 00200
|
|
|
|
#define LINUX_S_IXUSR 00100
|
|
|
|
|
|
|
|
#define LINUX_S_IRWXG 00070
|
|
|
|
#define LINUX_S_IRGRP 00040
|
|
|
|
#define LINUX_S_IWGRP 00020
|
|
|
|
#define LINUX_S_IXGRP 00010
|
|
|
|
|
|
|
|
#define LINUX_S_IRWXO 00007
|
|
|
|
#define LINUX_S_IROTH 00004
|
|
|
|
#define LINUX_S_IWOTH 00002
|
|
|
|
#define LINUX_S_IXOTH 00001
|
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
|
|
|
|
#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
|
|
|
|
#define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
|
|
|
|
#define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
|
|
|
|
#define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
|
|
|
|
#define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
|
|
|
|
#define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
|
|
|
|
|
2003-01-23 02:25:39 +03:00
|
|
|
/*
|
|
|
|
* ext2 size of an inode
|
|
|
|
*/
|
|
|
|
#define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32))
|
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
|
|
|
* ext2_icount_t abstraction
|
|
|
|
*/
|
|
|
|
#define EXT2_ICOUNT_OPT_INCREMENT 0x01
|
|
|
|
|
|
|
|
typedef struct ext2_icount *ext2_icount_t;
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
/*
|
|
|
|
* Flags for ext2fs_bmap
|
|
|
|
*/
|
2004-12-23 21:55:34 +03:00
|
|
|
#define BMAP_ALLOC 0x0001
|
|
|
|
#define BMAP_SET 0x0002
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2008-02-18 22:59:45 +03:00
|
|
|
/*
|
|
|
|
* Returned flags from ext2fs_bmap
|
|
|
|
*/
|
|
|
|
#define BMAP_RET_UNINIT 0x0001
|
|
|
|
|
ChangeLog, Makefile.in, e2image.h, ext2_err.et.in, ext2fs.h, imager.c:
imager.c (ext2fs_image_{inode,super,bitmap}_{read,write}, ext2_fs.h,
Makefile.in: New file that has routines that save ext2fs metadata to a
file.
ext2_err.et.in (EXT2_ET_MAGIC_E2IMAGE): New error code assigned.
e2image.h: New file which defines the file format for the ext2 image
file. (Saved copy of ext2 metadata to a file as a saving throw
against worst-case damage.)
ChangeLog, Makefile.in, e2image.c:
e2image.c, Makefile.in: New program which saves ext2 metadata to a
file for people who need a last-ditch saving throw.
2000-11-12 22:32:20 +03:00
|
|
|
/*
|
|
|
|
* Flags for imager.c functions
|
|
|
|
*/
|
|
|
|
#define IMAGER_FLAG_INODEMAP 1
|
|
|
|
#define IMAGER_FLAG_SPARSEWRITE 2
|
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
/*
|
|
|
|
* For checking structure magic numbers...
|
|
|
|
*/
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
#define EXT2_CHECK_MAGIC(struct, code) \
|
|
|
|
if ((struct)->magic != (code)) return (code)
|
1997-04-29 18:53:37 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-01-01 19:17:12 +03:00
|
|
|
* For ext2 compression support
|
1997-04-29 18:53:37 +04:00
|
|
|
*/
|
2007-08-30 19:33:40 +04:00
|
|
|
#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1)
|
2000-02-11 18:44:08 +03:00
|
|
|
#define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
|
|
|
|
|
1997-04-29 21:48:10 +04:00
|
|
|
/*
|
2001-01-13 04:29:05 +03:00
|
|
|
* Features supported by this version of the library
|
1997-04-29 21:48:10 +04:00
|
|
|
*/
|
1999-09-15 00:21:26 +04:00
|
|
|
#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
|
|
|
|
EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
|
2001-07-02 19:54:09 +04:00
|
|
|
EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
|
2004-12-15 22:39:16 +03:00
|
|
|
EXT2_FEATURE_COMPAT_RESIZE_INODE|\
|
2002-03-11 23:04:45 +03:00
|
|
|
EXT2_FEATURE_COMPAT_DIR_INDEX|\
|
2001-07-02 19:54:09 +04:00
|
|
|
EXT2_FEATURE_COMPAT_EXT_ATTR)
|
2000-12-31 16:39:17 +03:00
|
|
|
|
2000-02-11 18:44:08 +03:00
|
|
|
/* This #ifdef is temporary until compression is fully supported */
|
|
|
|
#ifdef ENABLE_COMPRESSION
|
2000-04-03 17:45:40 +04:00
|
|
|
#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
|
|
|
|
/* If the below warning bugs you, then have
|
|
|
|
`CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
|
|
|
|
environment at configure time. */
|
2001-01-06 01:23:22 +03:00
|
|
|
#warning "Compression support is experimental"
|
2000-04-03 17:45:40 +04:00
|
|
|
#endif
|
2000-02-11 18:44:08 +03:00
|
|
|
#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
|
2000-07-07 08:37:35 +04:00
|
|
|
EXT2_FEATURE_INCOMPAT_COMPRESSION|\
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
|
2002-10-20 08:38:57 +04:00
|
|
|
EXT2_FEATURE_INCOMPAT_META_BG|\
|
2007-08-14 08:32:57 +04:00
|
|
|
EXT3_FEATURE_INCOMPAT_RECOVER|\
|
2007-08-21 05:31:11 +04:00
|
|
|
EXT3_FEATURE_INCOMPAT_EXTENTS|\
|
2010-06-13 21:00:00 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_FLEX_BG|\
|
2011-09-24 21:48:55 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_MMP|\
|
2010-06-13 21:00:00 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_64BIT)
|
2000-02-11 18:44:08 +03:00
|
|
|
#else
|
2000-07-07 08:37:35 +04:00
|
|
|
#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
|
2002-10-20 08:38:57 +04:00
|
|
|
EXT2_FEATURE_INCOMPAT_META_BG|\
|
2007-08-14 08:32:57 +04:00
|
|
|
EXT3_FEATURE_INCOMPAT_RECOVER|\
|
2007-08-21 05:31:11 +04:00
|
|
|
EXT3_FEATURE_INCOMPAT_EXTENTS|\
|
2010-06-13 21:00:00 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_FLEX_BG|\
|
2011-09-24 21:48:55 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_MMP|\
|
2010-06-13 21:00:00 +04:00
|
|
|
EXT4_FEATURE_INCOMPAT_64BIT)
|
2000-02-11 18:44:08 +03:00
|
|
|
#endif
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
|
2008-04-09 19:39:11 +04:00
|
|
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
|
2008-02-02 11:25:03 +03:00
|
|
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
|
2007-10-22 06:03:25 +04:00
|
|
|
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
|
2008-07-10 18:49:59 +04:00
|
|
|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
|
2011-06-11 02:58:16 +04:00
|
|
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
|
2011-07-20 22:40:06 +04:00
|
|
|
EXT4_FEATURE_RO_COMPAT_BIGALLOC|\
|
|
|
|
EXT4_FEATURE_RO_COMPAT_QUOTA)
|
2006-11-13 07:26:46 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
|
|
|
|
* to ext2fs_openfs()
|
|
|
|
*/
|
2008-04-09 19:39:11 +04:00
|
|
|
#define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
|
2011-02-26 05:43:54 +03:00
|
|
|
#define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_BIGALLOC)
|
2006-11-13 07:26:46 +03:00
|
|
|
|
2011-06-04 18:20:47 +04:00
|
|
|
|
|
|
|
/* Translate a block number to a cluster number */
|
|
|
|
#define EXT2FS_CLUSTER_RATIO(fs) (1 << (fs)->cluster_ratio_bits)
|
|
|
|
#define EXT2FS_CLUSTER_MASK(fs) (EXT2FS_CLUSTER_RATIO(fs) - 1)
|
|
|
|
#define EXT2FS_B2C(fs, blk) ((blk) >> (fs)->cluster_ratio_bits)
|
|
|
|
/* Translate a cluster number to a block number */
|
|
|
|
#define EXT2FS_C2B(fs, cluster) ((cluster) << (fs)->cluster_ratio_bits)
|
|
|
|
/* Translate # of blks to # of clusters */
|
|
|
|
#define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \
|
|
|
|
(fs)->cluster_ratio_bits)
|
|
|
|
|
2011-09-24 20:59:31 +04:00
|
|
|
#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
|
2011-09-16 07:44:48 +04:00
|
|
|
typedef struct stat64 ext2fs_struct_stat;
|
|
|
|
#else
|
|
|
|
typedef struct stat ext2fs_struct_stat;
|
|
|
|
#endif
|
|
|
|
|
2011-09-24 18:50:42 +04:00
|
|
|
/*
|
|
|
|
* For ext2fs_close2() and ext2fs_flush2(), this flag allows you to
|
|
|
|
* avoid the fsync call.
|
|
|
|
*/
|
|
|
|
#define EXT2_FLAG_FLUSH_NO_SYNC 1
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* function prototypes
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* alloc.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
|
|
|
|
ext2fs_inode_bitmap map, ext2_ino_t *ret);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
|
1997-04-26 17:34:30 +04:00
|
|
|
ext2fs_block_bitmap map, blk_t *ret);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_new_block2(ext2_filsys fs, blk64_t goal,
|
|
|
|
ext2fs_block_bitmap map, blk64_t *ret);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
|
1997-04-26 17:34:30 +04:00
|
|
|
blk_t finish, int num,
|
|
|
|
ext2fs_block_bitmap map,
|
1997-04-26 17:21:57 +04:00
|
|
|
blk_t *ret);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start,
|
|
|
|
blk64_t finish, int num,
|
|
|
|
ext2fs_block_bitmap map,
|
|
|
|
blk64_t *ret);
|
1997-10-26 02:37:42 +04:00
|
|
|
extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
|
|
|
|
char *block_buf, blk_t *ret);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal,
|
|
|
|
char *block_buf, blk64_t *ret);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern void ext2fs_set_alloc_block_callback(ext2_filsys fs,
|
2008-06-03 01:21:37 +04:00
|
|
|
errcode_t (*func)(ext2_filsys fs,
|
|
|
|
blk64_t goal,
|
|
|
|
blk64_t *ret),
|
|
|
|
errcode_t (**old)(ext2_filsys fs,
|
|
|
|
blk64_t goal,
|
|
|
|
blk64_t *ret));
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2003-11-21 17:02:21 +03:00
|
|
|
/* alloc_sb.c */
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
|
2003-11-21 17:02:21 +03:00
|
|
|
dgrp_t group,
|
|
|
|
ext2fs_block_bitmap bmap);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs,
|
2008-06-03 01:21:37 +04:00
|
|
|
void (*func)(ext2_filsys fs,
|
|
|
|
blk64_t blk,
|
|
|
|
int inuse),
|
|
|
|
void (**old)(ext2_filsys fs,
|
|
|
|
blk64_t blk,
|
|
|
|
int inuse));
|
2003-11-21 17:02:21 +03:00
|
|
|
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
/* alloc_stats.c */
|
|
|
|
void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
|
2002-02-03 09:28:52 +03:00
|
|
|
void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
int inuse, int isdir);
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
|
2009-06-02 00:15:40 +04:00
|
|
|
void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse);
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
|
1997-06-09 18:51:29 +04:00
|
|
|
/* alloc_tables.c */
|
|
|
|
extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
|
1998-09-03 05:22:57 +04:00
|
|
|
extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
|
1997-06-09 18:51:29 +04:00
|
|
|
ext2fs_block_bitmap bmap);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* badblocks.c */
|
2002-07-20 08:28:07 +04:00
|
|
|
extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
|
|
|
|
extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
|
2003-12-07 09:28:50 +03:00
|
|
|
extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
|
2002-07-20 08:28:07 +04:00
|
|
|
extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
|
|
|
|
extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
|
|
|
|
ext2_u32_iterate *ret);
|
|
|
|
extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk);
|
|
|
|
extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter);
|
|
|
|
extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest);
|
|
|
|
extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2);
|
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret,
|
|
|
|
int size);
|
|
|
|
extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb,
|
|
|
|
blk_t blk);
|
|
|
|
extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb,
|
|
|
|
blk_t blk);
|
2003-06-25 01:34:02 +04:00
|
|
|
extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk);
|
|
|
|
extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk);
|
1997-04-29 20:17:09 +04:00
|
|
|
extern errcode_t
|
|
|
|
ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
|
|
|
|
ext2_badblocks_iterate *ret);
|
|
|
|
extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter,
|
|
|
|
blk_t *blk);
|
|
|
|
extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter);
|
1997-04-30 01:26:48 +04:00
|
|
|
extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
|
|
|
|
ext2_badblocks_list *dest);
|
2000-07-04 23:20:25 +04:00
|
|
|
extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1,
|
|
|
|
ext2_badblocks_list bb2);
|
2003-03-14 08:59:42 +03:00
|
|
|
extern int ext2fs_u32_list_count(ext2_u32_list bb);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
|
|
|
/* bb_compat */
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t badblocks_list_create(badblocks_list *ret, int size);
|
|
|
|
extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk);
|
|
|
|
extern int badblocks_list_test(badblocks_list bb, blk_t blk);
|
|
|
|
extern errcode_t badblocks_list_iterate_begin(badblocks_list bb,
|
|
|
|
badblocks_iterate *ret);
|
|
|
|
extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk);
|
|
|
|
extern void badblocks_list_iterate_end(badblocks_iterate iter);
|
1997-04-30 01:26:48 +04:00
|
|
|
extern void badblocks_list_free(badblocks_list bb);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* bb_inode.c */
|
|
|
|
extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs,
|
1997-04-29 20:17:09 +04:00
|
|
|
ext2_badblocks_list bb_list);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* bitmaps.c */
|
2007-07-23 06:59:50 +04:00
|
|
|
extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
|
|
|
|
extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
|
|
|
|
ext2fs_generic_bitmap *dest);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
|
|
|
|
extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
|
|
|
|
extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
|
|
|
|
extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
ext2fs_block_bitmap *ret);
|
2011-06-11 01:55:09 +04:00
|
|
|
extern errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
ext2fs_block_bitmap *ret);
|
|
|
|
extern int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
|
|
|
|
const char *descr,
|
|
|
|
ext2fs_inode_bitmap *ret);
|
|
|
|
extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t end, ext2_ino_t *oend);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
|
|
|
|
blk_t end, blk_t *oend);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_fudge_block_bitmap_end2(ext2fs_block_bitmap bitmap,
|
|
|
|
blk64_t end, blk64_t *oend);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
|
|
|
|
extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
|
|
|
|
extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
|
2007-07-23 07:42:14 +04:00
|
|
|
extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
|
|
|
|
ext2fs_inode_bitmap bmap);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_resize_inode_bitmap2(__u64 new_end,
|
|
|
|
__u64 new_real_end,
|
|
|
|
ext2fs_inode_bitmap bmap);
|
2007-07-23 07:42:14 +04:00
|
|
|
extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
|
|
|
|
ext2fs_block_bitmap bmap);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_resize_block_bitmap2(__u64 new_end,
|
|
|
|
__u64 new_real_end,
|
|
|
|
ext2fs_block_bitmap bmap);
|
2007-07-23 07:42:14 +04:00
|
|
|
extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
|
|
|
|
ext2fs_block_bitmap bm2);
|
|
|
|
extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
|
|
|
|
ext2fs_inode_bitmap bm2);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap,
|
|
|
|
ext2_ino_t start, unsigned int num,
|
|
|
|
void *in);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_set_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
|
|
|
|
__u64 start, size_t num,
|
|
|
|
void *in);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap,
|
|
|
|
ext2_ino_t start, unsigned int num,
|
|
|
|
void *out);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_get_inode_bitmap_range2(ext2fs_inode_bitmap bmap,
|
|
|
|
__u64 start, size_t num,
|
|
|
|
void *out);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap,
|
|
|
|
blk_t start, unsigned int num,
|
|
|
|
void *in);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_set_block_bitmap_range2(ext2fs_block_bitmap bmap,
|
|
|
|
blk64_t start, size_t num,
|
|
|
|
void *in);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap,
|
|
|
|
blk_t start, unsigned int num,
|
|
|
|
void *out);
|
2009-08-05 08:27:10 +04:00
|
|
|
extern errcode_t ext2fs_get_block_bitmap_range2(ext2fs_block_bitmap bmap,
|
|
|
|
blk64_t start, size_t num,
|
|
|
|
void *out);
|
2007-07-23 07:42:14 +04:00
|
|
|
|
2009-06-06 23:22:43 +04:00
|
|
|
/* blknum.c */
|
|
|
|
extern dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t);
|
|
|
|
extern blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group);
|
2011-09-16 17:21:53 +04:00
|
|
|
extern int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs,
|
|
|
|
struct ext2_inode *inode);
|
|
|
|
extern blk64_t ext2fs_inode_i_blocks(ext2_filsys fs,
|
|
|
|
struct ext2_inode *inode);
|
|
|
|
extern blk64_t ext2fs_blocks_count(struct ext2_super_block *super);
|
|
|
|
extern void ext2fs_blocks_count_set(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
extern void ext2fs_blocks_count_add(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
extern blk64_t ext2fs_r_blocks_count(struct ext2_super_block *super);
|
|
|
|
extern void ext2fs_r_blocks_count_set(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
extern void ext2fs_r_blocks_count_add(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
extern blk64_t ext2fs_free_blocks_count(struct ext2_super_block *super);
|
|
|
|
extern void ext2fs_free_blocks_count_set(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
extern void ext2fs_free_blocks_count_add(struct ext2_super_block *super,
|
|
|
|
blk64_t blk);
|
|
|
|
/* Block group descriptor accessor functions */
|
|
|
|
extern struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs,
|
2010-06-14 05:00:00 +04:00
|
|
|
struct opaque_ext2_group_desc *gdp,
|
2009-06-06 23:22:43 +04:00
|
|
|
dgrp_t group);
|
|
|
|
extern blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
|
|
|
|
blk64_t blk);
|
|
|
|
extern blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
|
|
|
|
blk64_t blk);
|
|
|
|
extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group,
|
|
|
|
blk64_t blk);
|
2009-09-08 05:13:59 +04:00
|
|
|
extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group,
|
2009-09-08 05:13:59 +04:00
|
|
|
__u32 n);
|
|
|
|
extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group,
|
2009-09-08 05:13:59 +04:00
|
|
|
__u32 n);
|
|
|
|
extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group,
|
2009-09-08 05:13:59 +04:00
|
|
|
__u32 n);
|
|
|
|
extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group,
|
2009-09-08 05:13:59 +04:00
|
|
|
__u32 n);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group);
|
libext2fs: clean up ext2fs_bg_flags_ interfaces
The ext2fs_bg_flag* functions were confusing.
Currently we have this:
void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);
(_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags)
and these, which can twiddle individual bits in bg_flags:
void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
A better interface, after the patch below, is just:
ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */
and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-26 04:41:32 +03:00
|
|
|
extern void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group);
|
2009-10-26 04:42:12 +03:00
|
|
|
extern int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
|
libext2fs: clean up ext2fs_bg_flags_ interfaces
The ext2fs_bg_flag* functions were confusing.
Currently we have this:
void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);
(_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags)
and these, which can twiddle individual bits in bg_flags:
void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
A better interface, after the patch below, is just:
ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */
and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-26 04:41:32 +03:00
|
|
|
extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
|
|
|
|
extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
|
2009-06-06 23:22:43 +04:00
|
|
|
extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum);
|
|
|
|
extern blk64_t ext2fs_file_acl_block(const struct ext2_inode *inode);
|
|
|
|
extern void ext2fs_file_acl_block_set(struct ext2_inode *inode, blk64_t blk);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* block.c */
|
|
|
|
extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t ino,
|
1997-04-26 17:21:57 +04:00
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
|
|
|
int blockcnt,
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
1997-04-29 20:17:09 +04:00
|
|
|
errcode_t ext2fs_block_iterate2(ext2_filsys fs,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t ino,
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
1998-06-11 00:39:43 +04:00
|
|
|
e2_blkcnt_t blockcnt,
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
blk_t ref_blk,
|
|
|
|
int ref_offset,
|
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
2009-06-02 00:15:40 +04:00
|
|
|
errcode_t ext2fs_block_iterate3(ext2_filsys fs,
|
|
|
|
ext2_ino_t ino,
|
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk64_t *blocknr,
|
|
|
|
e2_blkcnt_t blockcnt,
|
|
|
|
blk64_t ref_blk,
|
|
|
|
int ref_offset,
|
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
/* bmap.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
|
2008-08-28 07:07:54 +04:00
|
|
|
struct ext2_inode *inode,
|
1997-10-26 02:37:42 +04:00
|
|
|
char *block_buf, int bmap_flags,
|
|
|
|
blk_t block, blk_t *phys_blk);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino,
|
2008-02-18 22:59:45 +03:00
|
|
|
struct ext2_inode *inode,
|
|
|
|
char *block_buf, int bmap_flags, blk64_t block,
|
|
|
|
int *ret_flags, blk64_t *phys_blk);
|
1997-10-26 02:37:42 +04:00
|
|
|
|
ChangeLog, Makefile.in, bmap.c, bmove.c, ext2fs.h, jump.funcs:
ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform with
32 bit longs, then we need to manually define __s64 and __u64, since
the current kernel header files don't define these if __STRICT_ANSI__
is defined. This is a problem if we are compiling with full GCC
warnings, since we do need 64 bit support.
Makefile.in (OBJS): Remove bmove.o from files to be built, since we're
not using ext2fs_move_blocks() and there is some question as to its
usefulness in its current form.
bmap.c (block_bmap): Remove unused function.
bmove.c (process_block): Fix -Wall warning.
ChangeLog, debugfs.c, debugfs.h, dump.c:
debugfs.h: Add declaration for do_dirty_filsys() to prevent -Wall
warnings.
debugfs.c (copy_file):
dump.c (dump_file): Fix -Wall warning caused by signed/unsigned mismatch.
1998-03-30 05:27:25 +04:00
|
|
|
#if 0
|
1997-06-09 18:51:29 +04:00
|
|
|
/* bmove.c */
|
|
|
|
extern errcode_t ext2fs_move_blocks(ext2_filsys fs,
|
|
|
|
ext2fs_block_bitmap reserve,
|
1997-06-12 02:27:41 +04:00
|
|
|
ext2fs_block_bitmap alloc_map,
|
1997-06-09 18:51:29 +04:00
|
|
|
int flags);
|
ChangeLog, Makefile.in, bmap.c, bmove.c, ext2fs.h, jump.funcs:
ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform with
32 bit longs, then we need to manually define __s64 and __u64, since
the current kernel header files don't define these if __STRICT_ANSI__
is defined. This is a problem if we are compiling with full GCC
warnings, since we do need 64 bit support.
Makefile.in (OBJS): Remove bmove.o from files to be built, since we're
not using ext2fs_move_blocks() and there is some question as to its
usefulness in its current form.
bmap.c (block_bmap): Remove unused function.
bmove.c (process_block): Fix -Wall warning.
ChangeLog, debugfs.c, debugfs.h, dump.c:
debugfs.h: Add declaration for do_dirty_filsys() to prevent -Wall
warnings.
debugfs.c (copy_file):
dump.c (dump_file): Fix -Wall warning caused by signed/unsigned mismatch.
1998-03-30 05:27:25 +04:00
|
|
|
#endif
|
1997-06-09 18:51:29 +04:00
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
/* check_desc.c */
|
|
|
|
extern errcode_t ext2fs_check_desc(ext2_filsys fs);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* closefs.c */
|
|
|
|
extern errcode_t ext2fs_close(ext2_filsys fs);
|
2011-09-24 18:50:42 +04:00
|
|
|
extern errcode_t ext2fs_close2(ext2_filsys fs, int flags);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_flush(ext2_filsys fs);
|
2011-09-24 18:50:42 +04:00
|
|
|
extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags);
|
2004-12-16 02:06:52 +03:00
|
|
|
extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs,
|
|
|
|
dgrp_t group,
|
|
|
|
blk64_t *ret_super_blk,
|
|
|
|
blk64_t *ret_old_desc_blk,
|
|
|
|
blk64_t *ret_new_desc_blk,
|
|
|
|
blk_t *ret_used_blks);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
|
2003-11-21 17:02:21 +03:00
|
|
|
dgrp_t group,
|
|
|
|
blk_t *ret_super_blk,
|
|
|
|
blk_t *ret_old_desc_blk,
|
|
|
|
blk_t *ret_new_desc_blk,
|
|
|
|
int *ret_meta_bg);
|
2004-12-16 02:06:52 +03:00
|
|
|
extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2011-09-16 07:46:37 +04:00
|
|
|
/* crc32c.c */
|
2011-09-30 23:38:43 +04:00
|
|
|
extern __u32 ext2fs_crc32c_be(__u32 crc, unsigned char const *p, size_t len);
|
|
|
|
extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len);
|
2011-09-16 07:46:37 +04:00
|
|
|
|
2007-10-22 06:03:19 +04:00
|
|
|
/* csum.c */
|
|
|
|
extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group);
|
2008-03-31 18:50:19 +04:00
|
|
|
extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs);
|
2007-10-22 06:03:19 +04:00
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/* dblist.c */
|
|
|
|
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
|
1997-04-30 01:26:48 +04:00
|
|
|
extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
|
1997-04-30 01:26:48 +04:00
|
|
|
blk_t blk, int blockcnt);
|
2010-06-13 18:00:00 +04:00
|
|
|
extern errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
|
|
|
|
blk64_t blk, e2_blkcnt_t blockcnt);
|
2002-08-31 10:32:41 +04:00
|
|
|
extern void ext2fs_dblist_sort(ext2_dblist dblist,
|
|
|
|
EXT2_QSORT_TYPE (*sortfunc)(const void *,
|
|
|
|
const void *));
|
2010-06-13 18:00:00 +04:00
|
|
|
extern void ext2fs_dblist_sort2(ext2_dblist dblist,
|
|
|
|
EXT2_QSORT_TYPE (*sortfunc)(const void *,
|
|
|
|
const void *));
|
1997-04-30 01:26:48 +04:00
|
|
|
extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
|
|
|
|
int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
2010-06-13 18:00:00 +04:00
|
|
|
extern errcode_t ext2fs_dblist_iterate2(ext2_dblist dblist,
|
|
|
|
int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info,
|
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
|
1997-04-30 01:26:48 +04:00
|
|
|
blk_t blk, int blockcnt);
|
2010-06-13 18:00:00 +04:00
|
|
|
extern errcode_t ext2fs_set_dir_block2(ext2_dblist dblist, ext2_ino_t ino,
|
|
|
|
blk64_t blk, e2_blkcnt_t blockcnt);
|
1997-04-30 01:26:48 +04:00
|
|
|
extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
|
|
|
|
ext2_dblist *dest);
|
1997-06-17 07:55:00 +04:00
|
|
|
extern int ext2fs_dblist_count(ext2_dblist dblist);
|
2010-06-13 18:00:00 +04:00
|
|
|
extern blk64_t ext2fs_dblist_count2(ext2_dblist dblist);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist,
|
2008-03-13 07:34:16 +03:00
|
|
|
struct ext2_db_entry **entry);
|
2010-06-13 18:00:00 +04:00
|
|
|
extern errcode_t ext2fs_dblist_get_last2(ext2_dblist dblist,
|
|
|
|
struct ext2_db_entry2 **entry);
|
2008-03-13 07:34:16 +03:00
|
|
|
extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
|
|
|
/* dblist_dir.c */
|
|
|
|
extern errcode_t
|
|
|
|
ext2fs_dblist_dir_iterate(ext2_dblist dblist,
|
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
int (*func)(ext2_ino_t dir,
|
1997-04-29 20:17:09 +04:00
|
|
|
int entry,
|
|
|
|
struct ext2_dir_entry *dirent,
|
|
|
|
int offset,
|
|
|
|
int blocksize,
|
|
|
|
char *buf,
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
|
|
|
/* dirblock.c */
|
|
|
|
extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
|
|
|
|
void *buf);
|
2002-03-12 09:05:06 +03:00
|
|
|
extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
|
|
|
|
void *buf, int flags);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_read_dir_block3(ext2_filsys fs, blk64_t block,
|
|
|
|
void *buf, int flags);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
|
|
|
|
void *buf);
|
2002-03-12 09:05:06 +03:00
|
|
|
extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
|
|
|
|
void *buf, int flags);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_write_dir_block3(ext2_filsys fs, blk64_t block,
|
|
|
|
void *buf, int flags);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
2002-03-11 23:04:45 +03:00
|
|
|
/* dirhash.c */
|
|
|
|
extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
|
2002-08-17 18:52:51 +04:00
|
|
|
const __u32 *seed,
|
2002-06-27 00:52:10 +04:00
|
|
|
ext2_dirhash_t *ret_hash,
|
|
|
|
ext2_dirhash_t *ret_minor_hash);
|
2002-03-11 23:04:45 +03:00
|
|
|
|
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/* dir_iterate.c */
|
2009-06-22 05:07:38 +04:00
|
|
|
extern errcode_t ext2fs_get_rec_len(ext2_filsys fs,
|
|
|
|
struct ext2_dir_entry *dirent,
|
|
|
|
unsigned int *rec_len);
|
|
|
|
extern errcode_t ext2fs_set_rec_len(ext2_filsys fs,
|
|
|
|
unsigned int len,
|
|
|
|
struct ext2_dir_entry *dirent);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t dir,
|
1997-04-29 20:17:09 +04:00
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(struct ext2_dir_entry *dirent,
|
|
|
|
int offset,
|
|
|
|
int blocksize,
|
|
|
|
char *buf,
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
|
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
2002-01-03 11:29:19 +03:00
|
|
|
ext2_ino_t dir,
|
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_ino_t dir,
|
|
|
|
int entry,
|
|
|
|
struct ext2_dir_entry *dirent,
|
|
|
|
int offset,
|
|
|
|
int blocksize,
|
|
|
|
char *buf,
|
|
|
|
void *priv_data),
|
|
|
|
void *priv_data);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
1997-04-30 01:26:48 +04:00
|
|
|
/* dupfs.c */
|
|
|
|
extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
|
1997-04-29 20:17:09 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* expanddir.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2001-07-02 19:54:09 +04:00
|
|
|
/* ext_attr.c */
|
2008-02-02 11:16:32 +03:00
|
|
|
extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry,
|
|
|
|
void *data);
|
2001-07-02 19:54:09 +04:00
|
|
|
extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_read_ext_attr2(ext2_filsys fs, blk64_t block,
|
|
|
|
void *buf);
|
2002-08-17 18:19:44 +04:00
|
|
|
extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block,
|
|
|
|
void *buf);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_write_ext_attr2(ext2_filsys fs, blk64_t block,
|
|
|
|
void *buf);
|
2002-08-17 18:19:44 +04:00
|
|
|
extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
|
|
|
|
char *block_buf,
|
|
|
|
int adjust, __u32 *newcount);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_adjust_ea_refcount2(ext2_filsys fs, blk64_t blk,
|
|
|
|
char *block_buf,
|
|
|
|
int adjust, __u32 *newcount);
|
2002-08-17 18:19:44 +04:00
|
|
|
|
2007-10-15 07:04:58 +04:00
|
|
|
/* extent.c */
|
|
|
|
extern errcode_t ext2fs_extent_header_verify(void *ptr, int size);
|
|
|
|
extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
ext2_extent_handle_t *handle);
|
2009-05-20 00:34:12 +04:00
|
|
|
extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
struct ext2_inode *inode,
|
|
|
|
ext2_extent_handle_t *ret_handle);
|
2008-03-18 06:17:13 +03:00
|
|
|
extern void ext2fs_extent_free(ext2_extent_handle_t handle);
|
2007-10-15 07:04:58 +04:00
|
|
|
extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle,
|
|
|
|
int flags, struct ext2fs_extent *extent);
|
|
|
|
extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags,
|
|
|
|
struct ext2fs_extent *extent);
|
|
|
|
extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags,
|
|
|
|
struct ext2fs_extent *extent);
|
2008-05-20 19:17:46 +04:00
|
|
|
extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle,
|
|
|
|
blk64_t logical, blk64_t physical,
|
|
|
|
int flags);
|
2007-10-15 07:04:58 +04:00
|
|
|
extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags);
|
|
|
|
extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle,
|
|
|
|
struct ext2_extent_info *info);
|
|
|
|
extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle,
|
|
|
|
blk64_t blk);
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
/* fileio.c */
|
2003-08-21 08:40:26 +04:00
|
|
|
extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
struct ext2_inode *inode,
|
|
|
|
int flags, ext2_file_t *ret);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
|
1997-10-26 02:37:42 +04:00
|
|
|
int flags, ext2_file_t *ret);
|
1997-11-03 22:16:55 +03:00
|
|
|
extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
|
2010-07-10 17:32:46 +04:00
|
|
|
struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);
|
1997-10-26 02:37:42 +04:00
|
|
|
extern errcode_t ext2fs_file_close(ext2_file_t file);
|
2002-02-20 09:06:25 +03:00
|
|
|
extern errcode_t ext2fs_file_flush(ext2_file_t file);
|
1997-10-26 02:37:42 +04:00
|
|
|
extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
|
1997-11-03 22:16:55 +03:00
|
|
|
unsigned int wanted, unsigned int *got);
|
2002-02-20 09:06:25 +03:00
|
|
|
extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
|
1997-11-03 22:16:55 +03:00
|
|
|
unsigned int nbytes, unsigned int *written);
|
2003-01-23 02:25:39 +03:00
|
|
|
extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
|
|
|
|
int whence, __u64 *ret_pos);
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
|
|
|
|
int whence, ext2_off_t *ret_pos);
|
2003-01-23 02:25:39 +03:00
|
|
|
errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size);
|
1997-11-03 22:16:55 +03:00
|
|
|
extern ext2_off_t ext2fs_file_get_size(ext2_file_t file);
|
|
|
|
extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size);
|
2010-07-22 17:51:23 +04:00
|
|
|
extern errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size);
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2000-08-19 21:00:47 +04:00
|
|
|
/* finddev.c */
|
|
|
|
extern char *ext2fs_find_block_device(dev_t device);
|
|
|
|
|
ChangeLog, MCONFIG.in, configure, configure.in:
MCONFIG.in: Change --enable-gcc-wall handling so that it's no longer a
configure option, but something which is done when the developer uses
the command "make gcc-wall".
configure.in: Remove test for ino_t, since we don't use it any more
(we always use our own ext2_ino_t). Remove --enable-gcc-wall support.
Add test for sys/ioctl.h
.del-types.h.in~ca55114a:
Remove definition of ino_t
ChangeLog, Makefile.in, ext2fs.h, flushb.c, jump.funcs:
flushb.c (ext2fs_sync_device): New function which centralizes all of
the places which might try to use the BLKFLSBUF or FDFLUSH ioctls (and
usually failing to define them since the system header files don't
usually do this for us, and we're trying to avoid usage of kernel
include files now.)
2001-01-11 18:48:50 +03:00
|
|
|
/* flushb.c */
|
|
|
|
extern errcode_t ext2fs_sync_device(int fd, int flushb);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* freefs.c */
|
|
|
|
extern void ext2fs_free(ext2_filsys fs);
|
1997-04-30 01:26:48 +04:00
|
|
|
extern void ext2fs_free_dblist(ext2_dblist dblist);
|
2002-07-20 08:28:07 +04:00
|
|
|
extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb);
|
|
|
|
extern void ext2fs_u32_list_free(ext2_u32_list bb);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
2007-07-23 06:59:50 +04:00
|
|
|
/* gen_bitmap.c */
|
|
|
|
extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
|
|
|
|
__u32 start, __u32 end,
|
2007-07-23 06:59:50 +04:00
|
|
|
__u32 real_end,
|
|
|
|
const char *descr, char *init_map,
|
|
|
|
ext2fs_generic_bitmap *ret);
|
|
|
|
extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
|
|
|
|
__u32 end,
|
|
|
|
__u32 real_end,
|
|
|
|
const char *descr,
|
|
|
|
ext2fs_generic_bitmap *ret);
|
|
|
|
extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src,
|
|
|
|
ext2fs_generic_bitmap *dest);
|
|
|
|
extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap);
|
|
|
|
extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap,
|
2008-08-28 07:07:54 +04:00
|
|
|
errcode_t magic,
|
2007-07-23 06:59:50 +04:00
|
|
|
errcode_t neq,
|
2008-08-28 07:07:54 +04:00
|
|
|
ext2_ino_t end,
|
2007-07-23 06:59:50 +04:00
|
|
|
ext2_ino_t *oend);
|
|
|
|
extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map);
|
2007-07-23 07:42:14 +04:00
|
|
|
extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
|
|
|
|
__u32 new_end,
|
|
|
|
__u32 new_real_end,
|
|
|
|
ext2fs_generic_bitmap bmap);
|
|
|
|
extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
|
|
|
|
ext2fs_generic_bitmap bm1,
|
|
|
|
ext2fs_generic_bitmap bm2);
|
2007-07-23 12:32:48 +04:00
|
|
|
extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap,
|
|
|
|
errcode_t magic,
|
|
|
|
__u32 start, __u32 num,
|
|
|
|
void *out);
|
|
|
|
extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap,
|
|
|
|
errcode_t magic,
|
|
|
|
__u32 start, __u32 num,
|
|
|
|
void *in);
|
2007-07-23 06:59:50 +04:00
|
|
|
|
2009-08-05 08:27:10 +04:00
|
|
|
/* gen_bitmap64.c */
|
|
|
|
void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap);
|
|
|
|
errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
|
|
|
int type, __u64 start, __u64 end,
|
|
|
|
__u64 real_end,
|
|
|
|
const char *descr,
|
|
|
|
ext2fs_generic_bitmap *ret);
|
|
|
|
errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
|
|
|
|
ext2fs_generic_bitmap *dest);
|
|
|
|
void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
|
|
|
|
errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
|
|
|
|
errcode_t neq,
|
|
|
|
__u64 end, __u64 *oend);
|
|
|
|
void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
|
|
|
|
errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
|
|
|
|
__u64 new_end,
|
|
|
|
__u64 new_real_end);
|
|
|
|
errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
|
|
|
ext2fs_generic_bitmap bm1,
|
|
|
|
ext2fs_generic_bitmap bm2);
|
|
|
|
errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap,
|
|
|
|
__u64 start, unsigned int num,
|
|
|
|
void *out);
|
|
|
|
errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap,
|
|
|
|
__u64 start, unsigned int num,
|
|
|
|
void *in);
|
2011-06-11 01:55:09 +04:00
|
|
|
errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|
|
|
ext2fs_block_bitmap *bitmap);
|
2009-08-05 08:27:10 +04:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
/* getsize.c */
|
|
|
|
extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
|
|
|
|
blk_t *retblocks);
|
2008-08-20 21:34:07 +04:00
|
|
|
extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
|
|
|
|
blk64_t *retblocks);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2003-05-22 01:28:29 +04:00
|
|
|
/* getsectsize.c */
|
|
|
|
errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize);
|
2010-05-18 06:31:45 +04:00
|
|
|
errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize);
|
2003-05-22 01:28:29 +04:00
|
|
|
|
2008-04-09 19:39:11 +04:00
|
|
|
/* i_block.c */
|
|
|
|
errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode,
|
|
|
|
blk64_t num_blocks);
|
|
|
|
errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode,
|
|
|
|
blk64_t num_blocks);
|
|
|
|
errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b);
|
|
|
|
|
ChangeLog, Makefile.in, e2image.h, ext2_err.et.in, ext2fs.h, imager.c:
imager.c (ext2fs_image_{inode,super,bitmap}_{read,write}, ext2_fs.h,
Makefile.in: New file that has routines that save ext2fs metadata to a
file.
ext2_err.et.in (EXT2_ET_MAGIC_E2IMAGE): New error code assigned.
e2image.h: New file which defines the file format for the ext2 image
file. (Saved copy of ext2 metadata to a file as a saving throw
against worst-case damage.)
ChangeLog, Makefile.in, e2image.c:
e2image.c, Makefile.in: New program which saves ext2 metadata to a
file for people who need a last-ditch saving throw.
2000-11-12 22:32:20 +03:00
|
|
|
/* imager.c */
|
|
|
|
extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags);
|
|
|
|
extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags);
|
|
|
|
extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags);
|
|
|
|
extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags);
|
|
|
|
extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags);
|
|
|
|
extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags);
|
|
|
|
|
2005-01-06 08:04:24 +03:00
|
|
|
/* ind_block.c */
|
|
|
|
errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf);
|
|
|
|
errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* initialize.c */
|
|
|
|
extern errcode_t ext2fs_initialize(const char *name, int flags,
|
|
|
|
struct ext2_super_block *param,
|
|
|
|
io_manager manager, ext2_filsys *ret_fs);
|
|
|
|
|
2002-02-20 09:06:25 +03:00
|
|
|
/* icount.c */
|
|
|
|
extern void ext2fs_free_icount(ext2_icount_t icount);
|
2007-04-06 22:30:39 +04:00
|
|
|
extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
|
|
|
|
int flags, ext2_icount_t *ret);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
|
2003-12-07 09:28:50 +03:00
|
|
|
unsigned int size,
|
2002-02-20 09:06:25 +03:00
|
|
|
ext2_icount_t hint, ext2_icount_t *ret);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
|
2003-12-07 09:28:50 +03:00
|
|
|
unsigned int size,
|
2002-02-20 09:06:25 +03:00
|
|
|
ext2_icount_t *ret);
|
|
|
|
extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
|
|
|
|
__u16 *ret);
|
|
|
|
extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
|
|
|
|
__u16 *ret);
|
|
|
|
extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
|
|
|
|
__u16 *ret);
|
|
|
|
extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
|
|
|
|
__u16 count);
|
|
|
|
extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
|
|
|
|
errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* inode.c */
|
ChangeLog, Makefile.in, e2image.h, ext2_err.et.in, ext2fs.h, imager.c:
imager.c (ext2fs_image_{inode,super,bitmap}_{read,write}, ext2_fs.h,
Makefile.in: New file that has routines that save ext2fs metadata to a
file.
ext2_err.et.in (EXT2_ET_MAGIC_E2IMAGE): New error code assigned.
e2image.h: New file which defines the file format for the ext2 image
file. (Saved copy of ext2 metadata to a file as a saving throw
against worst-case damage.)
ChangeLog, Makefile.in, e2image.c:
e2image.c, Makefile.in: New program which saves ext2 metadata to a
file for people who need a last-ditch saving throw.
2000-11-12 22:32:20 +03:00
|
|
|
extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
|
2005-01-26 07:42:56 +03:00
|
|
|
ext2_ino_t *ino,
|
2008-08-28 07:07:54 +04:00
|
|
|
struct ext2_inode *inode,
|
2005-01-26 07:42:56 +03:00
|
|
|
int bufsize);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
|
|
|
|
ext2_inode_scan *ret_scan);
|
|
|
|
extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
|
1997-04-26 17:21:57 +04:00
|
|
|
struct ext2_inode *inode);
|
1997-04-29 20:17:09 +04:00
|
|
|
extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
|
|
|
|
int group);
|
|
|
|
extern void ext2fs_set_inode_callback
|
|
|
|
(ext2_inode_scan scan,
|
|
|
|
errcode_t (*done_group)(ext2_filsys fs,
|
|
|
|
ext2_inode_scan scan,
|
|
|
|
dgrp_t group,
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
void * priv_data),
|
1997-04-29 20:17:09 +04:00
|
|
|
void *done_group_data);
|
|
|
|
extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
|
|
|
|
int clear_flags);
|
2005-01-26 07:42:56 +03:00
|
|
|
extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
|
2008-08-28 07:07:54 +04:00
|
|
|
struct ext2_inode * inode,
|
2005-01-26 07:42:56 +03:00
|
|
|
int bufsize);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
|
1997-04-26 17:21:57 +04:00
|
|
|
struct ext2_inode * inode);
|
2005-01-26 07:42:56 +03:00
|
|
|
extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
|
2008-08-28 07:07:54 +04:00
|
|
|
struct ext2_inode * inode,
|
2005-01-26 07:42:56 +03:00
|
|
|
int bufsize);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
|
1997-04-26 17:21:57 +04:00
|
|
|
struct ext2_inode * inode);
|
2005-03-21 04:05:22 +03:00
|
|
|
extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
struct ext2_inode * inode);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
|
|
|
|
extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2002-02-20 09:06:25 +03:00
|
|
|
/* inode_io.c */
|
|
|
|
extern io_manager inode_io_manager;
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
|
2002-03-08 07:52:56 +03:00
|
|
|
char **name);
|
2003-08-21 08:40:26 +04:00
|
|
|
extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
struct ext2_inode *inode,
|
|
|
|
char **name);
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
/* ismounted.c */
|
|
|
|
extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
|
2001-01-03 17:56:46 +03:00
|
|
|
extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
|
|
|
|
char *mtpt, int mtlen);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
2010-07-22 17:37:35 +04:00
|
|
|
/* punch.c */
|
|
|
|
extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
struct ext2_inode *inode,
|
|
|
|
char *block_buf, blk64_t start,
|
|
|
|
blk64_t end);
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* namei.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
|
|
|
|
int namelen, char *buf, ext2_ino_t *inode);
|
|
|
|
extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
|
|
|
const char *name, ext2_ino_t *inode);
|
|
|
|
errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
|
|
|
const char *name, ext2_ino_t *inode);
|
|
|
|
extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
|
|
|
ext2_ino_t inode, ext2_ino_t *res_inode);
|
1997-04-29 18:53:37 +04:00
|
|
|
|
|
|
|
/* native.c */
|
|
|
|
int ext2fs_native_flag(void);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* newdir.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
|
|
|
|
ext2_ino_t parent_ino, char **block);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* mkdir.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
|
1997-04-26 17:21:57 +04:00
|
|
|
const char *name);
|
|
|
|
|
2000-10-24 22:33:16 +04:00
|
|
|
/* mkjournal.c */
|
2008-04-28 00:10:32 +04:00
|
|
|
extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
|
|
|
|
blk_t *ret_blk, int *ret_count);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num,
|
2011-06-11 20:17:29 +04:00
|
|
|
blk64_t *ret_blk, int *ret_count);
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
|
2011-06-11 20:17:29 +04:00
|
|
|
__u32 num_blocks, int flags,
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
char **ret_jsb);
|
|
|
|
extern errcode_t ext2fs_add_journal_device(ext2_filsys fs,
|
|
|
|
ext2_filsys journal_dev);
|
2011-06-11 20:17:29 +04:00
|
|
|
extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t num_blocks,
|
2001-01-03 16:04:12 +03:00
|
|
|
int flags);
|
2011-06-11 20:17:29 +04:00
|
|
|
extern int ext2fs_default_journal_size(__u64 num_blocks);
|
2000-10-24 22:33:16 +04:00
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* openfs.c */
|
|
|
|
extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
|
2003-12-07 09:28:50 +03:00
|
|
|
unsigned int block_size, io_manager manager,
|
1997-04-26 17:21:57 +04:00
|
|
|
ext2_filsys *ret_fs);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_open2(const char *name, const char *io_options,
|
|
|
|
int flags, int superblock,
|
2004-11-30 22:07:11 +03:00
|
|
|
unsigned int block_size, io_manager manager,
|
|
|
|
ext2_filsys *ret_fs);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs,
|
|
|
|
blk64_t group_block, dgrp_t i);
|
2008-08-28 07:07:54 +04:00
|
|
|
extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
|
2002-10-20 08:38:57 +04:00
|
|
|
dgrp_t i);
|
2004-07-29 05:11:48 +04:00
|
|
|
errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
|
|
|
|
errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
|
|
|
|
errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* get_pathname.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
|
1997-04-26 17:21:57 +04:00
|
|
|
char **name);
|
|
|
|
|
|
|
|
/* link.c */
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
|
|
|
|
ext2_ino_t ino, int flags);
|
|
|
|
errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
|
|
|
|
ext2_ino_t ino, int flags);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
2011-09-24 21:48:55 +04:00
|
|
|
/* mmp.c */
|
|
|
|
errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf);
|
|
|
|
errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf);
|
|
|
|
errcode_t ext2fs_mmp_clear(ext2_filsys fs);
|
|
|
|
errcode_t ext2fs_mmp_init(ext2_filsys fs);
|
|
|
|
errcode_t ext2fs_mmp_start(ext2_filsys fs);
|
|
|
|
errcode_t ext2fs_mmp_update(ext2_filsys fs);
|
|
|
|
errcode_t ext2fs_mmp_stop(ext2_filsys fs);
|
|
|
|
unsigned ext2fs_mmp_new_seq();
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* read_bb.c */
|
1997-04-29 20:17:09 +04:00
|
|
|
extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
|
|
|
|
ext2_badblocks_list *bb_list);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/* read_bb_file.c */
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
|
2000-07-04 23:20:25 +04:00
|
|
|
ext2_badblocks_list *bb_list,
|
2002-07-15 00:00:50 +04:00
|
|
|
void *priv_data,
|
2000-07-04 23:20:25 +04:00
|
|
|
void (*invalid)(ext2_filsys fs,
|
|
|
|
blk_t blk,
|
|
|
|
char *badstr,
|
2002-07-15 00:00:50 +04:00
|
|
|
void *priv_data));
|
2008-08-28 07:07:54 +04:00
|
|
|
extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
|
1997-04-29 20:17:09 +04:00
|
|
|
ext2_badblocks_list *bb_list,
|
1997-04-26 17:21:57 +04:00
|
|
|
void (*invalid)(ext2_filsys fs,
|
|
|
|
blk_t blk));
|
|
|
|
|
2004-12-15 22:39:16 +03:00
|
|
|
/* res_gdt.c */
|
|
|
|
extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs);
|
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
/* swapfs.c */
|
2008-08-28 07:07:54 +04:00
|
|
|
extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
|
2005-01-26 07:42:56 +03:00
|
|
|
int has_header);
|
2008-02-02 11:16:32 +03:00
|
|
|
extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header,
|
|
|
|
struct ext2_ext_attr_header *from_hdr);
|
|
|
|
extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry,
|
|
|
|
struct ext2_ext_attr_entry *from_entry);
|
1997-04-26 17:58:21 +04:00
|
|
|
extern void ext2fs_swap_super(struct ext2_super_block * super);
|
|
|
|
extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
|
2009-10-26 04:46:01 +03:00
|
|
|
extern void ext2fs_swap_group_desc2(ext2_filsys, struct ext2_group_desc *gdp);
|
2005-01-26 07:42:56 +03:00
|
|
|
extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
|
|
|
|
struct ext2_inode_large *f, int hostorder,
|
|
|
|
int bufsize);
|
1997-04-29 18:53:37 +04:00
|
|
|
extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
|
|
|
|
struct ext2_inode *f, int hostorder);
|
2011-09-24 21:48:55 +04:00
|
|
|
extern void ext2fs_swap_mmp(struct mmp_struct *mmp);
|
1997-04-29 18:53:37 +04:00
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/* valid_blk.c */
|
1997-04-29 21:48:10 +04:00
|
|
|
extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
|
|
|
|
|
|
|
|
/* version.c */
|
|
|
|
extern int ext2fs_parse_version_string(const char *ver_string);
|
|
|
|
extern int ext2fs_get_library_version(const char **ver_string,
|
|
|
|
const char **date_string);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
/* write_bb_file.c */
|
|
|
|
extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
|
|
|
|
unsigned int flags,
|
|
|
|
FILE *f);
|
|
|
|
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/* inline functions */
|
2003-08-01 17:41:07 +04:00
|
|
|
extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
|
2010-09-23 20:56:46 +04:00
|
|
|
extern errcode_t ext2fs_get_memalign(unsigned long size,
|
|
|
|
unsigned long align, void *ptr);
|
2011-07-07 21:50:22 +04:00
|
|
|
extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr);
|
|
|
|
extern errcode_t ext2fs_get_array(unsigned long count,
|
|
|
|
unsigned long size, void *ptr);
|
|
|
|
extern errcode_t ext2fs_get_arrayzero(unsigned long count,
|
|
|
|
unsigned long size, void *ptr);
|
2003-08-01 17:41:07 +04:00
|
|
|
extern errcode_t ext2fs_free_mem(void *ptr);
|
1998-04-27 05:41:13 +04:00
|
|
|
extern errcode_t ext2fs_resize_mem(unsigned long old_size,
|
2003-08-01 17:41:07 +04:00
|
|
|
unsigned long size, void *ptr);
|
1997-04-26 17:21:57 +04:00
|
|
|
extern void ext2fs_mark_super_dirty(ext2_filsys fs);
|
|
|
|
extern void ext2fs_mark_changed(ext2_filsys fs);
|
|
|
|
extern int ext2fs_test_changed(ext2_filsys fs);
|
|
|
|
extern void ext2fs_mark_valid(ext2_filsys fs);
|
|
|
|
extern void ext2fs_unmark_valid(ext2_filsys fs);
|
|
|
|
extern int ext2fs_test_valid(ext2_filsys fs);
|
|
|
|
extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
|
|
|
|
extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
|
|
|
|
extern int ext2fs_test_ib_dirty(ext2_filsys fs);
|
|
|
|
extern int ext2fs_test_bb_dirty(ext2_filsys fs);
|
|
|
|
extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
|
2006-09-12 22:56:16 +04:00
|
|
|
extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
|
|
|
|
extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
|
2002-08-17 18:19:44 +04:00
|
|
|
extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
|
|
|
|
struct ext2_inode *inode);
|
2006-08-30 09:57:00 +04:00
|
|
|
extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
|
2009-06-02 00:15:40 +04:00
|
|
|
extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
|
2011-09-16 07:44:48 +04:00
|
|
|
extern int ext2fs_open_file(const char *pathname, int flags, ...);
|
|
|
|
extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
|
2011-09-24 20:59:31 +04:00
|
|
|
extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The actual inlined functions definitions themselves...
|
|
|
|
*
|
|
|
|
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
|
|
|
|
* functions at all!
|
|
|
|
*/
|
|
|
|
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
|
|
|
#ifdef INCLUDE_INLINE_FUNCS
|
|
|
|
#define _INLINE_ extern
|
|
|
|
#else
|
1998-04-27 05:41:13 +04:00
|
|
|
#ifdef __GNUC__
|
1997-04-26 17:21:57 +04:00
|
|
|
#define _INLINE_ extern __inline__
|
1998-04-27 05:41:13 +04:00
|
|
|
#else /* For Watcom C */
|
|
|
|
#define _INLINE_ extern inline
|
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
#endif
|
|
|
|
|
1997-10-26 06:41:24 +03:00
|
|
|
#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
|
2005-09-06 13:59:52 +04:00
|
|
|
#include <string.h>
|
1997-10-26 06:41:24 +03:00
|
|
|
/*
|
|
|
|
* Allocate memory
|
|
|
|
*/
|
2003-08-01 17:41:07 +04:00
|
|
|
_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
|
1997-10-26 06:41:24 +03:00
|
|
|
{
|
2006-11-14 08:34:34 +03:00
|
|
|
void *pp;
|
2003-08-01 17:41:07 +04:00
|
|
|
|
2006-11-14 08:34:34 +03:00
|
|
|
pp = malloc(size);
|
|
|
|
if (!pp)
|
1997-10-31 09:17:08 +03:00
|
|
|
return EXT2_ET_NO_MEMORY;
|
2006-11-14 08:34:34 +03:00
|
|
|
memcpy(ptr, &pp, sizeof (pp));
|
1997-10-26 06:41:24 +03:00
|
|
|
return 0;
|
|
|
|
}
|
2007-12-27 18:08:13 +03:00
|
|
|
|
2010-09-23 20:56:46 +04:00
|
|
|
_INLINE_ errcode_t ext2fs_get_memalign(unsigned long size,
|
|
|
|
unsigned long align, void *ptr)
|
|
|
|
{
|
|
|
|
errcode_t retval;
|
|
|
|
|
|
|
|
if (align == 0)
|
|
|
|
align = 8;
|
2011-06-11 18:58:25 +04:00
|
|
|
retval = posix_memalign((void **) ptr, align, size);
|
|
|
|
if (retval) {
|
2010-09-23 20:56:46 +04:00
|
|
|
if (retval == ENOMEM)
|
|
|
|
return EXT2_ET_NO_MEMORY;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-05-18 16:19:52 +04:00
|
|
|
_INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr)
|
|
|
|
{
|
|
|
|
void *pp;
|
|
|
|
|
|
|
|
pp = malloc(size);
|
|
|
|
if (!pp)
|
|
|
|
return EXT2_ET_NO_MEMORY;
|
|
|
|
memset(pp, 0, size);
|
|
|
|
memcpy(ptr, &pp, sizeof(pp));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-10 03:01:06 +03:00
|
|
|
_INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr)
|
|
|
|
{
|
|
|
|
if (count && (-1UL)/count<size)
|
2011-05-18 16:19:52 +04:00
|
|
|
return EXT2_ET_NO_MEMORY;
|
2007-11-10 03:01:06 +03:00
|
|
|
return ext2fs_get_mem(count*size, ptr);
|
|
|
|
}
|
1997-10-26 06:41:24 +03:00
|
|
|
|
2011-05-18 16:19:52 +04:00
|
|
|
_INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count,
|
|
|
|
unsigned long size, void *ptr)
|
|
|
|
{
|
|
|
|
void *pp;
|
|
|
|
|
|
|
|
if (count && (-1UL)/count<size)
|
|
|
|
return EXT2_ET_NO_MEMORY;
|
|
|
|
pp = calloc(count, size);
|
|
|
|
if (!pp)
|
|
|
|
return EXT2_ET_NO_MEMORY;
|
|
|
|
memcpy(ptr, &pp, sizeof(pp));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-10-26 06:41:24 +03:00
|
|
|
/*
|
|
|
|
* Free memory
|
|
|
|
*/
|
2003-08-01 17:41:07 +04:00
|
|
|
_INLINE_ errcode_t ext2fs_free_mem(void *ptr)
|
1997-10-26 06:41:24 +03:00
|
|
|
{
|
2006-11-14 08:34:34 +03:00
|
|
|
void *p;
|
2003-08-01 17:41:07 +04:00
|
|
|
|
2006-11-14 08:34:34 +03:00
|
|
|
memcpy(&p, ptr, sizeof(p));
|
|
|
|
free(p);
|
|
|
|
p = 0;
|
|
|
|
memcpy(ptr, &p, sizeof(p));
|
1997-10-26 06:41:24 +03:00
|
|
|
return 0;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-10-26 06:41:24 +03:00
|
|
|
/*
|
|
|
|
* Resize memory
|
|
|
|
*/
|
2004-02-22 05:04:30 +03:00
|
|
|
_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
|
2003-08-01 17:41:07 +04:00
|
|
|
unsigned long size, void *ptr)
|
1997-10-26 06:41:24 +03:00
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
|
2005-06-27 19:47:21 +04:00
|
|
|
/* Use "memcpy" for pointer assignments here to avoid problems
|
|
|
|
* with C99 strict type aliasing rules. */
|
2006-11-14 08:34:34 +03:00
|
|
|
memcpy(&p, ptr, sizeof(p));
|
2005-06-27 19:47:21 +04:00
|
|
|
p = realloc(p, size);
|
1997-10-26 06:41:24 +03:00
|
|
|
if (!p)
|
1997-10-31 09:17:08 +03:00
|
|
|
return EXT2_ET_NO_MEMORY;
|
2006-11-14 08:34:34 +03:00
|
|
|
memcpy(ptr, &p, sizeof(p));
|
1997-10-26 06:41:24 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* Custom memory routines */
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* Mark a filesystem superblock as dirty
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark a filesystem as changed
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags |= EXT2_FLAG_CHANGED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if a filesystem has changed
|
|
|
|
*/
|
|
|
|
_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
return (fs->flags & EXT2_FLAG_CHANGED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark a filesystem as valid
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags |= EXT2_FLAG_VALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark a filesystem as NOT valid
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags &= ~EXT2_FLAG_VALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if a filesystem is valid
|
|
|
|
*/
|
|
|
|
_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
return (fs->flags & EXT2_FLAG_VALID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark the inode bitmap as dirty
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mark the block bitmap as dirty
|
|
|
|
*/
|
|
|
|
_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if a filesystem's inode bitmap is dirty
|
|
|
|
*/
|
|
|
|
_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
return (fs->flags & EXT2_FLAG_IB_DIRTY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if a filesystem's block bitmap is dirty
|
|
|
|
*/
|
|
|
|
_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
|
|
|
|
{
|
|
|
|
return (fs->flags & EXT2_FLAG_BB_DIRTY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the group # of a block
|
|
|
|
*/
|
|
|
|
_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
|
|
|
|
{
|
2009-06-06 23:22:43 +04:00
|
|
|
return ext2fs_group_of_blk2(fs, blk);
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Return the group # of an inode number
|
|
|
|
*/
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
|
1997-04-26 17:21:57 +04:00
|
|
|
{
|
|
|
|
return (ino - 1) / fs->super->s_inodes_per_group;
|
|
|
|
}
|
2002-08-17 18:19:44 +04:00
|
|
|
|
2006-09-12 22:56:16 +04:00
|
|
|
/*
|
|
|
|
* Return the first block (inclusive) in a group
|
|
|
|
*/
|
|
|
|
_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
|
|
|
|
{
|
2009-06-06 23:22:43 +04:00
|
|
|
return ext2fs_group_first_block2(fs, group);
|
2006-09-12 22:56:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the last block (inclusive) in a group
|
|
|
|
*/
|
|
|
|
_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
|
|
|
|
{
|
2009-06-06 23:22:43 +04:00
|
|
|
return ext2fs_group_last_block2(fs, group);
|
2006-09-12 22:56:16 +04:00
|
|
|
}
|
|
|
|
|
2002-08-17 18:19:44 +04:00
|
|
|
_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
|
|
|
|
struct ext2_inode *inode)
|
|
|
|
{
|
2009-06-06 23:22:43 +04:00
|
|
|
return ext2fs_inode_data_blocks2(fs, inode);
|
2002-08-17 18:19:44 +04:00
|
|
|
}
|
2006-08-30 09:57:00 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b)
|
|
|
|
*/
|
|
|
|
_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b)
|
|
|
|
{
|
|
|
|
if (!a)
|
|
|
|
return 0;
|
|
|
|
return ((a - 1) / b) + 1;
|
|
|
|
}
|
2009-06-02 00:15:40 +04:00
|
|
|
|
|
|
|
_INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)
|
|
|
|
{
|
|
|
|
if (!a)
|
|
|
|
return 0;
|
|
|
|
return ((a - 1) / b) + 1;
|
|
|
|
}
|
|
|
|
|
2011-09-16 07:44:48 +04:00
|
|
|
_INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
mode_t mode;
|
|
|
|
|
|
|
|
va_start(args, flags);
|
|
|
|
mode = va_arg(args, mode_t);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
if (mode)
|
2011-09-24 20:59:31 +04:00
|
|
|
#if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
|
2011-09-16 07:44:48 +04:00
|
|
|
return open64(pathname, flags, mode);
|
|
|
|
else
|
|
|
|
return open64(pathname, flags);
|
|
|
|
#else
|
|
|
|
return open(pathname, flags, mode);
|
|
|
|
else
|
|
|
|
return open(pathname, flags);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
_INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf)
|
|
|
|
{
|
2011-09-24 20:59:31 +04:00
|
|
|
#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
|
2011-09-16 07:44:48 +04:00
|
|
|
return stat64(path, buf);
|
|
|
|
#else
|
2011-09-24 20:59:31 +04:00
|
|
|
return stat(path, buf);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
_INLINE_ int ext2fs_fstat(int fd, ext2fs_struct_stat *buf)
|
|
|
|
{
|
|
|
|
#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
|
|
|
|
return fstat64(fd, buf);
|
|
|
|
#else
|
|
|
|
return fstat(fd, buf);
|
2011-09-16 07:44:48 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
#undef _INLINE_
|
|
|
|
#endif
|
|
|
|
|
2000-05-19 06:11:41 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-02-17 01:00:37 +03:00
|
|
|
#endif /* _EXT2FS_EXT2FS_H */
|