Commit 617ba13b authored by Mingming Cao's avatar Mingming Cao Committed by Linus Torvalds

[PATCH] ext4: rename ext4 symbols to avoid duplication of ext3 symbols

Mingming Cao originally did this work, and Shaggy reproduced it using some
scripts from her.
Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ac27a0ec
#
# Makefile for the linux ext3-filesystem routines.
# Makefile for the linux ext4-filesystem routines.
#
obj-$(CONFIG_EXT3_FS) += ext3.o
obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ext4dev-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o hash.o resize.o
ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
ext3-$(CONFIG_EXT3_FS_SECURITY) += xattr_security.o
ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o
ext4dev-$(CONFIG_EXT4DEV_FS_SECURITY) += xattr_security.o
This diff is collapsed.
/*
File: fs/ext3/acl.h
File: fs/ext4/acl.h
(C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
#include <linux/posix_acl_xattr.h>
#define EXT3_ACL_VERSION 0x0001
#define EXT4_ACL_VERSION 0x0001
typedef struct {
__le16 e_tag;
__le16 e_perm;
__le32 e_id;
} ext3_acl_entry;
} ext4_acl_entry;
typedef struct {
__le16 e_tag;
__le16 e_perm;
} ext3_acl_entry_short;
} ext4_acl_entry_short;
typedef struct {
__le32 a_version;
} ext3_acl_header;
} ext4_acl_header;
static inline size_t ext3_acl_size(int count)
static inline size_t ext4_acl_size(int count)
{
if (count <= 4) {
return sizeof(ext3_acl_header) +
count * sizeof(ext3_acl_entry_short);
return sizeof(ext4_acl_header) +
count * sizeof(ext4_acl_entry_short);
} else {
return sizeof(ext3_acl_header) +
4 * sizeof(ext3_acl_entry_short) +
(count - 4) * sizeof(ext3_acl_entry);
return sizeof(ext4_acl_header) +
4 * sizeof(ext4_acl_entry_short) +
(count - 4) * sizeof(ext4_acl_entry);
}
}
static inline int ext3_acl_count(size_t size)
static inline int ext4_acl_count(size_t size)
{
ssize_t s;
size -= sizeof(ext3_acl_header);
s = size - 4 * sizeof(ext3_acl_entry_short);
size -= sizeof(ext4_acl_header);
s = size - 4 * sizeof(ext4_acl_entry_short);
if (s < 0) {
if (size % sizeof(ext3_acl_entry_short))
if (size % sizeof(ext4_acl_entry_short))
return -1;
return size / sizeof(ext3_acl_entry_short);
return size / sizeof(ext4_acl_entry_short);
} else {
if (s % sizeof(ext3_acl_entry))
if (s % sizeof(ext4_acl_entry))
return -1;
return s / sizeof(ext3_acl_entry) + 4;
return s / sizeof(ext4_acl_entry) + 4;
}
}
#ifdef CONFIG_EXT3_FS_POSIX_ACL
#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
/* Value for inode->u.ext3_i.i_acl and inode->u.ext3_i.i_default_acl
/* Value for inode->u.ext4_i.i_acl and inode->u.ext4_i.i_default_acl
if the ACL has not been cached */
#define EXT3_ACL_NOT_CACHED ((void *)-1)
#define EXT4_ACL_NOT_CACHED ((void *)-1)
/* acl.c */
extern int ext3_permission (struct inode *, int, struct nameidata *);
extern int ext3_acl_chmod (struct inode *);
extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
extern int ext4_permission (struct inode *, int, struct nameidata *);
extern int ext4_acl_chmod (struct inode *);
extern int ext4_init_acl (handle_t *, struct inode *, struct inode *);
#else /* CONFIG_EXT3_FS_POSIX_ACL */
#else /* CONFIG_EXT4DEV_FS_POSIX_ACL */
#include <linux/sched.h>
#define ext3_permission NULL
#define ext4_permission NULL
static inline int
ext3_acl_chmod(struct inode *inode)
ext4_acl_chmod(struct inode *inode)
{
return 0;
}
static inline int
ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
{
return 0;
}
#endif /* CONFIG_EXT3_FS_POSIX_ACL */
#endif /* CONFIG_EXT4DEV_FS_POSIX_ACL */
This diff is collapsed.
/*
* linux/fs/ext3/bitmap.c
* linux/fs/ext4/bitmap.c
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
......@@ -9,13 +9,13 @@
#include <linux/buffer_head.h>
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_fs.h>
#ifdef EXT3FS_DEBUG
#ifdef EXT4FS_DEBUG
static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars)
unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars)
{
unsigned int i;
unsigned long sum = 0;
......@@ -28,5 +28,5 @@ unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars)
return (sum);
}
#endif /* EXT3FS_DEBUG */
#endif /* EXT4FS_DEBUG */
This diff is collapsed.
/*
* linux/fs/ext3/file.c
* linux/fs/ext4/file.c
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
......@@ -12,7 +12,7 @@
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* ext3 fs regular file handling primitives
* ext4 fs regular file handling primitives
*
* 64-bit file support on 64-bit platforms by Jakub Jelinek
* (jj@sunsite.ms.mff.cuni.cz)
......@@ -21,34 +21,34 @@
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext3_jbd.h>
#include <linux/ext4_fs.h>
#include <linux/ext4_jbd.h>
#include "xattr.h"
#include "acl.h"
/*
* Called when an inode is released. Note that this is different
* from ext3_file_open: open gets called at every open, but release
* from ext4_file_open: open gets called at every open, but release
* gets called only when /all/ the files are closed.
*/
static int ext3_release_file (struct inode * inode, struct file * filp)
static int ext4_release_file (struct inode * inode, struct file * filp)
{
/* if we are the last writer on the inode, drop the block reservation */
if ((filp->f_mode & FMODE_WRITE) &&
(atomic_read(&inode->i_writecount) == 1))
{
mutex_lock(&EXT3_I(inode)->truncate_mutex);
ext3_discard_reservation(inode);
mutex_unlock(&EXT3_I(inode)->truncate_mutex);
mutex_lock(&EXT4_I(inode)->truncate_mutex);
ext4_discard_reservation(inode);
mutex_unlock(&EXT4_I(inode)->truncate_mutex);
}
if (is_dx(inode) && filp->private_data)
ext3_htree_free_dir_info(filp->private_data);
ext4_htree_free_dir_info(filp->private_data);
return 0;
}
static ssize_t
ext3_file_write(struct kiocb *iocb, const struct iovec *iov,
ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct file *file = iocb->ki_filp;
......@@ -79,7 +79,7 @@ ext3_file_write(struct kiocb *iocb, const struct iovec *iov,
* Open question --- do we care about flushing timestamps too
* if the inode is IS_SYNC?
*/
if (!ext3_should_journal_data(inode))
if (!ext4_should_journal_data(inode))
return ret;
goto force_commit;
......@@ -100,40 +100,40 @@ ext3_file_write(struct kiocb *iocb, const struct iovec *iov,
*/
force_commit:
err = ext3_force_commit(inode->i_sb);
err = ext4_force_commit(inode->i_sb);
if (err)
return err;
return ret;
}
const struct file_operations ext3_file_operations = {
const struct file_operations ext4_file_operations = {
.llseek = generic_file_llseek,
.read = do_sync_read,
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_write = ext3_file_write,
.ioctl = ext3_ioctl,
.aio_write = ext4_file_write,
.ioctl = ext4_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ext3_compat_ioctl,
.compat_ioctl = ext4_compat_ioctl,
#endif
.mmap = generic_file_mmap,
.open = generic_file_open,
.release = ext3_release_file,
.fsync = ext3_sync_file,
.release = ext4_release_file,
.fsync = ext4_sync_file,
.sendfile = generic_file_sendfile,
.splice_read = generic_file_splice_read,
.splice_write = generic_file_splice_write,
};
struct inode_operations ext3_file_inode_operations = {
.truncate = ext3_truncate,
.setattr = ext3_setattr,
#ifdef CONFIG_EXT3_FS_XATTR
struct inode_operations ext4_file_inode_operations = {
.truncate = ext4_truncate,
.setattr = ext4_setattr,
#ifdef CONFIG_EXT4DEV_FS_XATTR
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = ext3_listxattr,
.listxattr = ext4_listxattr,
.removexattr = generic_removexattr,
#endif
.permission = ext3_permission,
.permission = ext4_permission,
};
/*
* linux/fs/ext3/fsync.c
* linux/fs/ext4/fsync.c
*
* Copyright (C) 1993 Stephen Tweedie (sct@redhat.com)
* from
......@@ -9,7 +9,7 @@
* from
* linux/fs/minix/truncate.c Copyright (C) 1991, 1992 Linus Torvalds
*
* ext3fs fsync primitive
* ext4fs fsync primitive
*
* Big-endian to little-endian byte-swapping/bitmaps by
* David S. Miller (davem@caip.rutgers.edu), 1995
......@@ -27,11 +27,11 @@
#include <linux/sched.h>
#include <linux/writeback.h>
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext3_jbd.h>
#include <linux/ext4_fs.h>
#include <linux/ext4_jbd.h>
/*
* akpm: A new design for ext3_sync_file().
* akpm: A new design for ext4_sync_file().
*
* This is only called from sys_fsync(), sys_fdatasync() and sys_msync().
* There cannot be a transaction open by this task.
......@@ -42,12 +42,12 @@
* inode to disk.
*/
int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync)
{
struct inode *inode = dentry->d_inode;
int ret = 0;
J_ASSERT(ext3_journal_current_handle() == 0);
J_ASSERT(ext4_journal_current_handle() == 0);
/*
* data=writeback:
......@@ -61,14 +61,14 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
*
* data=journal:
* filemap_fdatawrite won't do anything (the buffers are clean).
* ext3_force_commit will write the file data into the journal and
* ext4_force_commit will write the file data into the journal and
* will wait on that.
* filemap_fdatawait() will encounter a ton of newly-dirtied pages
* (they were dirtied by commit). But that's OK - the blocks are
* safe in-journal, which is all fsync() needs to ensure.
*/
if (ext3_should_journal_data(inode)) {
ret = ext3_force_commit(inode->i_sb);
if (ext4_should_journal_data(inode)) {
ret = ext4_force_commit(inode->i_sb);
goto out;
}
......
/*
* linux/fs/ext3/hash.c
* linux/fs/ext4/hash.c
*
* Copyright (C) 2002 by Theodore Ts'o
*
......@@ -12,7 +12,7 @@
#include <linux/fs.h>
#include <linux/jbd.h>
#include <linux/sched.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_fs.h>
#include <linux/cryptohash.h>
#define DELTA 0x9E3779B9
......@@ -89,7 +89,7 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
* represented, and whether or not the returned hash is 32 bits or 64
* bits. 32 bit hashes will return 0 for the minor hash.
*/
int ext3fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
{
__u32 hash;
__u32 minor_hash = 0;
......@@ -144,8 +144,8 @@ int ext3fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
return -1;
}
hash = hash & ~1;
if (hash == (EXT3_HTREE_EOF << 1))
hash = (EXT3_HTREE_EOF-1) << 1;
if (hash == (EXT4_HTREE_EOF << 1))
hash = (EXT4_HTREE_EOF-1) << 1;
hinfo->hash = hash;
hinfo->minor_hash = minor_hash;
return 0;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* linux/fs/ext3/namei.h
/* linux/fs/ext4/namei.h
*
* Copyright (C) 2005 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
*/
extern struct dentry *ext3_get_parent(struct dentry *child);
extern struct dentry *ext4_get_parent(struct dentry *child);
This diff is collapsed.
This diff is collapsed.
/*
* linux/fs/ext3/symlink.c
* linux/fs/ext4/symlink.c
*
* Only fast symlinks left here - the rest is done by generic code. AV, 1999
*
......@@ -14,41 +14,41 @@
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* ext3 symlink handling code
* ext4 symlink handling code
*/
#include <linux/fs.h>
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_fs.h>
#include <linux/namei.h>
#include "xattr.h"
static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
static void * ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
struct ext4_inode_info *ei = EXT4_I(dentry->d_inode);
nd_set_link(nd, (char*)ei->i_data);
return NULL;
}
struct inode_operations ext3_symlink_inode_operations = {
struct inode_operations ext4_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = page_follow_link_light,
.put_link = page_put_link,
#ifdef CONFIG_EXT3_FS_XATTR
#ifdef CONFIG_EXT4DEV_FS_XATTR
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = ext3_listxattr,
.listxattr = ext4_listxattr,
.removexattr = generic_removexattr,
#endif
};
struct inode_operations ext3_fast_symlink_inode_operations = {
struct inode_operations ext4_fast_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = ext3_follow_link,
#ifdef CONFIG_EXT3_FS_XATTR
.follow_link = ext4_follow_link,
#ifdef CONFIG_EXT4DEV_FS_XATTR
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = ext3_listxattr,
.listxattr = ext4_listxattr,
.removexattr = generic_removexattr,
#endif
};
This diff is collapsed.
/*
File: fs/ext3/xattr.h
File: fs/ext4/xattr.h
On-disk format of extended attributes for the ext3 filesystem.
On-disk format of extended attributes for the ext4 filesystem.
(C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
......@@ -9,20 +9,20 @@
#include <linux/xattr.h>
/* Magic value in attribute blocks */
#define EXT3_XATTR_MAGIC 0xEA020000
#define EXT4_XATTR_MAGIC 0xEA020000
/* Maximum number of references to one attribute block */
#define EXT3_XATTR_REFCOUNT_MAX 1024
#define EXT4_XATTR_REFCOUNT_MAX 1024
/* Name indexes */
#define EXT3_XATTR_INDEX_USER 1
#define EXT3_XATTR_INDEX_POSIX_ACL_ACCESS 2
#define EXT3_XATTR_INDEX_POSIX_ACL_DEFAULT 3
#define EXT3_XATTR_INDEX_TRUSTED 4
#define EXT3_XATTR_INDEX_LUSTRE 5
#define EXT3_XATTR_INDEX_SECURITY 6
struct ext3_xattr_header {
#define EXT4_XATTR_INDEX_USER 1
#define EXT4_XATTR_INDEX_POSIX_ACL_ACCESS 2
#define EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT 3
#define EXT4_XATTR_INDEX_TRUSTED 4
#define EXT4_XATTR_INDEX_LUSTRE 5
#define EXT4_XATTR_INDEX_SECURITY 6
struct ext4_xattr_header {
__le32 h_magic; /* magic number for identification */
__le32 h_refcount; /* reference count */
__le32 h_blocks; /* number of disk blocks used */
......@@ -30,11 +30,11 @@ struct ext3_xattr_header {
__u32 h_reserved[4]; /* zero right now */
};
struct ext3_xattr_ibody_header {
struct ext4_xattr_ibody_header {
__le32 h_magic; /* magic number for identification */
};
struct ext3_xattr_entry {
struct ext4_xattr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* attribute name index */
__le16 e_value_offs; /* offset in disk block of value */
......@@ -44,100 +44,100 @@ struct ext3_xattr_entry {
char e_name[0]; /* attribute name */
};
#define EXT3_XATTR_PAD_BITS 2
#define EXT3_XATTR_PAD (1<<EXT3_XATTR_PAD_BITS)
#define EXT3_XATTR_ROUND (EXT3_XATTR_PAD-1)
#define EXT3_XATTR_LEN(name_len) \
(((name_len) + EXT3_XATTR_ROUND + \
sizeof(struct ext3_xattr_entry)) & ~EXT3_XATTR_ROUND)
#define EXT3_XATTR_NEXT(entry) \
( (struct ext3_xattr_entry *)( \
(char *)(entry) + EXT3_XATTR_LEN((entry)->e_name_len)) )
#define EXT3_XATTR_SIZE(size) \
(((size) + EXT3_XATTR_ROUND) & ~EXT3_XATTR_ROUND)
#define EXT4_XATTR_PAD_BITS 2
#define EXT4_XATTR_PAD (1<<EXT4_XATTR_PAD_BITS)
#define EXT4_XATTR_ROUND (EXT4_XATTR_PAD-1)
#define EXT4_XATTR_LEN(name_len) \
(((name_len) + EXT4_XATTR_ROUND + \
sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND)
#define EXT4_XATTR_NEXT(entry) \
( (struct ext4_xattr_entry *)( \
(char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)) )
#define EXT4_XATTR_SIZE(size) \
(((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
# ifdef CONFIG_EXT3_FS_XATTR
# ifdef CONFIG_EXT4DEV_FS_XATTR
extern struct xattr_handler ext3_xattr_user_handler;
extern struct xattr_handler ext3_xattr_trusted_handler;
extern struct xattr_handler ext3_xattr_acl_access_handler;
extern struct xattr_handler ext3_xattr_acl_default_handler;
extern struct xattr_handler ext3_xattr_security_handler;
extern struct xattr_handler ext4_xattr_user_handler;
extern struct xattr_handler ext4_xattr_trusted_handler;
extern struct xattr_handler ext4_xattr_acl_access_handler;
extern struct xattr_handler ext4_xattr_acl_default_handler;
extern struct xattr_handler ext4_xattr_security_handler;
extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
extern ssize_t ext4_listxattr(struct dentry *, char *, size_t);
extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
extern int ext3_xattr_list(struct inode *, char *, size_t);
extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
extern int ext4_xattr_get(struct inode *, int, const char *, void *, size_t);
extern int ext4_xattr_list(struct inode *, char *, size_t);
extern int ext4_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
extern int ext4_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
extern void ext3_xattr_put_super(struct super_block *);
extern void ext4_xattr_delete_inode(handle_t *, struct inode *);
extern void ext4_xattr_put_super(struct super_block *);
extern int init_ext3_xattr(void);
extern void exit_ext3_xattr(void);
extern int init_ext4_xattr(void);
extern void exit_ext4_xattr(void);
extern struct xattr_handler *ext3_xattr_handlers[];
extern struct xattr_handler *ext4_xattr_handlers[];
# else /* CONFIG_EXT3_FS_XATTR */
# else /* CONFIG_EXT4DEV_FS_XATTR */
static inline int
ext3_xattr_get(struct inode *inode, int name_index, const char *name,
ext4_xattr_get(struct inode *inode, int name_index, const char *name,
void *buffer, size_t size, int flags)
{
return -EOPNOTSUPP;
}
static inline int
ext3_xattr_list(struct inode *inode, void *buffer, size_t size)
ext4_xattr_list(struct inode *inode, void *buffer, size_t size)
{
return -EOPNOTSUPP;
}
static inline int
ext3_xattr_set(struct inode *inode, int name_index, const char *name,
ext4_xattr_set(struct inode *inode, int name_index, const char *name,
const void *value, size_t size, int flags)
{
return -EOPNOTSUPP;
}
static inline int
ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
const char *name, const void *value, size_t size, int flags)
{
return -EOPNOTSUPP;
}
static inline void
ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
{
}
static inline void
ext3_xattr_put_super(struct super_block *sb)
ext4_xattr_put_super(struct super_block *sb)
{
}
static inline int
init_ext3_xattr(void)
init_ext4_xattr(void)
{
return 0;
}
static inline void
exit_ext3_xattr(void)
exit_ext4_xattr(void)
{
}
#define ext3_xattr_handlers NULL
#define ext4_xattr_handlers NULL
# endif /* CONFIG_EXT3_FS_XATTR */
# endif /* CONFIG_EXT4DEV_FS_XATTR */
#ifdef CONFIG_EXT3_FS_SECURITY
extern int ext3_init_security(handle_t *handle, struct inode *inode,
#ifdef CONFIG_EXT4DEV_FS_SECURITY
extern int ext4_init_security(handle_t *handle, struct inode *inode,
struct inode *dir);
#else
static inline int ext3_init_security(handle_t *handle, struct inode *inode,
static inline int ext4_init_security(handle_t *handle, struct inode *inode,
struct inode *dir)
{
return 0;
......
/*
* linux/fs/ext3/xattr_security.c
* linux/fs/ext4/xattr_security.c
* Handler for storing security labels as extended attributes.
*/
......@@ -7,13 +7,13 @@
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include <linux/ext3_jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_jbd.h>
#include <linux/ext4_fs.h>
#include <linux/security.h>
#include "xattr.h"
static size_t
ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size,
ext4_xattr_security_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
......@@ -29,27 +29,27 @@ ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size,
}
static int
ext3_xattr_security_get(struct inode *inode, const char *name,
ext4_xattr_security_get(struct inode *inode, const char *name,
void *buffer, size_t size)
{
if (strcmp(name, "") == 0)
return -EINVAL;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY, name,
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY, name,
buffer, size);
}
static int
ext3_xattr_security_set(struct inode *inode, const char *name,
ext4_xattr_security_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
if (strcmp(name, "") == 0)
return -EINVAL;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY, name,
return ext4_xattr_set(inode, EXT4_XATTR_INDEX_SECURITY, name,
value, size, flags);
}
int
ext3_init_security(handle_t *handle, struct inode *inode, struct inode *dir)
ext4_init_security(handle_t *handle, struct inode *inode, struct inode *dir)
{
int err;
size_t len;
......@@ -62,16 +62,16 @@ ext3_init_security(handle_t *handle, struct inode *inode, struct inode *dir)
return 0;
return err;
}
err = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_SECURITY,
err = ext4_xattr_set_handle(handle, inode, EXT4_XATTR_INDEX_SECURITY,
name, value, len, 0);
kfree(name);
kfree(value);
return err;
}
struct xattr_handler ext3_xattr_security_handler = {
struct xattr_handler ext4_xattr_security_handler = {
.prefix = XATTR_SECURITY_PREFIX,
.list = ext3_xattr_security_list,
.get = ext3_xattr_security_get,
.set = ext3_xattr_security_set,
.list = ext4_xattr_security_list,
.get = ext4_xattr_security_get,
.set = ext4_xattr_security_set,
};
/*
* linux/fs/ext3/xattr_trusted.c
* linux/fs/ext4/xattr_trusted.c
* Handler for trusted extended attributes.
*
* Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
......@@ -10,14 +10,14 @@
#include <linux/capability.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include <linux/ext3_jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_jbd.h>
#include <linux/ext4_fs.h>
#include "xattr.h"
#define XATTR_TRUSTED_PREFIX "trusted."
static size_t
ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
const size_t prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
......@@ -35,28 +35,28 @@ ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
}
static int
ext3_xattr_trusted_get(struct inode *inode, const char *name,
ext4_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size)
{
if (strcmp(name, "") == 0)
return -EINVAL;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED, name,
buffer, size);
}
static int
ext3_xattr_trusted_set(struct inode *inode, const char *name,
ext4_xattr_trusted_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
if (strcmp(name, "") == 0)
return -EINVAL;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
return ext4_xattr_set(inode, EXT4_XATTR_INDEX_TRUSTED, name,
value, size, flags);
}
struct xattr_handler ext3_xattr_trusted_handler = {
struct xattr_handler ext4_xattr_trusted_handler = {
.prefix = XATTR_TRUSTED_PREFIX,
.list = ext3_xattr_trusted_list,
.get = ext3_xattr_trusted_get,
.set = ext3_xattr_trusted_set,
.list = ext4_xattr_trusted_list,
.get = ext4_xattr_trusted_get,
.set = ext4_xattr_trusted_set,
};
/*
* linux/fs/ext3/xattr_user.c
* linux/fs/ext4/xattr_user.c
* Handler for extended user attributes.
*
* Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
......@@ -9,14 +9,14 @@
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include <linux/ext3_jbd.h>
#include <linux/ext3_fs.h>
#include <linux/ext4_jbd.h>
#include <linux/ext4_fs.h>
#include "xattr.h"
#define XATTR_USER_PREFIX "user."
static size_t
ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size,
ext4_xattr_user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
const size_t prefix_len = sizeof(XATTR_USER_PREFIX)-1;
......@@ -34,31 +34,31 @@ ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size,
}
static int
ext3_xattr_user_get(struct inode *inode, const char *name,
ext4_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size)
{
if (strcmp(name, "") == 0)
return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER, name, buffer, size);
}
static int
ext3_xattr_user_set(struct inode *inode, const char *name,
ext4_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
if (strcmp(name, "") == 0)
return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER, name,
value, size, flags);
}
struct xattr_handler ext3_xattr_user_handler = {
struct xattr_handler ext4_xattr_user_handler = {
.prefix = XATTR_USER_PREFIX,
.list = ext3_xattr_user_list,
.get = ext3_xattr_user_get,
.set = ext3_xattr_user_set,
.list = ext4_xattr_user_list,
.get = ext4_xattr_user_get,
.set = ext4_xattr_user_set,
};
This diff is collapsed.
/*
* linux/include/linux/ext3_fs_i.h
* linux/include/linux/ext4_fs_i.h
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
......@@ -13,8 +13,8 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _LINUX_EXT3_FS_I
#define _LINUX_EXT3_FS_I
#ifndef _LINUX_EXT4_FS_I
#define _LINUX_EXT4_FS_I
#include <linux/rwsem.h>
#include <linux/rbtree.h>
......@@ -22,43 +22,43 @@
#include <linux/mutex.h>
/* data type for block offset of block group */
typedef int ext3_grpblk_t;
typedef int ext4_grpblk_t;
/* data type for filesystem-wide blocks number */
typedef unsigned long ext3_fsblk_t;
typedef unsigned long ext4_fsblk_t;
#define E3FSBLK "%lu"
struct ext3_reserve_window {
ext3_fsblk_t _rsv_start; /* First byte reserved */
ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
struct ext4_reserve_window {
ext4_fsblk_t _rsv_start; /* First byte reserved */
ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
};
struct ext3_reserve_window_node {
struct ext4_reserve_window_node {
struct rb_node rsv_node;
__u32 rsv_goal_size;
__u32 rsv_alloc_hit;
struct ext3_reserve_window rsv_window;
struct ext4_reserve_window rsv_window;
};
struct ext3_block_alloc_info {
struct ext4_block_alloc_info {
/* information about reservation window */
struct ext3_reserve_window_node rsv_window_node;
struct ext4_reserve_window_node rsv_window_node;
/*
* was i_next_alloc_block in ext3_inode_info
* was i_next_alloc_block in ext4_inode_info
* is the logical (file-relative) number of the
* most-recently-allocated block in this file.
* We use this for detecting linearly ascending allocation requests.
*/
__u32 last_alloc_logical_block;
/*
* Was i_next_alloc_goal in ext3_inode_info
* Was i_next_alloc_goal in ext4_inode_info
* is the *physical* companion to i_next_alloc_block.
* it the the physical block number of the block which was most-recentl
* allocated to this file. This give us the goal (target) for the next
* allocation when we detect linearly ascending requests.
*/
ext3_fsblk_t last_alloc_physical_block;
ext4_fsblk_t last_alloc_physical_block;
};
#define rsv_start rsv_window._rsv_start
......@@ -67,15 +67,15 @@ struct ext3_block_alloc_info {
/*
* third extended file system inode data in memory
*/
struct ext3_inode_info {
struct ext4_inode_info {
__le32 i_data[15]; /* unconverted */
__u32 i_flags;
#ifdef EXT3_FRAGMENTS
#ifdef EXT4_FRAGMENTS
__u32 i_faddr;
__u8 i_frag_no;
__u8 i_frag_size;
#endif
ext3_fsblk_t i_file_acl;
ext4_fsblk_t i_file_acl;
__u32 i_dir_acl;
__u32 i_dtime;
......@@ -87,13 +87,13 @@ struct ext3_inode_info {
* near to their parent directory's inode.
*/
__u32 i_block_group;
__u32 i_state; /* Dynamic state flags for ext3 */
__u32 i_state; /* Dynamic state flags for ext4 */
/* block reservation info */
struct ext3_block_alloc_info *i_block_alloc_info;
struct ext4_block_alloc_info *i_block_alloc_info;
__u32 i_dir_start_lookup;
#ifdef CONFIG_EXT3_FS_XATTR
#ifdef CONFIG_EXT4DEV_FS_XATTR
/*
* Extended attributes can be read independently of the main file
* data. Taking i_mutex even when reading would cause contention
......@@ -103,7 +103,7 @@ struct ext3_inode_info {
*/
struct rw_semaphore xattr_sem;
#endif
#ifdef CONFIG_EXT3_FS_POSIX_ACL
#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;
#endif
......@@ -113,7 +113,7 @@ struct ext3_inode_info {
/*
* i_disksize keeps track of what the inode size is ON DISK, not
* in memory. During truncate, i_size is set to the new size by
* the VFS prior to calling ext3_truncate(), but the filesystem won't
* the VFS prior to calling ext4_truncate(), but the filesystem won't
* set i_disksize to 0 until the truncate is actually under way.
*
* The intent is that i_disksize always represents the blocks which
......@@ -123,7 +123,7 @@ struct ext3_inode_info {
*
* The only time when i_disksize and i_size may be different is when
* a truncate is in progress. The only things which change i_disksize
* are ext3_get_block (growth) and ext3_truncate (shrinkth).
* are ext4_get_block (growth) and ext4_truncate (shrinkth).
*/
loff_t i_disksize;
......@@ -131,10 +131,10 @@ struct ext3_inode_info {
__u16 i_extra_isize;
/*
* truncate_mutex is for serialising ext3_truncate() against
* ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
* truncate_mutex is for serialising ext4_truncate() against
* ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
* data tree are chopped off during truncate. We can't do that in
* ext3 because whenever we perform intermediate commits during
* ext4 because whenever we perform intermediate commits during
* truncate, the inode and all the metadata blocks *must* be in a
* consistent state which allows truncation of the orphans to restart
* during recovery. Hence we must fix the get_block-vs-truncate race
......@@ -144,4 +144,4 @@ struct ext3_inode_info {
struct inode vfs_inode;
};
#endif /* _LINUX_EXT3_FS_I */
#endif /* _LINUX_EXT4_FS_I */
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment