Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FPGA Configuration Space
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
FPGA Configuration Space
Commits
3994fe19
Commit
3994fe19
authored
12 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
sdbfs/kernel: device is now linked to core
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
e8e92f9d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sdbfs/kernel/sdbfs-core.c
+12
-5
12 additions, 5 deletions
sdbfs/kernel/sdbfs-core.c
sdbfs/kernel/sdbfs-device.c
+37
-3
37 additions, 3 deletions
sdbfs/kernel/sdbfs-device.c
sdbfs/kernel/sdbfs.h
+10
-2
10 additions, 2 deletions
sdbfs/kernel/sdbfs.h
with
59 additions
and
10 deletions
sdbfs/kernel/sdbfs-core.c
+
12
−
5
View file @
3994fe19
...
...
@@ -61,6 +61,14 @@ static int sdbfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct
inode
*
inode
;
struct
dentry
*
root
;
struct
sdbfs_dev
*
sd
;
/* HACK: this data is really a name */
sd
=
sdbfs_get_by_name
(
data
);
if
(
IS_ERR
(
sd
))
return
PTR_ERR
(
sd
);
sb
->
s_fs_info
=
sd
;
/* All of our data is organized as 64-byte blocks */
sb
->
s_blocksize
=
64
;
...
...
@@ -89,10 +97,9 @@ static int sdbfs_fill_super(struct super_block *sb, void *data, int silent)
static
struct
dentry
*
sdbfs_mount
(
struct
file_system_type
*
type
,
int
flags
,
const
char
*
name
,
void
*
data
)
{
/* FIXME: use "name" */
printk
(
"%s: flags 0x%x, name %s, data %p
\n
"
,
__func__
,
flags
,
name
,
data
);
return
mount_single
(
type
,
flags
,
data
,
sdbfs_fill_super
);
char
*
fakedata
=
(
char
*
)
name
;
/* HACK: use "name" as data, to use the mount_single helper */
return
mount_single
(
type
,
flags
,
fakedata
,
sdbfs_fill_super
);
}
static
void
sdbfs_kill_sb
(
struct
super_block
*
sb
)
...
...
@@ -101,7 +108,7 @@ static void sdbfs_kill_sb(struct super_block *sb)
kill_anon_super
(
sb
);
if
(
sd
)
module
_put
(
sd
->
ops
->
owner
);
sdbfs
_put
(
sd
);
}
static
struct
file_system_type
sdbfs_fs_type
=
{
...
...
This diff is collapsed.
Click to expand it.
sdbfs/kernel/sdbfs-device.c
+
37
−
3
View file @
3994fe19
...
...
@@ -15,16 +15,50 @@
#include
"sdbfs.h"
#include
"sdbfs-int.h"
static
LIST_HEAD
(
sdbfs_devlist
);
struct
sdbfs_dev
*
sdbfs_get_by_name
(
char
*
name
)
{
struct
sdbfs_dev
*
sd
;
list_for_each_entry
(
sd
,
&
sdbfs_devlist
,
list
)
if
(
!
strcmp
(
sd
->
name
,
name
))
goto
found
;
return
ERR_PTR
(
-
ENOENT
);
found:
if
(
try_module_get
(
sd
->
ops
->
owner
))
{
printk
(
"%s: %p
\n
"
,
__func__
,
sd
);
return
sd
;
}
return
ERR_PTR
(
-
ENOENT
);
}
void
sdbfs_put
(
struct
sdbfs_dev
*
sd
)
{
printk
(
"%s: %p
\n
"
,
__func__
,
sd
);
module_put
(
sd
->
ops
->
owner
);
}
int
sdbfs_register_device
(
struct
sdbfs_dev
*
d
)
/* Exported functions */
int
sdbfs_register_device
(
struct
sdbfs_dev
*
sd
)
{
return
-
EAGAIN
;
struct
sdbfs_dev
*
osd
;
list_for_each_entry
(
osd
,
&
sdbfs_devlist
,
list
)
if
(
!
strcmp
(
osd
->
name
,
sd
->
name
))
return
-
EBUSY
;
list_add
(
&
sd
->
list
,
&
sdbfs_devlist
);
return
0
;
}
EXPORT_SYMBOL
(
sdbfs_register_device
);
void
sdbfs_unregister_device
(
struct
sdbfs_dev
*
d
)
void
sdbfs_unregister_device
(
struct
sdbfs_dev
*
s
d
)
{
struct
sdbfs_dev
*
osd
;
list_for_each_entry
(
osd
,
&
sdbfs_devlist
,
list
)
if
(
osd
==
sd
)
list_del
(
&
sd
->
list
);
}
EXPORT_SYMBOL
(
sdbfs_unregister_device
);
This diff is collapsed.
Click to expand it.
sdbfs/kernel/sdbfs.h
+
10
−
2
View file @
3994fe19
...
...
@@ -31,10 +31,18 @@ struct sdbfs_dev_ops {
struct
sdbfs_dev
{
char
*
name
;
int
blocksize
;
unsigned
long
headerpos
;
struct
sdbfs_dev_ops
*
ops
;
struct
list_head
list
;
};
int
sdbfs_register_device
(
struct
sdbfs_dev
*
d
);
void
sdbfs_unregister_device
(
struct
sdbfs_dev
*
d
);
/* Internal inter-file calls */
struct
sdbfs_dev
*
sdbfs_get_by_name
(
char
*
name
);
void
sdbfs_put
(
struct
sdbfs_dev
*
sd
);
/* Exported to other modules */
int
sdbfs_register_device
(
struct
sdbfs_dev
*
sd
);
void
sdbfs_unregister_device
(
struct
sdbfs_dev
*
sd
);
#endif
/* __SDBFS_H__ */
This diff is collapsed.
Click to expand it.
Preview
0%
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