Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7392
b: refs/heads/master
c: a97c9bf
h: refs/heads/master
v: v3
  • Loading branch information
Dave Johnson authored and Linus Torvalds committed Sep 7, 2005
1 parent f6f16c1 commit aeaa781
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7f4bde9a3486cd7e70bedd2aff35b38667d50173
refs/heads/master: a97c9bf33f4612e2aed6f000f6b1d268b6814f3c
43 changes: 39 additions & 4 deletions trunk/fs/cramfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,47 @@ static DECLARE_MUTEX(read_mutex);
#define CRAMINO(x) ((x)->offset?(x)->offset<<2:1)
#define OFFSET(x) ((x)->i_ino)

static struct inode *get_cramfs_inode(struct super_block *sb, struct cramfs_inode * cramfs_inode)

static int cramfs_iget5_test(struct inode *inode, void *opaque)
{
struct cramfs_inode *cramfs_inode = opaque;

if (inode->i_ino != CRAMINO(cramfs_inode))
return 0; /* does not match */

if (inode->i_ino != 1)
return 1;

/* all empty directories, char, block, pipe, and sock, share inode #1 */

if ((inode->i_mode != cramfs_inode->mode) ||
(inode->i_gid != cramfs_inode->gid) ||
(inode->i_uid != cramfs_inode->uid))
return 0; /* does not match */

if ((S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) &&
(inode->i_rdev != old_decode_dev(cramfs_inode->size)))
return 0; /* does not match */

return 1; /* matches */
}

static int cramfs_iget5_set(struct inode *inode, void *opaque)
{
struct cramfs_inode *cramfs_inode = opaque;
inode->i_ino = CRAMINO(cramfs_inode);
return 0;
}

static struct inode *get_cramfs_inode(struct super_block *sb,
struct cramfs_inode * cramfs_inode)
{
struct inode * inode = new_inode(sb);
struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode),
cramfs_iget5_test, cramfs_iget5_set,
cramfs_inode);
static struct timespec zerotime;

if (inode) {
if (inode && (inode->i_state & I_NEW)) {
inode->i_mode = cramfs_inode->mode;
inode->i_uid = cramfs_inode->uid;
inode->i_size = cramfs_inode->size;
Expand All @@ -58,7 +93,6 @@ static struct inode *get_cramfs_inode(struct super_block *sb, struct cramfs_inod
but it's the best we can do without reading the directory
contents. 1 yields the right result in GNU find, even
without -noleaf option. */
insert_inode_hash(inode);
if (S_ISREG(inode->i_mode)) {
inode->i_fop = &generic_ro_fops;
inode->i_data.a_ops = &cramfs_aops;
Expand All @@ -74,6 +108,7 @@ static struct inode *get_cramfs_inode(struct super_block *sb, struct cramfs_inod
init_special_inode(inode, inode->i_mode,
old_decode_dev(cramfs_inode->size));
}
unlock_new_inode(inode);
}
return inode;
}
Expand Down

0 comments on commit aeaa781

Please sign in to comment.