You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton: - a pile of minor fs fixes and cleanups - kexec updates - random misc fixes in various places: vmcore, rbtree, eventfd, ipc, seccomp. - a series of python-based kgdb helper scripts * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (58 commits) seccomp: cap SECCOMP_RET_ERRNO data to MAX_ERRNO samples/seccomp: improve label helper ipc,sem: use current->state helpers scripts/gdb: disable pagination while printing from breakpoint handler scripts/gdb: define maintainer scripts/gdb: convert CpuList to generator function scripts/gdb: convert ModuleList to generator function scripts/gdb: use a generator instead of iterator for task list scripts/gdb: ignore byte-compiled python files scripts/gdb: port to python3 / gdb7.7 scripts/gdb: add basic documentation scripts/gdb: add lx-lsmod command scripts/gdb: add class to iterate over CPU masks scripts/gdb: add lx_current convenience function scripts/gdb: add internal helper and convenience function for per-cpu lookup scripts/gdb: add get_gdbserver_type helper scripts/gdb: add internal helper and convenience function to retrieve thread_info scripts/gdb: add is_target_arch helper scripts/gdb: add helper and convenience function to look up tasks scripts/gdb: add task iteration class ...
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#define AFFS_AC_SIZE (AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
|
||||
#define AFFS_AC_MASK (AFFS_AC_SIZE-1)
|
||||
|
||||
#define AFFSNAMEMAX 30U
|
||||
|
||||
struct affs_ext_key {
|
||||
u32 ext; /* idx of the extended block */
|
||||
u32 key; /* block number */
|
||||
|
||||
+6
-7
@@ -30,7 +30,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
|
||||
ino = bh->b_blocknr;
|
||||
offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]);
|
||||
|
||||
pr_debug("%s(dir=%u, ino=%d)\n", __func__, (u32)dir->i_ino, ino);
|
||||
pr_debug("%s(dir=%lu, ino=%d)\n", __func__, dir->i_ino, ino);
|
||||
|
||||
dir_bh = affs_bread(sb, dir->i_ino);
|
||||
if (!dir_bh)
|
||||
@@ -80,8 +80,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
|
||||
sb = dir->i_sb;
|
||||
rem_ino = rem_bh->b_blocknr;
|
||||
offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]);
|
||||
pr_debug("%s(dir=%d, ino=%d, hashval=%d)\n",
|
||||
__func__, (u32)dir->i_ino, rem_ino, offset);
|
||||
pr_debug("%s(dir=%lu, ino=%d, hashval=%d)\n", __func__, dir->i_ino,
|
||||
rem_ino, offset);
|
||||
|
||||
bh = affs_bread(sb, dir->i_ino);
|
||||
if (!bh)
|
||||
@@ -483,11 +483,10 @@ affs_check_name(const unsigned char *name, int len, bool notruncate)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (len > 30) {
|
||||
if (len > AFFSNAMEMAX) {
|
||||
if (notruncate)
|
||||
return -ENAMETOOLONG;
|
||||
else
|
||||
len = 30;
|
||||
len = AFFSNAMEMAX;
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
if (name[i] < ' ' || name[i] == ':'
|
||||
@@ -508,7 +507,7 @@ affs_check_name(const unsigned char *name, int len, bool notruncate)
|
||||
int
|
||||
affs_copy_name(unsigned char *bstr, struct dentry *dentry)
|
||||
{
|
||||
int len = min(dentry->d_name.len, 30u);
|
||||
u32 len = min(dentry->d_name.len, AFFSNAMEMAX);
|
||||
|
||||
*bstr++ = len;
|
||||
memcpy(bstr, dentry->d_name.name, len);
|
||||
|
||||
@@ -99,7 +99,6 @@ err_bh_read:
|
||||
|
||||
err_range:
|
||||
affs_error(sb, "affs_free_block","Block %u outside partition", block);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+5
-6
@@ -54,8 +54,7 @@ affs_readdir(struct file *file, struct dir_context *ctx)
|
||||
u32 ino;
|
||||
int error = 0;
|
||||
|
||||
pr_debug("%s(ino=%lu,f_pos=%lx)\n",
|
||||
__func__, inode->i_ino, (unsigned long)ctx->pos);
|
||||
pr_debug("%s(ino=%lu,f_pos=%llx)\n", __func__, inode->i_ino, ctx->pos);
|
||||
|
||||
if (ctx->pos < 2) {
|
||||
file->private_data = (void *)0;
|
||||
@@ -115,11 +114,11 @@ inside:
|
||||
break;
|
||||
}
|
||||
|
||||
namelen = min(AFFS_TAIL(sb, fh_bh)->name[0], (u8)30);
|
||||
namelen = min(AFFS_TAIL(sb, fh_bh)->name[0],
|
||||
(u8)AFFSNAMEMAX);
|
||||
name = AFFS_TAIL(sb, fh_bh)->name + 1;
|
||||
pr_debug("readdir(): dir_emit(\"%.*s\", "
|
||||
"ino=%u), hash=%d, f_pos=%x\n",
|
||||
namelen, name, ino, hash_pos, (u32)ctx->pos);
|
||||
pr_debug("readdir(): dir_emit(\"%.*s\", ino=%u), hash=%d, f_pos=%llx\n",
|
||||
namelen, name, ino, hash_pos, ctx->pos);
|
||||
|
||||
if (!dir_emit(ctx, name, namelen, ino, DT_UNKNOWN))
|
||||
goto done;
|
||||
|
||||
+27
-22
@@ -180,8 +180,7 @@ affs_get_extblock_slow(struct inode *inode, u32 ext)
|
||||
ext_key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension);
|
||||
if (ext < AFFS_I(inode)->i_extcnt)
|
||||
goto read_ext;
|
||||
if (ext > AFFS_I(inode)->i_extcnt)
|
||||
BUG();
|
||||
BUG_ON(ext > AFFS_I(inode)->i_extcnt);
|
||||
bh = affs_alloc_extblock(inode, bh, ext);
|
||||
if (IS_ERR(bh))
|
||||
return bh;
|
||||
@@ -198,8 +197,7 @@ affs_get_extblock_slow(struct inode *inode, u32 ext)
|
||||
struct buffer_head *prev_bh;
|
||||
|
||||
/* allocate a new extended block */
|
||||
if (ext > AFFS_I(inode)->i_extcnt)
|
||||
BUG();
|
||||
BUG_ON(ext > AFFS_I(inode)->i_extcnt);
|
||||
|
||||
/* get previous extended block */
|
||||
prev_bh = affs_get_extblock(inode, ext - 1);
|
||||
@@ -299,8 +297,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
||||
struct buffer_head *ext_bh;
|
||||
u32 ext;
|
||||
|
||||
pr_debug("%s(%u, %lu)\n",
|
||||
__func__, (u32)inode->i_ino, (unsigned long)block);
|
||||
pr_debug("%s(%lu, %llu)\n", __func__, inode->i_ino,
|
||||
(unsigned long long)block);
|
||||
|
||||
BUG_ON(block > (sector_t)0x7fffffffUL);
|
||||
|
||||
@@ -330,8 +328,9 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
||||
|
||||
/* store new block */
|
||||
if (bh_result->b_blocknr)
|
||||
affs_warning(sb, "get_block", "block already set (%lx)",
|
||||
(unsigned long)bh_result->b_blocknr);
|
||||
affs_warning(sb, "get_block",
|
||||
"block already set (%llx)",
|
||||
(unsigned long long)bh_result->b_blocknr);
|
||||
AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr);
|
||||
AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1);
|
||||
affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1);
|
||||
@@ -353,8 +352,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
||||
return 0;
|
||||
|
||||
err_big:
|
||||
affs_error(inode->i_sb, "get_block", "strange block request %d",
|
||||
(int)block);
|
||||
affs_error(inode->i_sb, "get_block", "strange block request %llu",
|
||||
(unsigned long long)block);
|
||||
return -EIO;
|
||||
err_ext:
|
||||
// unlock cache
|
||||
@@ -399,6 +398,13 @@ affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
|
||||
size_t count = iov_iter_count(iter);
|
||||
ssize_t ret;
|
||||
|
||||
if (rw == WRITE) {
|
||||
loff_t size = offset + count;
|
||||
|
||||
if (AFFS_I(inode)->mmu_private < size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
|
||||
if (ret < 0 && (rw & WRITE))
|
||||
affs_write_failed(mapping, offset + count);
|
||||
@@ -503,7 +509,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
|
||||
u32 bidx, boff, bsize;
|
||||
u32 tmp;
|
||||
|
||||
pr_debug("%s(%u, %ld, 0, %d)\n", __func__, (u32)inode->i_ino,
|
||||
pr_debug("%s(%lu, %ld, 0, %d)\n", __func__, inode->i_ino,
|
||||
page->index, to);
|
||||
BUG_ON(to > PAGE_CACHE_SIZE);
|
||||
kmap(page);
|
||||
@@ -539,7 +545,7 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize)
|
||||
u32 size, bsize;
|
||||
u32 tmp;
|
||||
|
||||
pr_debug("%s(%u, %d)\n", __func__, (u32)inode->i_ino, newsize);
|
||||
pr_debug("%s(%lu, %d)\n", __func__, inode->i_ino, newsize);
|
||||
bsize = AFFS_SB(sb)->s_data_blksize;
|
||||
bh = NULL;
|
||||
size = AFFS_I(inode)->mmu_private;
|
||||
@@ -608,7 +614,7 @@ affs_readpage_ofs(struct file *file, struct page *page)
|
||||
u32 to;
|
||||
int err;
|
||||
|
||||
pr_debug("%s(%u, %ld)\n", __func__, (u32)inode->i_ino, page->index);
|
||||
pr_debug("%s(%lu, %ld)\n", __func__, inode->i_ino, page->index);
|
||||
to = PAGE_CACHE_SIZE;
|
||||
if (((page->index + 1) << PAGE_CACHE_SHIFT) > inode->i_size) {
|
||||
to = inode->i_size & ~PAGE_CACHE_MASK;
|
||||
@@ -631,8 +637,8 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
|
||||
pgoff_t index;
|
||||
int err = 0;
|
||||
|
||||
pr_debug("%s(%u, %llu, %llu)\n", __func__, (u32)inode->i_ino,
|
||||
(unsigned long long)pos, (unsigned long long)pos + len);
|
||||
pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos,
|
||||
pos + len);
|
||||
if (pos > AFFS_I(inode)->mmu_private) {
|
||||
/* XXX: this probably leaves a too-big i_size in case of
|
||||
* failure. Should really be updating i_size at write_end time
|
||||
@@ -681,9 +687,8 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
|
||||
* due to write_begin.
|
||||
*/
|
||||
|
||||
pr_debug("%s(%u, %llu, %llu)\n",
|
||||
__func__, (u32)inode->i_ino, (unsigned long long)pos,
|
||||
(unsigned long long)pos + len);
|
||||
pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos,
|
||||
pos + len);
|
||||
bsize = AFFS_SB(sb)->s_data_blksize;
|
||||
data = page_address(page);
|
||||
|
||||
@@ -831,8 +836,8 @@ affs_truncate(struct inode *inode)
|
||||
struct buffer_head *ext_bh;
|
||||
int i;
|
||||
|
||||
pr_debug("truncate(inode=%d, oldsize=%u, newsize=%u)\n",
|
||||
(u32)inode->i_ino, (u32)AFFS_I(inode)->mmu_private, (u32)inode->i_size);
|
||||
pr_debug("truncate(inode=%lu, oldsize=%llu, newsize=%llu)\n",
|
||||
inode->i_ino, AFFS_I(inode)->mmu_private, inode->i_size);
|
||||
|
||||
last_blk = 0;
|
||||
ext = 0;
|
||||
@@ -863,7 +868,7 @@ affs_truncate(struct inode *inode)
|
||||
if (IS_ERR(ext_bh)) {
|
||||
affs_warning(sb, "truncate",
|
||||
"unexpected read error for ext block %u (%ld)",
|
||||
(unsigned int)ext, PTR_ERR(ext_bh));
|
||||
ext, PTR_ERR(ext_bh));
|
||||
return;
|
||||
}
|
||||
if (AFFS_I(inode)->i_lc) {
|
||||
@@ -911,7 +916,7 @@ affs_truncate(struct inode *inode)
|
||||
if (IS_ERR(bh)) {
|
||||
affs_warning(sb, "truncate",
|
||||
"unexpected read error for last block %u (%ld)",
|
||||
(unsigned int)ext, PTR_ERR(bh));
|
||||
ext, PTR_ERR(bh));
|
||||
return;
|
||||
}
|
||||
tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next);
|
||||
|
||||
+2
-5
@@ -13,8 +13,6 @@
|
||||
#include <linux/gfp.h>
|
||||
#include "affs.h"
|
||||
|
||||
extern const struct inode_operations affs_symlink_inode_operations;
|
||||
|
||||
struct inode *affs_iget(struct super_block *sb, unsigned long ino)
|
||||
{
|
||||
struct affs_sb_info *sbi = AFFS_SB(sb);
|
||||
@@ -348,9 +346,8 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3
|
||||
u32 block = 0;
|
||||
int retval;
|
||||
|
||||
pr_debug("%s(dir=%u, inode=%u, \"%pd\", type=%d)\n",
|
||||
__func__, (u32)dir->i_ino,
|
||||
(u32)inode->i_ino, dentry, type);
|
||||
pr_debug("%s(dir=%lu, inode=%lu, \"%pd\", type=%d)\n", __func__,
|
||||
dir->i_ino, inode->i_ino, dentry, type);
|
||||
|
||||
retval = -EIO;
|
||||
bh = affs_bread(sb, inode->i_ino);
|
||||
|
||||
+22
-25
@@ -64,15 +64,16 @@ __affs_hash_dentry(struct qstr *qstr, toupper_t toupper, bool notruncate)
|
||||
{
|
||||
const u8 *name = qstr->name;
|
||||
unsigned long hash;
|
||||
int i;
|
||||
int retval;
|
||||
u32 len;
|
||||
|
||||
i = affs_check_name(qstr->name, qstr->len, notruncate);
|
||||
if (i)
|
||||
return i;
|
||||
retval = affs_check_name(qstr->name, qstr->len, notruncate);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
hash = init_name_hash();
|
||||
i = min(qstr->len, 30u);
|
||||
for (; i > 0; name++, i--)
|
||||
len = min(qstr->len, AFFSNAMEMAX);
|
||||
for (; len > 0; name++, len--)
|
||||
hash = partial_name_hash(toupper(*name), hash);
|
||||
qstr->hash = end_name_hash(hash);
|
||||
|
||||
@@ -114,10 +115,10 @@ static inline int __affs_compare_dentry(unsigned int len,
|
||||
* If the names are longer than the allowed 30 chars,
|
||||
* the excess is ignored, so their length may differ.
|
||||
*/
|
||||
if (len >= 30) {
|
||||
if (name->len < 30)
|
||||
if (len >= AFFSNAMEMAX) {
|
||||
if (name->len < AFFSNAMEMAX)
|
||||
return 1;
|
||||
len = 30;
|
||||
len = AFFSNAMEMAX;
|
||||
} else if (len != name->len)
|
||||
return 1;
|
||||
|
||||
@@ -156,10 +157,10 @@ affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
|
||||
const u8 *name = dentry->d_name.name;
|
||||
int len = dentry->d_name.len;
|
||||
|
||||
if (len >= 30) {
|
||||
if (*name2 < 30)
|
||||
if (len >= AFFSNAMEMAX) {
|
||||
if (*name2 < AFFSNAMEMAX)
|
||||
return 0;
|
||||
len = 30;
|
||||
len = AFFSNAMEMAX;
|
||||
} else if (len != *name2)
|
||||
return 0;
|
||||
|
||||
@@ -173,9 +174,9 @@ int
|
||||
affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
|
||||
{
|
||||
toupper_t toupper = affs_get_toupper(sb);
|
||||
int hash;
|
||||
u32 hash;
|
||||
|
||||
hash = len = min(len, 30u);
|
||||
hash = len = min(len, AFFSNAMEMAX);
|
||||
for (; len > 0; len--)
|
||||
hash = (hash * 13 + toupper(*name++)) & 0x7ff;
|
||||
|
||||
@@ -248,9 +249,8 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
|
||||
int
|
||||
affs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
pr_debug("%s(dir=%d, %lu \"%pd\")\n",
|
||||
__func__, (u32)dir->i_ino, dentry->d_inode->i_ino,
|
||||
dentry);
|
||||
pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
|
||||
dentry->d_inode->i_ino, dentry);
|
||||
|
||||
return affs_remove_header(dentry);
|
||||
}
|
||||
@@ -317,9 +317,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
int
|
||||
affs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
pr_debug("%s(dir=%u, %lu \"%pd\")\n",
|
||||
__func__, (u32)dir->i_ino, dentry->d_inode->i_ino,
|
||||
dentry);
|
||||
pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino,
|
||||
dentry->d_inode->i_ino, dentry);
|
||||
|
||||
return affs_remove_header(dentry);
|
||||
}
|
||||
@@ -404,8 +403,7 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = old_dentry->d_inode;
|
||||
|
||||
pr_debug("%s(%u, %u, \"%pd\")\n",
|
||||
__func__, (u32)inode->i_ino, (u32)dir->i_ino,
|
||||
pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino,
|
||||
dentry);
|
||||
|
||||
return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
|
||||
@@ -419,9 +417,8 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct buffer_head *bh = NULL;
|
||||
int retval;
|
||||
|
||||
pr_debug("%s(old=%u,\"%pd\" to new=%u,\"%pd\")\n",
|
||||
__func__, (u32)old_dir->i_ino, old_dentry,
|
||||
(u32)new_dir->i_ino, new_dentry);
|
||||
pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
|
||||
old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
|
||||
|
||||
retval = affs_check_name(new_dentry->d_name.name,
|
||||
new_dentry->d_name.len,
|
||||
|
||||
+35
-34
@@ -432,39 +432,39 @@ got_root:
|
||||
sb->s_flags |= MS_RDONLY;
|
||||
}
|
||||
switch (chksum) {
|
||||
case MUFS_FS:
|
||||
case MUFS_INTLFFS:
|
||||
case MUFS_DCFFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
/* fall thru */
|
||||
case FS_INTLFFS:
|
||||
case FS_DCFFS:
|
||||
sbi->s_flags |= SF_INTL;
|
||||
break;
|
||||
case MUFS_FFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
break;
|
||||
case FS_FFS:
|
||||
break;
|
||||
case MUFS_OFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
/* fall thru */
|
||||
case FS_OFS:
|
||||
sbi->s_flags |= SF_OFS;
|
||||
sb->s_flags |= MS_NOEXEC;
|
||||
break;
|
||||
case MUFS_DCOFS:
|
||||
case MUFS_INTLOFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
case FS_DCOFS:
|
||||
case FS_INTLOFS:
|
||||
sbi->s_flags |= SF_INTL | SF_OFS;
|
||||
sb->s_flags |= MS_NOEXEC;
|
||||
break;
|
||||
default:
|
||||
pr_err("Unknown filesystem on device %s: %08X\n",
|
||||
sb->s_id, chksum);
|
||||
return -EINVAL;
|
||||
case MUFS_FS:
|
||||
case MUFS_INTLFFS:
|
||||
case MUFS_DCFFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
/* fall thru */
|
||||
case FS_INTLFFS:
|
||||
case FS_DCFFS:
|
||||
sbi->s_flags |= SF_INTL;
|
||||
break;
|
||||
case MUFS_FFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
break;
|
||||
case FS_FFS:
|
||||
break;
|
||||
case MUFS_OFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
/* fall thru */
|
||||
case FS_OFS:
|
||||
sbi->s_flags |= SF_OFS;
|
||||
sb->s_flags |= MS_NOEXEC;
|
||||
break;
|
||||
case MUFS_DCOFS:
|
||||
case MUFS_INTLOFS:
|
||||
sbi->s_flags |= SF_MUFS;
|
||||
case FS_DCOFS:
|
||||
case FS_INTLOFS:
|
||||
sbi->s_flags |= SF_INTL | SF_OFS;
|
||||
sb->s_flags |= MS_NOEXEC;
|
||||
break;
|
||||
default:
|
||||
pr_err("Unknown filesystem on device %s: %08X\n",
|
||||
sb->s_id, chksum);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mount_flags & SF_VERBOSE) {
|
||||
@@ -584,7 +584,7 @@ affs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||
buf->f_bavail = free;
|
||||
buf->f_fsid.val[0] = (u32)id;
|
||||
buf->f_fsid.val[1] = (u32)(id >> 32);
|
||||
buf->f_namelen = 30;
|
||||
buf->f_namelen = AFFSNAMEMAX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -602,6 +602,7 @@ static void affs_kill_sb(struct super_block *sb)
|
||||
affs_free_bitmap(sb);
|
||||
affs_brelse(sbi->s_root_bh);
|
||||
kfree(sbi->s_prefix);
|
||||
mutex_destroy(&sbi->s_bmlock);
|
||||
kfree(sbi);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -274,9 +274,9 @@ more:
|
||||
static struct inode *
|
||||
befs_alloc_inode(struct super_block *sb)
|
||||
{
|
||||
struct befs_inode_info *bi;
|
||||
bi = (struct befs_inode_info *)kmem_cache_alloc(befs_inode_cachep,
|
||||
GFP_KERNEL);
|
||||
struct befs_inode_info *bi;
|
||||
|
||||
bi = kmem_cache_alloc(befs_inode_cachep, GFP_KERNEL);
|
||||
if (!bi)
|
||||
return NULL;
|
||||
return &bi->vfs_inode;
|
||||
|
||||
+56
-82
@@ -28,29 +28,6 @@
|
||||
|
||||
#include "coda_int.h"
|
||||
|
||||
/* dir inode-ops */
|
||||
static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, bool excl);
|
||||
static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, unsigned int flags);
|
||||
static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
|
||||
struct dentry *entry);
|
||||
static int coda_unlink(struct inode *dir_inode, struct dentry *entry);
|
||||
static int coda_symlink(struct inode *dir_inode, struct dentry *entry,
|
||||
const char *symname);
|
||||
static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, umode_t mode);
|
||||
static int coda_rmdir(struct inode *dir_inode, struct dentry *entry);
|
||||
static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
|
||||
struct inode *new_inode, struct dentry *new_dentry);
|
||||
|
||||
/* dir file-ops */
|
||||
static int coda_readdir(struct file *file, struct dir_context *ctx);
|
||||
|
||||
/* dentry ops */
|
||||
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags);
|
||||
static int coda_dentry_delete(const struct dentry *);
|
||||
|
||||
/* support routines */
|
||||
static int coda_venus_readdir(struct file *, struct dir_context *);
|
||||
|
||||
/* same as fs/bad_inode.c */
|
||||
static int coda_return_EIO(void)
|
||||
{
|
||||
@@ -58,38 +35,6 @@ static int coda_return_EIO(void)
|
||||
}
|
||||
#define CODA_EIO_ERROR ((void *) (coda_return_EIO))
|
||||
|
||||
const struct dentry_operations coda_dentry_operations =
|
||||
{
|
||||
.d_revalidate = coda_dentry_revalidate,
|
||||
.d_delete = coda_dentry_delete,
|
||||
};
|
||||
|
||||
const struct inode_operations coda_dir_inode_operations =
|
||||
{
|
||||
.create = coda_create,
|
||||
.lookup = coda_lookup,
|
||||
.link = coda_link,
|
||||
.unlink = coda_unlink,
|
||||
.symlink = coda_symlink,
|
||||
.mkdir = coda_mkdir,
|
||||
.rmdir = coda_rmdir,
|
||||
.mknod = CODA_EIO_ERROR,
|
||||
.rename = coda_rename,
|
||||
.permission = coda_permission,
|
||||
.getattr = coda_getattr,
|
||||
.setattr = coda_setattr,
|
||||
};
|
||||
|
||||
const struct file_operations coda_dir_operations = {
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
.iterate = coda_readdir,
|
||||
.open = coda_open,
|
||||
.release = coda_release,
|
||||
.fsync = coda_fsync,
|
||||
};
|
||||
|
||||
|
||||
/* inode operations for directories */
|
||||
/* access routines: lookup, readlink, permission */
|
||||
static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags)
|
||||
@@ -374,33 +319,6 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* file operations for directories */
|
||||
static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
|
||||
{
|
||||
struct coda_file_info *cfi;
|
||||
struct file *host_file;
|
||||
int ret;
|
||||
|
||||
cfi = CODA_FTOC(coda_file);
|
||||
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
|
||||
host_file = cfi->cfi_container;
|
||||
|
||||
if (host_file->f_op->iterate) {
|
||||
struct inode *host_inode = file_inode(host_file);
|
||||
mutex_lock(&host_inode->i_mutex);
|
||||
ret = -ENOENT;
|
||||
if (!IS_DEADDIR(host_inode)) {
|
||||
ret = host_file->f_op->iterate(host_file, ctx);
|
||||
file_accessed(host_file);
|
||||
}
|
||||
mutex_unlock(&host_inode->i_mutex);
|
||||
return ret;
|
||||
}
|
||||
/* Venus: we must read Venus dirents from a file */
|
||||
return coda_venus_readdir(coda_file, ctx);
|
||||
}
|
||||
|
||||
static inline unsigned int CDT2DT(unsigned char cdt)
|
||||
{
|
||||
unsigned int dt;
|
||||
@@ -495,6 +413,33 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* file operations for directories */
|
||||
static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
|
||||
{
|
||||
struct coda_file_info *cfi;
|
||||
struct file *host_file;
|
||||
int ret;
|
||||
|
||||
cfi = CODA_FTOC(coda_file);
|
||||
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
|
||||
host_file = cfi->cfi_container;
|
||||
|
||||
if (host_file->f_op->iterate) {
|
||||
struct inode *host_inode = file_inode(host_file);
|
||||
|
||||
mutex_lock(&host_inode->i_mutex);
|
||||
ret = -ENOENT;
|
||||
if (!IS_DEADDIR(host_inode)) {
|
||||
ret = host_file->f_op->iterate(host_file, ctx);
|
||||
file_accessed(host_file);
|
||||
}
|
||||
mutex_unlock(&host_inode->i_mutex);
|
||||
return ret;
|
||||
}
|
||||
/* Venus: we must read Venus dirents from a file */
|
||||
return coda_venus_readdir(coda_file, ctx);
|
||||
}
|
||||
|
||||
/* called when a cache lookup succeeds */
|
||||
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
|
||||
{
|
||||
@@ -603,3 +548,32 @@ int coda_revalidate_inode(struct inode *inode)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct dentry_operations coda_dentry_operations = {
|
||||
.d_revalidate = coda_dentry_revalidate,
|
||||
.d_delete = coda_dentry_delete,
|
||||
};
|
||||
|
||||
const struct inode_operations coda_dir_inode_operations = {
|
||||
.create = coda_create,
|
||||
.lookup = coda_lookup,
|
||||
.link = coda_link,
|
||||
.unlink = coda_unlink,
|
||||
.symlink = coda_symlink,
|
||||
.mkdir = coda_mkdir,
|
||||
.rmdir = coda_rmdir,
|
||||
.mknod = CODA_EIO_ERROR,
|
||||
.rename = coda_rename,
|
||||
.permission = coda_permission,
|
||||
.getattr = coda_getattr,
|
||||
.setattr = coda_setattr,
|
||||
};
|
||||
|
||||
const struct file_operations coda_dir_operations = {
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
.iterate = coda_readdir,
|
||||
.open = coda_open,
|
||||
.release = coda_release,
|
||||
.fsync = coda_fsync,
|
||||
};
|
||||
|
||||
+6
-6
@@ -118,18 +118,18 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct eventfd_ctx *ctx = file->private_data;
|
||||
unsigned int events = 0;
|
||||
unsigned long flags;
|
||||
u64 count;
|
||||
|
||||
poll_wait(file, &ctx->wqh, wait);
|
||||
smp_rmb();
|
||||
count = ctx->count;
|
||||
|
||||
spin_lock_irqsave(&ctx->wqh.lock, flags);
|
||||
if (ctx->count > 0)
|
||||
if (count > 0)
|
||||
events |= POLLIN;
|
||||
if (ctx->count == ULLONG_MAX)
|
||||
if (count == ULLONG_MAX)
|
||||
events |= POLLERR;
|
||||
if (ULLONG_MAX - 1 > ctx->count)
|
||||
if (ULLONG_MAX - 1 > count)
|
||||
events |= POLLOUT;
|
||||
spin_unlock_irqrestore(&ctx->wqh.lock, flags);
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
+1
-1
@@ -580,7 +580,7 @@ static void fat_set_state(struct super_block *sb,
|
||||
{
|
||||
struct buffer_head *bh;
|
||||
struct fat_boot_sector *b;
|
||||
struct msdos_sb_info *sbi = sb->s_fs_info;
|
||||
struct msdos_sb_info *sbi = MSDOS_SB(sb);
|
||||
|
||||
/* do not change any thing if mounted read only */
|
||||
if ((sb->s_flags & MS_RDONLY) && !force)
|
||||
|
||||
+4
-4
@@ -546,8 +546,8 @@ static int __init update_note_header_size_elf64(const Elf64_Ehdr *ehdr_ptr)
|
||||
nhdr_ptr = notes_section;
|
||||
while (nhdr_ptr->n_namesz != 0) {
|
||||
sz = sizeof(Elf64_Nhdr) +
|
||||
((nhdr_ptr->n_namesz + 3) & ~3) +
|
||||
((nhdr_ptr->n_descsz + 3) & ~3);
|
||||
(((u64)nhdr_ptr->n_namesz + 3) & ~3) +
|
||||
(((u64)nhdr_ptr->n_descsz + 3) & ~3);
|
||||
if ((real_sz + sz) > max_sz) {
|
||||
pr_warn("Warning: Exceeded p_memsz, dropping PT_NOTE entry n_namesz=0x%x, n_descsz=0x%x\n",
|
||||
nhdr_ptr->n_namesz, nhdr_ptr->n_descsz);
|
||||
@@ -732,8 +732,8 @@ static int __init update_note_header_size_elf32(const Elf32_Ehdr *ehdr_ptr)
|
||||
nhdr_ptr = notes_section;
|
||||
while (nhdr_ptr->n_namesz != 0) {
|
||||
sz = sizeof(Elf32_Nhdr) +
|
||||
((nhdr_ptr->n_namesz + 3) & ~3) +
|
||||
((nhdr_ptr->n_descsz + 3) & ~3);
|
||||
(((u64)nhdr_ptr->n_namesz + 3) & ~3) +
|
||||
(((u64)nhdr_ptr->n_descsz + 3) & ~3);
|
||||
if ((real_sz + sz) > max_sz) {
|
||||
pr_warn("Warning: Exceeded p_memsz, dropping PT_NOTE entry n_namesz=0x%x, n_descsz=0x%x\n",
|
||||
nhdr_ptr->n_namesz, nhdr_ptr->n_descsz);
|
||||
|
||||
+1
-1
@@ -2766,7 +2766,7 @@ static int reiserfs_write_begin(struct file *file,
|
||||
int old_ref = 0;
|
||||
|
||||
inode = mapping->host;
|
||||
*fsdata = 0;
|
||||
*fsdata = NULL;
|
||||
if (flags & AOP_FLAG_CONT_EXPAND &&
|
||||
(pos & (inode->i_sb->s_blocksize - 1)) == 0) {
|
||||
pos ++;
|
||||
|
||||
+3
-5
@@ -95,22 +95,18 @@
|
||||
|
||||
void lock_ufs(struct super_block *sb)
|
||||
{
|
||||
#if defined(CONFIG_SMP) || defined (CONFIG_PREEMPT)
|
||||
struct ufs_sb_info *sbi = UFS_SB(sb);
|
||||
|
||||
mutex_lock(&sbi->mutex);
|
||||
sbi->mutex_owner = current;
|
||||
#endif
|
||||
}
|
||||
|
||||
void unlock_ufs(struct super_block *sb)
|
||||
{
|
||||
#if defined(CONFIG_SMP) || defined (CONFIG_PREEMPT)
|
||||
struct ufs_sb_info *sbi = UFS_SB(sb);
|
||||
|
||||
sbi->mutex_owner = NULL;
|
||||
mutex_unlock(&sbi->mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
|
||||
@@ -1415,9 +1411,11 @@ static struct kmem_cache * ufs_inode_cachep;
|
||||
static struct inode *ufs_alloc_inode(struct super_block *sb)
|
||||
{
|
||||
struct ufs_inode_info *ei;
|
||||
ei = (struct ufs_inode_info *)kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
|
||||
|
||||
ei = kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
|
||||
if (!ei)
|
||||
return NULL;
|
||||
|
||||
ei->vfs_inode.i_version = 1;
|
||||
return &ei->vfs_inode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user