Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Last active August 29, 2015 14:16
Show Gist options
  • Save invisiblek/66ba0000d0e6cb9a281f to your computer and use it in GitHub Desktop.
Save invisiblek/66ba0000d0e6cb9a281f to your computer and use it in GitHub Desktop.
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b736db..b9cdb6df 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1156,19 +1156,6 @@ struct ext4_sb_info {
ext4_fsblk_t s_sb_block;
uid_t s_resuid;
gid_t s_resgid;
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- uid_t s_uid; /* make all files appear to belong to this uid */
- uid_t s_diskuid; /* write this uid to disk (if s_uid != 0) */
- gid_t s_gid; /* make all files appear to belong to this gid */
- gid_t s_diskgid; /* write this gid to disk (if s_gid != 0) */
- unsigned short fs_fmask;
- unsigned short fs_dmask;
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- unsigned short s_ignore_case;
-#endif /* VENDOR_EDIT */
unsigned short s_mount_state;
unsigned short s_pad;
int s_addr_per_block_bits;
@@ -2368,42 +2355,6 @@ static inline void set_bitmap_uptodate(struct buffer_head *bh)
#define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
-static inline umode_t ext4_make_mode(struct ext4_sb_info *ei, umode_t i_mode)
-{
- umode_t mode;
- if (S_ISDIR(i_mode) || (i_mode == 0))
- {
- mode = (S_IRWXUGO & ~ei->fs_dmask) | S_IFDIR;
- }
- else
- {
- mode = (S_IRWXUGO & ~ei->fs_fmask) | S_IFREG;
- }
- return mode;
-}
-static inline void ext4_fill_inode(struct super_block *sb, struct inode *inode)
-{
- if (EXT4_SB(sb)->fs_fmask || EXT4_SB(sb)->fs_dmask) {
- inode->i_mode = ext4_make_mode(EXT4_SB(sb), inode->i_mode);
- }
- if (EXT4_SB(sb)->s_uid) {
- inode->i_uid = EXT4_SB(sb)->s_uid;
- }
- if (EXT4_SB(sb)->s_gid) {
- inode->i_gid = EXT4_SB(sb)->s_gid;
- }
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- if (EXT4_SB(sb)->s_ignore_case) {
- inode->i_ignore_case = EXT4_SB(sb)->s_ignore_case;
- }
-#endif /* VENDOR_EDIT */
- return;
-}
-#endif /* VENDOR_EDIT */
-
/* For ioend & aio unwritten conversion wait queues */
#define EXT4_WQ_HASH_SZ 37
#define ext4_ioend_wq(v) (&ext4__ioend_wq[((unsigned long)(v)) %\
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 5b95e18..4296a6f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2111,7 +2111,7 @@ static int
ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block,
struct ext4_extent *ex)
{
- struct ext4_ext_cache cex = {0, 0, 0};
+ struct ext4_ext_cache cex;
int ret = 0;
if (ext4_ext_check_cache(inode, block, &cex)) {
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9ae0f53..9e9db42 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3688,10 +3688,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
}
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- ext4_fill_inode(sb, inode);
-#endif /* VENDOR_EDIT */
set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */
@@ -3926,10 +3922,6 @@ static int ext4_do_update_inode(handle_t *handle,
memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
ext4_get_inode_flags(ei);
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- ext4_fill_inode(inode->i_sb, inode);
-#endif /* VENDOR_EDIT */
raw_inode->i_mode = cpu_to_le16(inode->i_mode);
if (!(test_opt(inode->i_sb, NO_UID32))) {
raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 14dbf05..dc58523 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -36,10 +36,6 @@
#include <linux/bio.h>
#include "ext4.h"
#include "ext4_jbd2.h"
-#ifdef VENDOR_EDIT
-//[email protected], 2014/03/07, Add for support ignore case, so the CTS can pass
-#include <linux/ctype.h>
-#endif /* VENDOR_EDIT */
#include "xattr.h"
#include "acl.h"
@@ -252,22 +248,6 @@ static inline unsigned dx_node_limit(struct inode *dir)
return entry_space / sizeof(struct dx_entry);
}
-#ifdef VENDOR_EDIT
-//[email protected], 2014/03/07, Add for support ignore case, so the CTS can pass
-int memcmp_ignore_case(const unsigned char* cs,const unsigned char* ct,int len)
-{
- const unsigned char* ax = cs;
- const unsigned char* bx = ct;
-
- int i;
- for(i=0;i<len;i++){
- if(toupper(*ax)!=toupper(*bx)) return 1;
- ax++;bx++;
- }
- return 0;
-}
-#endif /* VENDOR_EDIT */
-
/*
* Debug
*/
@@ -814,19 +794,6 @@ static inline int ext4_match (int len, const char * const name,
return !memcmp(name, de->name, len);
}
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
-static inline int ext4_match_ignore_case (int len, const char * const name,
- struct ext4_dir_entry_2 * de)
-{
- if (len != de->name_len)
- return 0;
- if (!de->inode)
- return 0;
- return !memcmp_ignore_case(name, de->name, len);
-}
-#endif /* VENDOR_EDIT */
-
/*
* Returns 0 if not found, -1 on failure, and 1 on success
*/
@@ -848,15 +815,8 @@ static inline int search_dirblock(struct buffer_head *bh,
/* this code is executed quadratically often */
/* do minimal checking `by hand' */
-#ifndef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
if ((char *) de + namelen <= dlimit &&
ext4_match (namelen, name, de)) {
-#else /* VENDOR_EDIT */
- if ((char *) de + namelen <= dlimit &&
- ((dir->i_ignore_case == 1) ? ext4_match_ignore_case(namelen, name, de): ext4_match(namelen, name, de))) {
-
-#endif /* VENDOR_EDIT */
/* found a match - just to be sure, do a full check */
if (ext4_check_dir_entry(dir, NULL, de, bh, offset))
return -1;
@@ -1325,12 +1285,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
while ((char *) de <= top) {
if (ext4_check_dir_entry(dir, NULL, de, bh, offset))
return -EIO;
-#ifndef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
if (ext4_match(namelen, name, de))
-#else /* VENDOR_EDIT */
- if ( (dir->i_ignore_case == 1) ? ext4_match_ignore_case(namelen, name, de) : ext4_match(namelen, name, de))
-#endif /* VENDOR_EDIT */
return -EEXIST;
nlen = EXT4_DIR_REC_LEN(de->name_len);
rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
@@ -1824,10 +1779,6 @@ retry:
ext4_handle_sync(handle);
inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0, NULL);
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- ext4_fill_inode(dir->i_sb, inode);
-#endif /* VENDOR_EDIT */
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
inode->i_op = &ext4_file_inode_operations;
@@ -1902,10 +1853,6 @@ retry:
inode = ext4_new_inode(handle, dir, S_IFDIR | mode,
&dentry->d_name, 0, NULL);
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- ext4_fill_inode(dir->i_sb, inode);
-#endif /* VENDOR_EDIT */
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_stop;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 511ce69..cfd3211 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1152,7 +1152,7 @@ static void ext4_update_super(struct super_block *sb,
struct ext4_new_group_data *group_data = flex_gd->groups;
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_super_block *es = sbi->s_es;
- int i;
+ int i, ret;
BUG_ON(flex_gd->count == 0 || group_data == NULL);
/*
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 856602f..92ea560 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -43,7 +43,6 @@
#include <linux/kthread.h>
#include <linux/freezer.h>
-#include <linux/ratelimit.h>
#include "ext4.h"
#include "ext4_extents.h"
@@ -672,7 +671,7 @@ void ext4_msg(struct super_block *sb, const char *prefix, const char *fmt, ...)
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
- printk_ratelimited("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
+ printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
va_end(args);
}
@@ -1192,14 +1191,6 @@ enum {
Opt_inode_readahead_blks, Opt_journal_ioprio,
Opt_dioread_nolock, Opt_dioread_lock,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- Opt_uid, Opt_diskuid, Opt_gid, Opt_diskgid,Opt_fmask, Opt_dmask,
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- Opt_ignore_case,
-#endif /* VENDOR_EDIT */
};
static const match_table_t tokens = {
@@ -1278,19 +1269,6 @@ static const match_table_t tokens = {
{Opt_removed, "reservation"}, /* mount option from ext2/3 */
{Opt_removed, "noreservation"}, /* mount option from ext2/3 */
{Opt_removed, "journal=%u"}, /* mount option from ext2/3 */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- {Opt_uid, "uid=%u"},
- {Opt_diskuid, "uid=%u:%u"},
- {Opt_gid, "gid=%u"},
- {Opt_diskgid, "gid=%u:%u"},
- {Opt_dmask, "dmask=%o"},
- {Opt_fmask, "fmask=%o"},
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- {Opt_ignore_case, "ignore_case=%o"},
-#endif /* VENDOR_EDIT */
{Opt_err, NULL},
};
@@ -1487,21 +1465,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
else if (token == Opt_offgrpjquota)
return clear_qf_name(sb, GRPQUOTA);
#endif
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- if (token == Opt_dmask) {
- if (args->from && match_octal(args, &arg))
- return -1;
- sbi->fs_dmask = arg;
- return 1;
- }
- if (token == Opt_fmask) {
- if (args->from && match_octal(args, &arg))
- return -1;
- sbi->fs_fmask = arg;
- return 1;
- }
-#endif /* VENDOR_EDIT */
if (args->from && match_int(args, &arg))
return -1;
switch (token) {
@@ -1540,23 +1503,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
return -1;
*journal_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
return 1;
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- /*FIXME: how to deal with case Opt_diskuid and Opt_diskgid */
- case Opt_uid:
- sbi->s_uid = sbi->s_diskuid = arg;
- return 1;
- case Opt_gid:
- sbi->s_gid = sbi->s_diskgid = arg;
- return 1;
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- case Opt_ignore_case:
- sbi->s_ignore_case = arg;
- return 1;
-#endif /* VENDOR_EDIT */
-
}
for (m = ext4_mount_opts; m->token != Opt_err; m++) {
@@ -4402,20 +4348,6 @@ struct ext4_mount_options {
unsigned long s_mount_opt2;
uid_t s_resuid;
gid_t s_resgid;
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- uid_t s_uid;
- uid_t s_diskuid;
- gid_t s_gid;
- gid_t s_diskgid;
- unsigned short fs_fmask;
- unsigned short fs_dmask;
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- unsigned short s_ignore_case;
-#endif /* VENDOR_EDIT */
-
unsigned long s_commit_interval;
u32 s_min_batch_time, s_max_batch_time;
#ifdef CONFIG_QUOTA
@@ -4446,19 +4378,6 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
old_opts.s_mount_opt2 = sbi->s_mount_opt2;
old_opts.s_resuid = sbi->s_resuid;
old_opts.s_resgid = sbi->s_resgid;
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- old_opts.s_uid = sbi->s_uid;
- old_opts.s_diskuid = sbi->s_diskuid;
- old_opts.s_gid = sbi->s_gid;
- old_opts.s_diskgid = sbi->s_diskgid;
- old_opts.fs_fmask = sbi->fs_fmask;
- old_opts.fs_dmask = sbi->fs_dmask;
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- old_opts.s_ignore_case = sbi->s_ignore_case;
-#endif /* VENDOR_EDIT */
old_opts.s_commit_interval = sbi->s_commit_interval;
old_opts.s_min_batch_time = sbi->s_min_batch_time;
old_opts.s_max_batch_time = sbi->s_max_batch_time;
@@ -4631,20 +4550,6 @@ restore_opts:
sbi->s_mount_opt2 = old_opts.s_mount_opt2;
sbi->s_resuid = old_opts.s_resuid;
sbi->s_resgid = old_opts.s_resgid;
-#ifdef VENDOR_EDIT
-//[email protected], 2014/1/23, Add for support to set uid, gid, fmask, dmask
- sbi->s_uid = old_opts.s_uid;
- sbi->s_diskuid = old_opts.s_diskuid;
- sbi->s_gid = old_opts.s_gid;
- sbi->s_diskgid = old_opts.s_diskgid;
- sbi->fs_fmask = old_opts.fs_fmask;
- sbi->fs_dmask = old_opts.fs_dmask;
-#endif /* VENDOR_EDIT */
-#ifdef VENDOR_EDIT
-//[email protected], 2014/06/04, Add for ignore case
- sbi->s_ignore_case = old_opts.s_ignore_case;
-#endif /* VENDOR_EDIT */
-
sbi->s_commit_interval = old_opts.s_commit_interval;
sbi->s_min_batch_time = old_opts.s_min_batch_time;
sbi->s_max_batch_time = old_opts.s_max_batch_time;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment