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
nexedi
linux
Commits
d360ab81
Commit
d360ab81
authored
Dec 28, 2002
by
Hirofumi Ogawa
Committed by
Linus Torvalds
Dec 28, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] adds st_blocks for [lf]stat() to ramfs
This makes ramfs support proper st_blocks accounting.
parent
0e3a6c7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
fs/ramfs/inode.c
fs/ramfs/inode.c
+27
-0
No files found.
fs/ramfs/inode.c
View file @
d360ab81
...
...
@@ -40,6 +40,7 @@
static
struct
super_operations
ramfs_ops
;
static
struct
address_space_operations
ramfs_aops
;
static
struct
file_operations
ramfs_file_operations
;
static
struct
inode_operations
ramfs_file_inode_operations
;
static
struct
inode_operations
ramfs_dir_inode_operations
;
static
struct
backing_dev_info
ramfs_backing_dev_info
=
{
...
...
@@ -66,6 +67,7 @@ static struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev
init_special_inode
(
inode
,
mode
,
dev
);
break
;
case
S_IFREG
:
inode
->
i_op
=
&
ramfs_file_inode_operations
;
inode
->
i_fop
=
&
ramfs_file_operations
;
break
;
case
S_IFDIR
:
...
...
@@ -114,6 +116,27 @@ static int ramfs_create(struct inode *dir, struct dentry *dentry, int mode)
return
ramfs_mknod
(
dir
,
dentry
,
mode
|
S_IFREG
,
0
);
}
static
int
ramfs_getattr
(
struct
vfsmount
*
mnt
,
struct
dentry
*
dentry
,
struct
kstat
*
stat
)
{
struct
inode
*
inode
=
dentry
->
d_inode
;
stat
->
dev
=
inode
->
i_sb
->
s_dev
;
stat
->
ino
=
inode
->
i_ino
;
stat
->
mode
=
inode
->
i_mode
;
stat
->
nlink
=
inode
->
i_nlink
;
stat
->
uid
=
inode
->
i_uid
;
stat
->
gid
=
inode
->
i_gid
;
stat
->
rdev
=
kdev_t_to_nr
(
inode
->
i_rdev
);
stat
->
atime
=
inode
->
i_atime
;
stat
->
mtime
=
inode
->
i_mtime
;
stat
->
ctime
=
inode
->
i_ctime
;
stat
->
size
=
inode
->
i_size
;
stat
->
blocks
=
inode
->
i_mapping
->
nrpages
<<
(
PAGE_CACHE_SHIFT
-
9
);
stat
->
blksize
=
inode
->
i_blksize
;
return
0
;
}
static
int
ramfs_symlink
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
const
char
*
symname
)
{
...
...
@@ -147,6 +170,10 @@ static struct file_operations ramfs_file_operations = {
.
sendfile
=
generic_file_sendfile
,
};
static
struct
inode_operations
ramfs_file_inode_operations
=
{
.
getattr
=
ramfs_getattr
,
};
static
struct
inode_operations
ramfs_dir_inode_operations
=
{
.
create
=
ramfs_create
,
.
lookup
=
simple_lookup
,
...
...
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