Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
fa5a4901
Commit
fa5a4901
authored
Mar 11, 2002
by
Brian Gerst
Committed by
Linus Torvalds
Mar 11, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] struct super_block cleanup - cramfs
Seperates cramfs_sb_info from struct super_block.
parent
10caf7bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
20 deletions
+32
-20
fs/cramfs/inode.c
fs/cramfs/inode.c
+27
-17
include/linux/cramfs_fs_sb.h
include/linux/cramfs_fs_sb.h
+5
-0
include/linux/fs.h
include/linux/fs.h
+0
-3
No files found.
fs/cramfs/inode.c
View file @
fa5a4901
...
...
@@ -20,16 +20,12 @@
#include <linux/blkdev.h>
#include <linux/cramfs_fs.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/cramfs_fs_sb.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#define CRAMFS_SB_MAGIC u.cramfs_sb.magic
#define CRAMFS_SB_SIZE u.cramfs_sb.size
#define CRAMFS_SB_BLOCKS u.cramfs_sb.blocks
#define CRAMFS_SB_FILES u.cramfs_sb.files
#define CRAMFS_SB_FLAGS u.cramfs_sb.flags
static
struct
super_operations
cramfs_ops
;
static
struct
inode_operations
cramfs_dir_inode_operations
;
static
struct
file_operations
cramfs_directory_operations
;
...
...
@@ -188,12 +184,23 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
return
read_buffers
[
buffer
]
+
offset
;
}
static
void
cramfs_put_super
(
struct
super_block
*
sb
)
{
kfree
(
sb
->
u
.
generic_sbp
);
sb
->
u
.
generic_sbp
=
NULL
;
}
static
int
cramfs_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
{
int
i
;
struct
cramfs_super
super
;
unsigned
long
root_offset
;
struct
cramfs_sb_info
*
sbi
;
sbi
=
kmalloc
(
sizeof
(
struct
cramfs_sb_info
),
GFP_KERNEL
);
if
(
!
sbi
)
return
-
ENOMEM
;
sb
->
u
.
generic_sbp
=
sbi
;
sb_set_blocksize
(
sb
,
PAGE_CACHE_SIZE
);
...
...
@@ -229,16 +236,16 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
}
root_offset
=
super
.
root
.
offset
<<
2
;
if
(
super
.
flags
&
CRAMFS_FLAG_FSID_VERSION_2
)
{
sb
->
CRAMFS_SB_SIZE
=
super
.
size
;
sb
->
CRAMFS_SB_BLOCKS
=
super
.
fsid
.
blocks
;
sb
->
CRAMFS_SB_FILES
=
super
.
fsid
.
files
;
sb
i
->
size
=
super
.
size
;
sb
i
->
blocks
=
super
.
fsid
.
blocks
;
sb
i
->
files
=
super
.
fsid
.
files
;
}
else
{
sb
->
CRAMFS_SB_SIZE
=
1
<<
28
;
sb
->
CRAMFS_SB_BLOCKS
=
0
;
sb
->
CRAMFS_SB_FILES
=
0
;
sb
i
->
size
=
1
<<
28
;
sb
i
->
blocks
=
0
;
sb
i
->
files
=
0
;
}
sb
->
CRAMFS_SB_MAGIC
=
super
.
magic
;
sb
->
CRAMFS_SB_FLAGS
=
super
.
flags
;
sb
i
->
magic
=
super
.
magic
;
sb
i
->
flags
=
super
.
flags
;
if
(
root_offset
==
0
)
printk
(
KERN_INFO
"cramfs: empty filesystem"
);
else
if
(
!
(
super
.
flags
&
CRAMFS_FLAG_SHIFTED_ROOT_OFFSET
)
&&
...
...
@@ -254,6 +261,8 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
sb
->
s_root
=
d_alloc_root
(
get_cramfs_inode
(
sb
,
&
super
.
root
));
return
0
;
out:
kfree
(
sbi
);
sb
->
u
.
generic_sbp
=
NULL
;
return
-
EINVAL
;
}
...
...
@@ -261,10 +270,10 @@ static int cramfs_statfs(struct super_block *sb, struct statfs *buf)
{
buf
->
f_type
=
CRAMFS_MAGIC
;
buf
->
f_bsize
=
PAGE_CACHE_SIZE
;
buf
->
f_blocks
=
sb
->
CRAMFS_SB_BLOCKS
;
buf
->
f_blocks
=
CRAMFS_SB
(
sb
)
->
blocks
;
buf
->
f_bfree
=
0
;
buf
->
f_bavail
=
0
;
buf
->
f_files
=
sb
->
CRAMFS_SB_FILES
;
buf
->
f_files
=
CRAMFS_SB
(
sb
)
->
files
;
buf
->
f_ffree
=
0
;
buf
->
f_namelen
=
CRAMFS_MAXPATHLEN
;
return
0
;
...
...
@@ -334,7 +343,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry)
int
sorted
;
lock_kernel
();
sorted
=
dir
->
i_sb
->
CRAMFS_SB_FLAGS
&
CRAMFS_FLAG_SORTED_DIRS
;
sorted
=
CRAMFS_SB
(
dir
->
i_sb
)
->
flags
&
CRAMFS_FLAG_SORTED_DIRS
;
while
(
offset
<
dir
->
i_size
)
{
struct
cramfs_inode
*
de
;
char
*
name
;
...
...
@@ -445,6 +454,7 @@ static struct inode_operations cramfs_dir_inode_operations = {
};
static
struct
super_operations
cramfs_ops
=
{
put_super:
cramfs_put_super
,
statfs:
cramfs_statfs
,
};
...
...
include/linux/cramfs_fs_sb.h
View file @
fa5a4901
...
...
@@ -12,4 +12,9 @@ struct cramfs_sb_info {
unsigned
long
flags
;
};
static
inline
struct
cramfs_sb_info
*
CRAMFS_SB
(
struct
super_block
*
sb
)
{
return
sb
->
u
.
generic_sbp
;
}
#endif
include/linux/fs.h
View file @
fa5a4901
...
...
@@ -290,7 +290,6 @@ extern void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long
#include <linux/pipe_fs_i.h>
/* #include <linux/umsdos_fs_i.h> */
#include <linux/romfs_fs_i.h>
#include <linux/cramfs_fs_sb.h>
/*
* Attribute flags. These should be or-ed together to figure out what
...
...
@@ -669,7 +668,6 @@ struct quota_mount_options
#include <linux/bfs_fs_sb.h>
#include <linux/udf_fs_sb.h>
#include <linux/ncp_fs_sb.h>
#include <linux/cramfs_fs_sb.h>
#include <linux/jffs2_fs_sb.h>
extern
struct
list_head
super_blocks
;
...
...
@@ -728,7 +726,6 @@ struct super_block {
struct
udf_sb_info
udf_sb
;
struct
ncp_sb_info
ncpfs_sb
;
struct
jffs2_sb_info
jffs2_sb
;
struct
cramfs_sb_info
cramfs_sb
;
void
*
generic_sbp
;
}
u
;
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment