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
b7c177fc
Commit
b7c177fc
authored
Mar 17, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configfs: kill configfs_sb
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
81d44ed1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
25 deletions
+26
-25
fs/configfs/configfs_internal.h
fs/configfs/configfs_internal.h
+1
-2
fs/configfs/dir.c
fs/configfs/dir.c
+17
-12
fs/configfs/inode.c
fs/configfs/inode.c
+4
-5
fs/configfs/mount.c
fs/configfs/mount.c
+1
-3
fs/configfs/symlink.c
fs/configfs/symlink.c
+3
-3
No files found.
fs/configfs/configfs_internal.h
View file @
b7c177fc
...
@@ -63,7 +63,7 @@ extern struct kmem_cache *configfs_dir_cachep;
...
@@ -63,7 +63,7 @@ extern struct kmem_cache *configfs_dir_cachep;
extern
int
configfs_is_root
(
struct
config_item
*
item
);
extern
int
configfs_is_root
(
struct
config_item
*
item
);
extern
struct
inode
*
configfs_new_inode
(
umode_t
mode
,
struct
configfs_dirent
*
);
extern
struct
inode
*
configfs_new_inode
(
umode_t
mode
,
struct
configfs_dirent
*
,
struct
super_block
*
);
extern
int
configfs_create
(
struct
dentry
*
,
umode_t
mode
,
int
(
*
init
)(
struct
inode
*
));
extern
int
configfs_create
(
struct
dentry
*
,
umode_t
mode
,
int
(
*
init
)(
struct
inode
*
));
extern
int
configfs_inode_init
(
void
);
extern
int
configfs_inode_init
(
void
);
extern
void
configfs_inode_exit
(
void
);
extern
void
configfs_inode_exit
(
void
);
...
@@ -84,7 +84,6 @@ extern int configfs_pin_fs(void);
...
@@ -84,7 +84,6 @@ extern int configfs_pin_fs(void);
extern
void
configfs_release_fs
(
void
);
extern
void
configfs_release_fs
(
void
);
extern
struct
rw_semaphore
configfs_rename_sem
;
extern
struct
rw_semaphore
configfs_rename_sem
;
extern
struct
super_block
*
configfs_sb
;
extern
const
struct
file_operations
configfs_dir_operations
;
extern
const
struct
file_operations
configfs_dir_operations
;
extern
const
struct
file_operations
configfs_file_operations
;
extern
const
struct
file_operations
configfs_file_operations
;
extern
const
struct
file_operations
bin_fops
;
extern
const
struct
file_operations
bin_fops
;
...
...
fs/configfs/dir.c
View file @
b7c177fc
...
@@ -1079,6 +1079,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
...
@@ -1079,6 +1079,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
int
ret
;
int
ret
;
struct
configfs_dirent
*
p
,
*
root_sd
,
*
subsys_sd
=
NULL
;
struct
configfs_dirent
*
p
,
*
root_sd
,
*
subsys_sd
=
NULL
;
struct
config_item
*
s_item
=
&
subsys
->
su_group
.
cg_item
;
struct
config_item
*
s_item
=
&
subsys
->
su_group
.
cg_item
;
struct
dentry
*
root
;
/*
/*
* Pin the configfs filesystem. This means we can safely access
* Pin the configfs filesystem. This means we can safely access
...
@@ -1093,9 +1094,10 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
...
@@ -1093,9 +1094,10 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
* subsystem is really registered, and so we need to lock out
* subsystem is really registered, and so we need to lock out
* configfs_[un]register_subsystem().
* configfs_[un]register_subsystem().
*/
*/
mutex_lock
(
&
configfs_sb
->
s_root
->
d_inode
->
i_mutex
);
root
=
configfs_mount
->
mnt_root
;
mutex_lock
(
&
root
->
d_inode
->
i_mutex
);
root_sd
=
configfs_sb
->
s_
root
->
d_fsdata
;
root_sd
=
root
->
d_fsdata
;
list_for_each_entry
(
p
,
&
root_sd
->
s_children
,
s_sibling
)
{
list_for_each_entry
(
p
,
&
root_sd
->
s_children
,
s_sibling
)
{
if
(
p
->
s_type
&
CONFIGFS_DIR
)
{
if
(
p
->
s_type
&
CONFIGFS_DIR
)
{
...
@@ -1129,7 +1131,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
...
@@ -1129,7 +1131,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys,
out_unlock_dirent_lock:
out_unlock_dirent_lock:
spin_unlock
(
&
configfs_dirent_lock
);
spin_unlock
(
&
configfs_dirent_lock
);
out_unlock_fs:
out_unlock_fs:
mutex_unlock
(
&
configfs_sb
->
s_
root
->
d_inode
->
i_mutex
);
mutex_unlock
(
&
root
->
d_inode
->
i_mutex
);
/*
/*
* If we succeeded, the fs is pinned via other methods. If not,
* If we succeeded, the fs is pinned via other methods. If not,
...
@@ -1543,6 +1545,7 @@ static inline unsigned char dt_type(struct configfs_dirent *sd)
...
@@ -1543,6 +1545,7 @@ static inline unsigned char dt_type(struct configfs_dirent *sd)
static
int
configfs_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
)
static
int
configfs_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
)
{
{
struct
dentry
*
dentry
=
filp
->
f_path
.
dentry
;
struct
dentry
*
dentry
=
filp
->
f_path
.
dentry
;
struct
super_block
*
sb
=
dentry
->
d_sb
;
struct
configfs_dirent
*
parent_sd
=
dentry
->
d_fsdata
;
struct
configfs_dirent
*
parent_sd
=
dentry
->
d_fsdata
;
struct
configfs_dirent
*
cursor
=
filp
->
private_data
;
struct
configfs_dirent
*
cursor
=
filp
->
private_data
;
struct
list_head
*
p
,
*
q
=
&
cursor
->
s_sibling
;
struct
list_head
*
p
,
*
q
=
&
cursor
->
s_sibling
;
...
@@ -1605,7 +1608,7 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
...
@@ -1605,7 +1608,7 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir
ino
=
inode
->
i_ino
;
ino
=
inode
->
i_ino
;
spin_unlock
(
&
configfs_dirent_lock
);
spin_unlock
(
&
configfs_dirent_lock
);
if
(
!
inode
)
if
(
!
inode
)
ino
=
iunique
(
configfs_
sb
,
2
);
ino
=
iunique
(
sb
,
2
);
if
(
filldir
(
dirent
,
name
,
len
,
filp
->
f_pos
,
ino
,
if
(
filldir
(
dirent
,
name
,
len
,
filp
->
f_pos
,
ino
,
dt_type
(
next
))
<
0
)
dt_type
(
next
))
<
0
)
...
@@ -1677,6 +1680,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
...
@@ -1677,6 +1680,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
struct
config_group
*
group
=
&
subsys
->
su_group
;
struct
config_group
*
group
=
&
subsys
->
su_group
;
struct
qstr
name
;
struct
qstr
name
;
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
struct
dentry
*
root
;
struct
configfs_dirent
*
sd
;
struct
configfs_dirent
*
sd
;
err
=
configfs_pin_fs
();
err
=
configfs_pin_fs
();
...
@@ -1686,18 +1690,18 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
...
@@ -1686,18 +1690,18 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
if
(
!
group
->
cg_item
.
ci_name
)
if
(
!
group
->
cg_item
.
ci_name
)
group
->
cg_item
.
ci_name
=
group
->
cg_item
.
ci_namebuf
;
group
->
cg_item
.
ci_name
=
group
->
cg_item
.
ci_namebuf
;
sd
=
configfs_sb
->
s_root
->
d_fsdata
;
root
=
configfs_mount
->
mnt_root
;
sd
=
root
->
d_fsdata
;
link_group
(
to_config_group
(
sd
->
s_element
),
group
);
link_group
(
to_config_group
(
sd
->
s_element
),
group
);
mutex_lock_nested
(
&
configfs_sb
->
s_root
->
d_inode
->
i_mutex
,
mutex_lock_nested
(
&
root
->
d_inode
->
i_mutex
,
I_MUTEX_PARENT
);
I_MUTEX_PARENT
);
name
.
name
=
group
->
cg_item
.
ci_name
;
name
.
name
=
group
->
cg_item
.
ci_name
;
name
.
len
=
strlen
(
name
.
name
);
name
.
len
=
strlen
(
name
.
name
);
name
.
hash
=
full_name_hash
(
name
.
name
,
name
.
len
);
name
.
hash
=
full_name_hash
(
name
.
name
,
name
.
len
);
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
dentry
=
d_alloc
(
configfs_sb
->
s_
root
,
&
name
);
dentry
=
d_alloc
(
root
,
&
name
);
if
(
dentry
)
{
if
(
dentry
)
{
d_add
(
dentry
,
NULL
);
d_add
(
dentry
,
NULL
);
...
@@ -1714,7 +1718,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
...
@@ -1714,7 +1718,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
}
}
}
}
mutex_unlock
(
&
configfs_sb
->
s_
root
->
d_inode
->
i_mutex
);
mutex_unlock
(
&
root
->
d_inode
->
i_mutex
);
if
(
err
)
{
if
(
err
)
{
unlink_group
(
group
);
unlink_group
(
group
);
...
@@ -1728,13 +1732,14 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
...
@@ -1728,13 +1732,14 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
{
{
struct
config_group
*
group
=
&
subsys
->
su_group
;
struct
config_group
*
group
=
&
subsys
->
su_group
;
struct
dentry
*
dentry
=
group
->
cg_item
.
ci_dentry
;
struct
dentry
*
dentry
=
group
->
cg_item
.
ci_dentry
;
struct
dentry
*
root
=
dentry
->
d_sb
->
s_root
;
if
(
dentry
->
d_parent
!=
configfs_sb
->
s_
root
)
{
if
(
dentry
->
d_parent
!=
root
)
{
printk
(
KERN_ERR
"configfs: Tried to unregister non-subsystem!
\n
"
);
printk
(
KERN_ERR
"configfs: Tried to unregister non-subsystem!
\n
"
);
return
;
return
;
}
}
mutex_lock_nested
(
&
configfs_sb
->
s_
root
->
d_inode
->
i_mutex
,
mutex_lock_nested
(
&
root
->
d_inode
->
i_mutex
,
I_MUTEX_PARENT
);
I_MUTEX_PARENT
);
mutex_lock_nested
(
&
dentry
->
d_inode
->
i_mutex
,
I_MUTEX_CHILD
);
mutex_lock_nested
(
&
dentry
->
d_inode
->
i_mutex
,
I_MUTEX_CHILD
);
mutex_lock
(
&
configfs_symlink_mutex
);
mutex_lock
(
&
configfs_symlink_mutex
);
...
@@ -1751,7 +1756,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
...
@@ -1751,7 +1756,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
d_delete
(
dentry
);
d_delete
(
dentry
);
mutex_unlock
(
&
configfs_sb
->
s_
root
->
d_inode
->
i_mutex
);
mutex_unlock
(
&
root
->
d_inode
->
i_mutex
);
dput
(
dentry
);
dput
(
dentry
);
...
...
fs/configfs/inode.c
View file @
b7c177fc
...
@@ -44,8 +44,6 @@
...
@@ -44,8 +44,6 @@
static
struct
lock_class_key
default_group_class
[
MAX_LOCK_DEPTH
];
static
struct
lock_class_key
default_group_class
[
MAX_LOCK_DEPTH
];
#endif
#endif
extern
struct
super_block
*
configfs_sb
;
static
const
struct
address_space_operations
configfs_aops
=
{
static
const
struct
address_space_operations
configfs_aops
=
{
.
readpage
=
simple_readpage
,
.
readpage
=
simple_readpage
,
.
write_begin
=
simple_write_begin
,
.
write_begin
=
simple_write_begin
,
...
@@ -132,9 +130,10 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
...
@@ -132,9 +130,10 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
inode
->
i_ctime
=
iattr
->
ia_ctime
;
inode
->
i_ctime
=
iattr
->
ia_ctime
;
}
}
struct
inode
*
configfs_new_inode
(
umode_t
mode
,
struct
configfs_dirent
*
sd
)
struct
inode
*
configfs_new_inode
(
umode_t
mode
,
struct
configfs_dirent
*
sd
,
struct
super_block
*
s
)
{
{
struct
inode
*
inode
=
new_inode
(
configfs_sb
);
struct
inode
*
inode
=
new_inode
(
s
);
if
(
inode
)
{
if
(
inode
)
{
inode
->
i_ino
=
get_next_ino
();
inode
->
i_ino
=
get_next_ino
();
inode
->
i_mapping
->
a_ops
=
&
configfs_aops
;
inode
->
i_mapping
->
a_ops
=
&
configfs_aops
;
...
@@ -192,7 +191,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct ino
...
@@ -192,7 +191,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct ino
if
(
dentry
)
{
if
(
dentry
)
{
if
(
!
dentry
->
d_inode
)
{
if
(
!
dentry
->
d_inode
)
{
struct
configfs_dirent
*
sd
=
dentry
->
d_fsdata
;
struct
configfs_dirent
*
sd
=
dentry
->
d_fsdata
;
if
((
inode
=
configfs_new_inode
(
mode
,
sd
)))
{
if
((
inode
=
configfs_new_inode
(
mode
,
sd
,
dentry
->
d_sb
)))
{
if
(
dentry
->
d_parent
&&
dentry
->
d_parent
->
d_inode
)
{
if
(
dentry
->
d_parent
&&
dentry
->
d_parent
->
d_inode
)
{
struct
inode
*
p_inode
=
dentry
->
d_parent
->
d_inode
;
struct
inode
*
p_inode
=
dentry
->
d_parent
->
d_inode
;
p_inode
->
i_mtime
=
p_inode
->
i_ctime
=
CURRENT_TIME
;
p_inode
->
i_mtime
=
p_inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/configfs/mount.c
View file @
b7c177fc
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#define CONFIGFS_MAGIC 0x62656570
#define CONFIGFS_MAGIC 0x62656570
struct
vfsmount
*
configfs_mount
=
NULL
;
struct
vfsmount
*
configfs_mount
=
NULL
;
struct
super_block
*
configfs_sb
=
NULL
;
struct
kmem_cache
*
configfs_dir_cachep
;
struct
kmem_cache
*
configfs_dir_cachep
;
static
int
configfs_mnt_count
=
0
;
static
int
configfs_mnt_count
=
0
;
...
@@ -77,10 +76,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -77,10 +76,9 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
sb
->
s_magic
=
CONFIGFS_MAGIC
;
sb
->
s_magic
=
CONFIGFS_MAGIC
;
sb
->
s_op
=
&
configfs_ops
;
sb
->
s_op
=
&
configfs_ops
;
sb
->
s_time_gran
=
1
;
sb
->
s_time_gran
=
1
;
configfs_sb
=
sb
;
inode
=
configfs_new_inode
(
S_IFDIR
|
S_IRWXU
|
S_IRUGO
|
S_IXUGO
,
inode
=
configfs_new_inode
(
S_IFDIR
|
S_IRWXU
|
S_IRUGO
|
S_IXUGO
,
&
configfs_root
);
&
configfs_root
,
sb
);
if
(
inode
)
{
if
(
inode
)
{
inode
->
i_op
=
&
configfs_root_inode_operations
;
inode
->
i_op
=
&
configfs_root_inode_operations
;
inode
->
i_fop
=
&
configfs_dir_operations
;
inode
->
i_fop
=
&
configfs_dir_operations
;
...
...
fs/configfs/symlink.c
View file @
b7c177fc
...
@@ -110,13 +110,13 @@ static int create_link(struct config_item *parent_item,
...
@@ -110,13 +110,13 @@ static int create_link(struct config_item *parent_item,
static
int
get_target
(
const
char
*
symname
,
struct
path
*
path
,
static
int
get_target
(
const
char
*
symname
,
struct
path
*
path
,
struct
config_item
**
target
)
struct
config_item
**
target
,
struct
super_block
*
sb
)
{
{
int
ret
;
int
ret
;
ret
=
kern_path
(
symname
,
LOOKUP_FOLLOW
|
LOOKUP_DIRECTORY
,
path
);
ret
=
kern_path
(
symname
,
LOOKUP_FOLLOW
|
LOOKUP_DIRECTORY
,
path
);
if
(
!
ret
)
{
if
(
!
ret
)
{
if
(
path
->
dentry
->
d_sb
==
configfs_
sb
)
{
if
(
path
->
dentry
->
d_sb
==
sb
)
{
*
target
=
configfs_get_config_item
(
path
->
dentry
);
*
target
=
configfs_get_config_item
(
path
->
dentry
);
if
(
!*
target
)
{
if
(
!*
target
)
{
ret
=
-
ENOENT
;
ret
=
-
ENOENT
;
...
@@ -158,7 +158,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
...
@@ -158,7 +158,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
!
type
->
ct_item_ops
->
allow_link
)
!
type
->
ct_item_ops
->
allow_link
)
goto
out_put
;
goto
out_put
;
ret
=
get_target
(
symname
,
&
path
,
&
target_item
);
ret
=
get_target
(
symname
,
&
path
,
&
target_item
,
dentry
->
d_sb
);
if
(
ret
)
if
(
ret
)
goto
out_put
;
goto
out_put
;
...
...
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