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
2048d61c
Commit
2048d61c
authored
Apr 20, 2003
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] devfs: miscdev
parent
4977d1c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
drivers/char/misc.c
drivers/char/misc.c
+16
-10
include/linux/miscdevice.h
include/linux/miscdevice.h
+1
-1
No files found.
drivers/char/misc.c
View file @
2048d61c
...
...
@@ -167,7 +167,6 @@ static struct file_operations misc_fops = {
int
misc_register
(
struct
miscdevice
*
misc
)
{
struct
miscdevice
*
c
;
char
buf
[
256
];
if
(
misc
->
next
||
misc
->
prev
)
return
-
EBUSY
;
...
...
@@ -197,14 +196,21 @@ int misc_register(struct miscdevice * misc)
misc_minors
[
misc
->
minor
>>
3
]
|=
1
<<
(
misc
->
minor
&
7
);
/* yuck, yet another stupid special-casing. We should rather
add ->devfs_name to avoid this mess. */
snprintf
(
buf
,
sizeof
(
buf
),
strchr
(
misc
->
name
,
'/'
)
?
"%s"
:
"misc/%s"
,
misc
->
name
);
misc
->
devfs_handle
=
devfs_register
(
NULL
,
buf
,
0
,
MISC_MAJOR
,
misc
->
minor
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
,
misc
->
fops
,
NULL
);
/*
* please use it if you want to do fancy things with your
* name...
*/
if
(
misc
->
devfs_name
[
0
]
==
'\0'
)
{
/* yuck, yet another stupid special-casing.
whos actually using this? Please switch over
to ->devfs_name ASAP */
snprintf
(
misc
->
devfs_name
,
sizeof
(
misc
->
devfs_name
),
strchr
(
misc
->
name
,
'/'
)
?
"%s"
:
"misc/%s"
,
misc
->
name
);
}
devfs_register
(
NULL
,
misc
->
devfs_name
,
0
,
MISC_MAJOR
,
misc
->
minor
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
,
misc
->
fops
,
NULL
);
/*
* Add it to the front, so that later devices can "override"
...
...
@@ -238,7 +244,7 @@ int misc_deregister(struct miscdevice * misc)
misc
->
next
->
prev
=
misc
->
prev
;
misc
->
next
=
NULL
;
misc
->
prev
=
NULL
;
devfs_
unregister
(
misc
->
devfs_handl
e
);
devfs_
remove
(
misc
->
devfs_nam
e
);
if
(
i
<
DYNAMIC_MINORS
&&
i
>
0
)
{
misc_minors
[
i
>>
3
]
&=
~
(
1
<<
(
misc
->
minor
&
7
));
}
...
...
include/linux/miscdevice.h
View file @
2048d61c
...
...
@@ -44,7 +44,7 @@ struct miscdevice
const
char
*
name
;
struct
file_operations
*
fops
;
struct
miscdevice
*
next
,
*
prev
;
devfs_handle_t
devfs_handle
;
char
devfs_name
[
64
]
;
};
extern
int
misc_register
(
struct
miscdevice
*
misc
);
...
...
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