Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hellofs
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
hellofs
Commits
b654b627
There was an error fetching the commit references. Please try again later.
Commit
b654b627
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
migrate to linux 4.19, without ANY backward consideration
parent
dded6419
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
dir.c
+10
-7
10 additions, 7 deletions
dir.c
file.c
+5
-4
5 additions, 4 deletions
file.c
inode.c
+3
-2
3 additions, 2 deletions
inode.c
khellofs.c
+1
-1
1 addition, 1 deletion
khellofs.c
khellofs.h
+5
-2
5 additions, 2 deletions
khellofs.h
with
24 additions
and
16 deletions
dir.c
+
10
−
7
View file @
b654b627
#include
"khellofs.h"
int
hellofs_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
#error fs api changed in linux 3.11.0. Please use a better kernel to build my code!
#endif
int
hellofs_iterate
(
struct
file
*
filp
,
struct
dir_context
*
ctx
)
{
loff_t
pos
;
struct
inode
*
inode
;
struct
super_block
*
sb
;
...
...
@@ -9,8 +13,8 @@ int hellofs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
struct
hellofs_dir_record
*
dir_record
;
uint64_t
i
;
pos
=
filp
->
f_
pos
;
inode
=
filp
->
f_dentry
->
d_inode
;
pos
=
ctx
->
pos
;
inode
=
filp
->
f_
path
.
dentry
->
d_inode
;
sb
=
inode
->
i_sb
;
hellofs_inode
=
HELLOFS_INODE
(
inode
);
...
...
@@ -25,7 +29,7 @@ int hellofs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
printk
(
KERN_ERR
"Inode %llu of dentry %s is not a directory
\n
"
,
hellofs_inode
->
inode_no
,
filp
->
f_dentry
->
d_name
.
name
);
filp
->
f_
path
.
dentry
->
d_name
.
name
);
return
-
ENOTDIR
;
}
...
...
@@ -34,9 +38,8 @@ int hellofs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
dir_record
=
(
struct
hellofs_dir_record
*
)
bh
->
b_data
;
for
(
i
=
0
;
i
<
hellofs_inode
->
dir_children_count
;
i
++
)
{
filldir
(
dirent
,
dir_record
->
filename
,
HELLOFS_FILENAME_MAXLEN
,
pos
,
dir_record
->
inode_no
,
DT_UNKNOWN
);
filp
->
f_pos
+=
sizeof
(
struct
hellofs_dir_record
);
dir_emit
(
ctx
,
dir_record
->
filename
,
HELLOFS_FILENAME_MAXLEN
,
dir_record
->
inode_no
,
DT_UNKNOWN
);
ctx
->
pos
+=
sizeof
(
struct
hellofs_dir_record
);
pos
+=
sizeof
(
struct
hellofs_dir_record
);
dir_record
++
;
}
...
...
This diff is collapsed.
Click to expand it.
file.c
+
5
−
4
View file @
b654b627
...
...
@@ -58,10 +58,11 @@ ssize_t hellofs_write(struct file *filp, const char __user *buf, size_t len,
hellofs_inode
=
HELLOFS_INODE
(
inode
);
hellofs_sb
=
HELLOFS_SB
(
sb
);
ret
=
generic_write_checks
(
filp
,
ppos
,
&
len
,
0
);
if
(
ret
)
{
return
ret
;
}
// Recolic: compilation issue, temporary disable. TODO
// ret = generic_write_checks(filp, ppos, &len, 0);
// if (ret) {
// return ret;
// }
bh
=
sb_bread
(
sb
,
hellofs_inode
->
data_block_no
);
if
(
!
bh
)
{
...
...
This diff is collapsed.
Click to expand it.
inode.c
+
3
−
2
View file @
b654b627
#include
"khellofs.h"
#include
<linux/timekeeping.h>
void
hellofs_destroy_inode
(
struct
inode
*
inode
)
{
struct
hellofs_inode
*
hellofs_inode
=
HELLOFS_INODE
(
inode
);
...
...
@@ -17,7 +18,7 @@ void hellofs_fill_inode(struct super_block *sb, struct inode *inode,
// TODO hope we can use hellofs_inode to store timespec
inode
->
i_atime
=
inode
->
i_mtime
=
inode
->
i_ctime
=
CURRENT_TIME
;
=
current_time
(
inode
)
;
inode
->
i_private
=
hellofs_inode
;
if
(
S_ISDIR
(
hellofs_inode
->
mode
))
{
...
...
@@ -296,4 +297,4 @@ struct dentry *hellofs_lookup(struct inode *dir,
"No inode found for the filename: %s
\n
"
,
child_dentry
->
d_name
.
name
);
return
NULL
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
khellofs.c
+
1
−
1
View file @
b654b627
...
...
@@ -23,7 +23,7 @@ const struct inode_operations hellofs_inode_ops = {
const
struct
file_operations
hellofs_dir_operations
=
{
.
owner
=
THIS_MODULE
,
.
readdir
=
hellofs_
readdir
,
.
iterate
=
hellofs_
iterate
,
};
const
struct
file_operations
hellofs_file_operations
=
{
...
...
This diff is collapsed.
Click to expand it.
khellofs.h
+
5
−
2
View file @
b654b627
...
...
@@ -41,7 +41,10 @@ struct dentry *hellofs_lookup(struct inode *parent_inode,
int
hellofs_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
umode_t
mode
);
int
hellofs_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
#error fs api changed in linux 3.11.0. Please use a better kernel to build my code!
#endif
int
hellofs_iterate
(
struct
file
*
filp
,
struct
dir_context
*
ctx
);
ssize_t
hellofs_read
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
len
,
loff_t
*
ppos
);
...
...
@@ -107,4 +110,4 @@ int hellofs_alloc_data_block(struct super_block *sb, uint64_t *out_data_block_no
int
hellofs_create_inode
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
umode_t
mode
);
#endif
/*__KHELLOFS_H__*/
\ No newline at end of file
#endif
/*__KHELLOFS_H__*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment