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
2279d7d0
Commit
2279d7d0
authored
Dec 03, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Dec 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] devfs major/minor removal
major/minor replaced with a single field (dev_t) in devfs_entry
parent
060a98d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
73 deletions
+46
-73
fs/devfs/base.c
fs/devfs/base.c
+28
-55
fs/devfs/util.c
fs/devfs/util.c
+13
-13
include/linux/devfs_fs_kernel.h
include/linux/devfs_fs_kernel.h
+5
-5
No files found.
fs/devfs/base.c
View file @
2279d7d0
...
@@ -770,8 +770,7 @@ struct file_type
...
@@ -770,8 +770,7 @@ struct file_type
struct
bdev_type
struct
bdev_type
{
{
struct
block_device_operations
*
ops
;
struct
block_device_operations
*
ops
;
unsigned
short
major
;
dev_t
dev
;
unsigned
short
minor
;
unsigned
char
autogen
:
1
;
unsigned
char
autogen
:
1
;
unsigned
char
removable
:
1
;
unsigned
char
removable
:
1
;
};
};
...
@@ -779,8 +778,7 @@ struct bdev_type
...
@@ -779,8 +778,7 @@ struct bdev_type
struct
cdev_type
struct
cdev_type
{
{
struct
file_operations
*
ops
;
struct
file_operations
*
ops
;
unsigned
short
major
;
dev_t
dev
;
unsigned
short
minor
;
unsigned
char
autogen
:
1
;
unsigned
char
autogen
:
1
;
};
};
...
@@ -937,17 +935,9 @@ void devfs_put (devfs_handle_t de)
...
@@ -937,17 +935,9 @@ void devfs_put (devfs_handle_t de)
de
->
parent
?
de
->
parent
->
name
:
"no parent"
);
de
->
parent
?
de
->
parent
->
name
:
"no parent"
);
if
(
S_ISLNK
(
de
->
mode
)
)
kfree
(
de
->
u
.
symlink
.
linkname
);
if
(
S_ISLNK
(
de
->
mode
)
)
kfree
(
de
->
u
.
symlink
.
linkname
);
if
(
S_ISCHR
(
de
->
mode
)
&&
de
->
u
.
cdev
.
autogen
)
if
(
S_ISCHR
(
de
->
mode
)
&&
de
->
u
.
cdev
.
autogen
)
{
devfs_dealloc_devnum
(
DEVFS_SPECIAL_CHR
,
de
->
u
.
cdev
.
dev
);
devfs_dealloc_devnum
(
DEVFS_SPECIAL_CHR
,
mk_kdev
(
de
->
u
.
cdev
.
major
,
de
->
u
.
cdev
.
minor
)
);
}
if
(
S_ISBLK
(
de
->
mode
)
&&
de
->
u
.
bdev
.
autogen
)
if
(
S_ISBLK
(
de
->
mode
)
&&
de
->
u
.
bdev
.
autogen
)
{
devfs_dealloc_devnum
(
DEVFS_SPECIAL_BLK
,
de
->
u
.
bdev
.
dev
);
devfs_dealloc_devnum
(
DEVFS_SPECIAL_BLK
,
mk_kdev
(
de
->
u
.
bdev
.
major
,
de
->
u
.
bdev
.
minor
)
);
}
WRITE_ENTRY_MAGIC
(
de
,
0
);
WRITE_ENTRY_MAGIC
(
de
,
0
);
#ifdef CONFIG_DEVFS_DEBUG
#ifdef CONFIG_DEVFS_DEBUG
spin_lock
(
&
stat_lock
);
spin_lock
(
&
stat_lock
);
...
@@ -1094,7 +1084,6 @@ static int _devfs_append_entry (devfs_handle_t dir, devfs_handle_t de,
...
@@ -1094,7 +1084,6 @@ static int _devfs_append_entry (devfs_handle_t dir, devfs_handle_t de,
static
struct
devfs_entry
*
_devfs_get_root_entry
(
void
)
static
struct
devfs_entry
*
_devfs_get_root_entry
(
void
)
{
{
kdev_t
devnum
;
struct
devfs_entry
*
new
;
struct
devfs_entry
*
new
;
static
spinlock_t
root_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
root_lock
=
SPIN_LOCK_UNLOCKED
;
...
@@ -1113,17 +1102,13 @@ static struct devfs_entry *_devfs_get_root_entry (void)
...
@@ -1113,17 +1102,13 @@ static struct devfs_entry *_devfs_get_root_entry (void)
/* And create the entry for ".devfsd" */
/* And create the entry for ".devfsd" */
if
(
(
new
=
_devfs_alloc_entry
(
".devfsd"
,
0
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
)
)
if
(
(
new
=
_devfs_alloc_entry
(
".devfsd"
,
0
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
)
)
==
NULL
)
return
NULL
;
==
NULL
)
return
NULL
;
devnum
=
devfs_alloc_devnum
(
DEVFS_SPECIAL_CHR
);
new
->
u
.
cdev
.
dev
=
devfs_alloc_devnum
(
DEVFS_SPECIAL_CHR
);
new
->
u
.
cdev
.
major
=
major
(
devnum
);
new
->
u
.
cdev
.
minor
=
minor
(
devnum
);
new
->
u
.
cdev
.
ops
=
&
devfsd_fops
;
new
->
u
.
cdev
.
ops
=
&
devfsd_fops
;
_devfs_append_entry
(
root_entry
,
new
,
FALSE
,
NULL
);
_devfs_append_entry
(
root_entry
,
new
,
FALSE
,
NULL
);
#ifdef CONFIG_DEVFS_DEBUG
#ifdef CONFIG_DEVFS_DEBUG
if
(
(
new
=
_devfs_alloc_entry
(
".stat"
,
0
,
S_IFCHR
|
S_IRUGO
|
S_IWUGO
)
)
if
(
(
new
=
_devfs_alloc_entry
(
".stat"
,
0
,
S_IFCHR
|
S_IRUGO
|
S_IWUGO
)
)
==
NULL
)
return
NULL
;
==
NULL
)
return
NULL
;
devnum
=
devfs_alloc_devnum
(
DEVFS_SPECIAL_CHR
);
new
->
u
.
cdev
.
dev
=
devfs_alloc_devnum
(
DEVFS_SPECIAL_CHR
);
new
->
u
.
cdev
.
major
=
major
(
devnum
);
new
->
u
.
cdev
.
minor
=
minor
(
devnum
);
new
->
u
.
cdev
.
ops
=
&
stat_fops
;
new
->
u
.
cdev
.
ops
=
&
stat_fops
;
_devfs_append_entry
(
root_entry
,
new
,
FALSE
,
NULL
);
_devfs_append_entry
(
root_entry
,
new
,
FALSE
,
NULL
);
#endif
#endif
...
@@ -1486,7 +1471,7 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
...
@@ -1486,7 +1471,7 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
{
{
char
devtype
=
S_ISCHR
(
mode
)
?
DEVFS_SPECIAL_CHR
:
DEVFS_SPECIAL_BLK
;
char
devtype
=
S_ISCHR
(
mode
)
?
DEVFS_SPECIAL_CHR
:
DEVFS_SPECIAL_BLK
;
int
err
;
int
err
;
kdev_t
devnum
=
NODEV
;
dev_t
devnum
=
0
,
dev
=
MKDEV
(
major
,
minor
)
;
struct
devfs_entry
*
de
;
struct
devfs_entry
*
de
;
if
(
name
==
NULL
)
if
(
name
==
NULL
)
...
@@ -1512,30 +1497,27 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
...
@@ -1512,30 +1497,27 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
if
(
(
S_ISCHR
(
mode
)
||
S_ISBLK
(
mode
)
)
&&
if
(
(
S_ISCHR
(
mode
)
||
S_ISBLK
(
mode
)
)
&&
(
flags
&
DEVFS_FL_AUTO_DEVNUM
)
)
(
flags
&
DEVFS_FL_AUTO_DEVNUM
)
)
{
{
if
(
kdev_none
(
devnum
=
devfs_alloc_devnum
(
devtype
)
)
)
devnum
=
devfs_alloc_devnum
(
devtype
);
{
if
(
!
devnum
)
{
PRINTK
(
"(%s): exhausted %s device numbers
\n
"
,
PRINTK
(
"(%s): exhausted %s device numbers
\n
"
,
name
,
S_ISCHR
(
mode
)
?
"char"
:
"block"
);
name
,
S_ISCHR
(
mode
)
?
"char"
:
"block"
);
return
NULL
;
return
NULL
;
}
}
major
=
major
(
devnum
);
dev
=
devnum
;
minor
=
minor
(
devnum
);
}
}
if
(
(
de
=
_devfs_prepare_leaf
(
&
dir
,
name
,
mode
)
)
==
NULL
)
if
(
(
de
=
_devfs_prepare_leaf
(
&
dir
,
name
,
mode
)
)
==
NULL
)
{
{
PRINTK
(
"(%s): could not prepare leaf
\n
"
,
name
);
PRINTK
(
"(%s): could not prepare leaf
\n
"
,
name
);
if
(
!
kdev_none
(
devnum
)
)
devfs_dealloc_devnum
(
devtype
,
devnum
);
if
(
devnum
)
devfs_dealloc_devnum
(
devtype
,
devnum
);
return
NULL
;
return
NULL
;
}
}
if
(
S_ISCHR
(
mode
))
{
if
(
S_ISCHR
(
mode
))
{
de
->
u
.
cdev
.
major
=
major
;
de
->
u
.
cdev
.
dev
=
dev
;
de
->
u
.
cdev
.
minor
=
minor
;
de
->
u
.
cdev
.
autogen
=
devnum
!=
0
;
de
->
u
.
cdev
.
autogen
=
kdev_none
(
devnum
)
?
FALSE
:
TRUE
;
de
->
u
.
cdev
.
ops
=
ops
;
de
->
u
.
cdev
.
ops
=
ops
;
}
else
if
(
S_ISBLK
(
mode
))
{
}
else
if
(
S_ISBLK
(
mode
))
{
de
->
u
.
bdev
.
major
=
major
;
de
->
u
.
bdev
.
dev
=
dev
;
de
->
u
.
bdev
.
minor
=
minor
;
de
->
u
.
cdev
.
autogen
=
devnum
!=
0
;
de
->
u
.
bdev
.
autogen
=
kdev_none
(
devnum
)
?
FALSE
:
TRUE
;
de
->
u
.
bdev
.
ops
=
ops
;
de
->
u
.
bdev
.
ops
=
ops
;
if
(
flags
&
DEVFS_FL_REMOVABLE
)
de
->
u
.
bdev
.
removable
=
TRUE
;
if
(
flags
&
DEVFS_FL_REMOVABLE
)
de
->
u
.
bdev
.
removable
=
TRUE
;
}
else
if
(
S_ISREG
(
mode
)
)
{
}
else
if
(
S_ISREG
(
mode
)
)
{
...
@@ -1562,7 +1544,7 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
...
@@ -1562,7 +1544,7 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
{
{
PRINTK
(
"(%s): could not append to parent, err: %d
\n
"
,
name
,
err
);
PRINTK
(
"(%s): could not append to parent, err: %d
\n
"
,
name
,
err
);
devfs_put
(
dir
);
devfs_put
(
dir
);
if
(
!
kdev_none
(
devnum
)
)
devfs_dealloc_devnum
(
devtype
,
devnum
);
if
(
devnum
)
devfs_dealloc_devnum
(
devtype
,
devnum
);
return
NULL
;
return
NULL
;
}
}
DPRINTK
(
DEBUG_REGISTER
,
"(%s): de: %p dir: %p
\"
%s
\"
pp: %p
\n
"
,
DPRINTK
(
DEBUG_REGISTER
,
"(%s): de: %p dir: %p
\"
%s
\"
pp: %p
\n
"
,
...
@@ -1787,10 +1769,6 @@ devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name, void *info)
...
@@ -1787,10 +1769,6 @@ devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name, void *info)
* @dir: The handle to the parent devfs directory entry. If this is %NULL the
* @dir: The handle to the parent devfs directory entry. If this is %NULL the
* name is relative to the root of the devfs.
* name is relative to the root of the devfs.
* @name: The name of the entry.
* @name: The name of the entry.
* @major: The major number. This is used if @name is %NULL.
* @minor: The minor number. This is used if @name is %NULL.
* @type: The type of special file to search for. This may be either
* %DEVFS_SPECIAL_CHR or %DEVFS_SPECIAL_BLK.
* @traverse_symlinks: If %TRUE then symlink entries in the devfs namespace are
* @traverse_symlinks: If %TRUE then symlink entries in the devfs namespace are
* traversed. Symlinks pointing out of the devfs namespace will cause a
* traversed. Symlinks pointing out of the devfs namespace will cause a
* failure. Symlink traversal consumes stack space.
* failure. Symlink traversal consumes stack space.
...
@@ -2162,7 +2140,7 @@ static int check_disc_changed (struct devfs_entry *de)
...
@@ -2162,7 +2140,7 @@ static int check_disc_changed (struct devfs_entry *de)
{
{
int
tmp
;
int
tmp
;
int
retval
=
0
;
int
retval
=
0
;
dev_t
dev
=
MKDEV
(
de
->
u
.
bdev
.
major
,
de
->
u
.
bdev
.
minor
)
;
dev_t
dev
=
de
->
u
.
bdev
.
dev
;
extern
int
warn_no_part
;
extern
int
warn_no_part
;
if
(
!
S_ISBLK
(
de
->
mode
))
if
(
!
S_ISBLK
(
de
->
mode
))
...
@@ -2342,14 +2320,12 @@ static struct inode *_devfs_get_vfs_inode (struct super_block *sb,
...
@@ -2342,14 +2320,12 @@ static struct inode *_devfs_get_vfs_inode (struct super_block *sb,
inode
->
i_rdev
=
NODEV
;
inode
->
i_rdev
=
NODEV
;
if
(
S_ISCHR
(
de
->
mode
)
)
if
(
S_ISCHR
(
de
->
mode
)
)
{
{
inode
->
i_rdev
=
mk_kdev
(
de
->
u
.
cdev
.
major
,
inode
->
i_rdev
=
to_kdev_t
(
de
->
u
.
cdev
.
dev
);
de
->
u
.
cdev
.
minor
);
inode
->
i_cdev
=
cdget
(
de
->
u
.
cdev
.
dev
);
inode
->
i_cdev
=
cdget
(
kdev_t_to_nr
(
inode
->
i_rdev
)
);
}
}
else
if
(
S_ISBLK
(
de
->
mode
)
)
else
if
(
S_ISBLK
(
de
->
mode
)
)
{
{
inode
->
i_rdev
=
mk_kdev
(
de
->
u
.
bdev
.
major
,
inode
->
i_rdev
=
to_kdev_t
(
de
->
u
.
bdev
.
dev
);
de
->
u
.
bdev
.
minor
);
if
(
bd_acquire
(
inode
)
!=
0
)
if
(
bd_acquire
(
inode
)
!=
0
)
PRINTK
(
"(%d): no block device from bdget()
\n
"
,(
int
)
inode
->
i_ino
);
PRINTK
(
"(%d): no block device from bdget()
\n
"
,(
int
)
inode
->
i_ino
);
}
}
...
@@ -2847,13 +2823,10 @@ static int devfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
...
@@ -2847,13 +2823,10 @@ static int devfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
de
=
_devfs_alloc_entry
(
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
mode
);
de
=
_devfs_alloc_entry
(
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
mode
);
if
(
!
de
)
return
-
ENOMEM
;
if
(
!
de
)
return
-
ENOMEM
;
de
->
vfs_deletable
=
TRUE
;
de
->
vfs_deletable
=
TRUE
;
if
(
S_ISCHR
(
mode
))
{
if
(
S_ISCHR
(
mode
))
de
->
u
.
cdev
.
major
=
MAJOR
(
rdev
);
de
->
u
.
cdev
.
dev
=
rdev
;
de
->
u
.
cdev
.
minor
=
MINOR
(
rdev
);
else
if
(
S_ISBLK
(
mode
))
}
else
if
(
S_ISBLK
(
mode
))
{
de
->
u
.
bdev
.
dev
=
rdev
;
de
->
u
.
bdev
.
major
=
MAJOR
(
rdev
);
de
->
u
.
bdev
.
minor
=
MINOR
(
rdev
);
}
if
(
(
err
=
_devfs_append_entry
(
parent
,
de
,
FALSE
,
NULL
)
)
!=
0
)
if
(
(
err
=
_devfs_append_entry
(
parent
,
de
,
FALSE
,
NULL
)
)
!=
0
)
return
err
;
return
err
;
de
->
inode
.
uid
=
current
->
euid
;
de
->
inode
.
uid
=
current
->
euid
;
...
@@ -3006,11 +2979,11 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
...
@@ -3006,11 +2979,11 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
info
->
gid
=
entry
->
gid
;
info
->
gid
=
entry
->
gid
;
de
=
entry
->
de
;
de
=
entry
->
de
;
if
(
S_ISCHR
(
de
->
mode
))
{
if
(
S_ISCHR
(
de
->
mode
))
{
info
->
major
=
de
->
u
.
cdev
.
major
;
info
->
major
=
MAJOR
(
de
->
u
.
cdev
.
dev
)
;
info
->
minor
=
de
->
u
.
cdev
.
minor
;
info
->
minor
=
MINOR
(
de
->
u
.
cdev
.
dev
)
;
}
else
if
(
S_ISBLK
(
de
->
mode
))
{
}
else
if
(
S_ISBLK
(
de
->
mode
))
{
info
->
major
=
de
->
u
.
bdev
.
major
;
info
->
major
=
MAJOR
(
de
->
u
.
bdev
.
dev
)
;
info
->
minor
=
de
->
u
.
bdev
.
minor
;
info
->
minor
=
MINOR
(
de
->
u
.
bdev
.
dev
)
;
}
}
pos
=
devfs_generate_path
(
de
,
info
->
devname
,
DEVFS_PATHLEN
);
pos
=
devfs_generate_path
(
de
,
info
->
devname
,
DEVFS_PATHLEN
);
if
(
pos
<
0
)
return
pos
;
if
(
pos
<
0
)
return
pos
;
...
...
fs/devfs/util.c
View file @
2279d7d0
...
@@ -253,7 +253,7 @@ static struct device_list char_list;
...
@@ -253,7 +253,7 @@ static struct device_list char_list;
* This routine is thread safe and may block.
* This routine is thread safe and may block.
*/
*/
k
dev_t
devfs_alloc_devnum
(
char
type
)
dev_t
devfs_alloc_devnum
(
char
type
)
{
{
int
minor
;
int
minor
;
struct
semaphore
*
semaphore
;
struct
semaphore
*
semaphore
;
...
@@ -270,12 +270,12 @@ kdev_t devfs_alloc_devnum (char type)
...
@@ -270,12 +270,12 @@ kdev_t devfs_alloc_devnum (char type)
semaphore
=
&
block_semaphore
;
semaphore
=
&
block_semaphore
;
list
=
&
block_list
;
list
=
&
block_list
;
}
}
if
(
list
->
none_free
)
return
NODEV
;
/* Fast test */
if
(
list
->
none_free
)
return
0
;
/* Fast test */
down
(
semaphore
);
down
(
semaphore
);
if
(
list
->
none_free
)
if
(
list
->
none_free
)
{
{
up
(
semaphore
);
up
(
semaphore
);
return
NODEV
;
return
0
;
}
}
for
(
entry
=
list
->
first
;
entry
!=
NULL
;
entry
=
entry
->
next
)
for
(
entry
=
list
->
first
;
entry
!=
NULL
;
entry
=
entry
->
next
)
{
{
...
@@ -283,14 +283,14 @@ kdev_t devfs_alloc_devnum (char type)
...
@@ -283,14 +283,14 @@ kdev_t devfs_alloc_devnum (char type)
if
(
minor
>=
256
)
continue
;
if
(
minor
>=
256
)
continue
;
__set_bit
(
minor
,
entry
->
bits
);
__set_bit
(
minor
,
entry
->
bits
);
up
(
semaphore
);
up
(
semaphore
);
return
mk_kdev
(
entry
->
major
,
minor
);
return
MKDEV
(
entry
->
major
,
minor
);
}
}
/* Need to allocate a new major */
/* Need to allocate a new major */
if
(
(
entry
=
kmalloc
(
sizeof
*
entry
,
GFP_KERNEL
)
)
==
NULL
)
if
(
(
entry
=
kmalloc
(
sizeof
*
entry
,
GFP_KERNEL
)
)
==
NULL
)
{
{
list
->
none_free
=
1
;
list
->
none_free
=
1
;
up
(
semaphore
);
up
(
semaphore
);
return
NODEV
;
return
0
;
}
}
memset
(
entry
,
0
,
sizeof
*
entry
);
memset
(
entry
,
0
,
sizeof
*
entry
);
if
(
(
entry
->
major
=
devfs_alloc_major
(
type
)
)
<
0
)
if
(
(
entry
->
major
=
devfs_alloc_major
(
type
)
)
<
0
)
...
@@ -298,14 +298,14 @@ kdev_t devfs_alloc_devnum (char type)
...
@@ -298,14 +298,14 @@ kdev_t devfs_alloc_devnum (char type)
list
->
none_free
=
1
;
list
->
none_free
=
1
;
up
(
semaphore
);
up
(
semaphore
);
kfree
(
entry
);
kfree
(
entry
);
return
NODEV
;
return
0
;
}
}
__set_bit
(
0
,
entry
->
bits
);
__set_bit
(
0
,
entry
->
bits
);
if
(
list
->
first
==
NULL
)
list
->
first
=
entry
;
if
(
list
->
first
==
NULL
)
list
->
first
=
entry
;
else
list
->
last
->
next
=
entry
;
else
list
->
last
->
next
=
entry
;
list
->
last
=
entry
;
list
->
last
=
entry
;
up
(
semaphore
);
up
(
semaphore
);
return
mk_kdev
(
entry
->
major
,
0
);
return
MKDEV
(
entry
->
major
,
0
);
}
/* End Function devfs_alloc_devnum */
}
/* End Function devfs_alloc_devnum */
EXPORT_SYMBOL
(
devfs_alloc_devnum
);
EXPORT_SYMBOL
(
devfs_alloc_devnum
);
...
@@ -318,14 +318,14 @@ EXPORT_SYMBOL(devfs_alloc_devnum);
...
@@ -318,14 +318,14 @@ EXPORT_SYMBOL(devfs_alloc_devnum);
* This routine is thread safe and may block.
* This routine is thread safe and may block.
*/
*/
void
devfs_dealloc_devnum
(
char
type
,
k
dev_t
devnum
)
void
devfs_dealloc_devnum
(
char
type
,
dev_t
devnum
)
{
{
int
major
,
minor
;
int
major
,
minor
;
struct
semaphore
*
semaphore
;
struct
semaphore
*
semaphore
;
struct
device_list
*
list
;
struct
device_list
*
list
;
struct
minor_list
*
entry
;
struct
minor_list
*
entry
;
if
(
kdev_none
(
devnum
)
)
return
;
if
(
!
devnum
)
return
;
if
(
type
==
DEVFS_SPECIAL_CHR
)
if
(
type
==
DEVFS_SPECIAL_CHR
)
{
{
semaphore
=
&
char_semaphore
;
semaphore
=
&
char_semaphore
;
...
@@ -336,8 +336,8 @@ void devfs_dealloc_devnum (char type, kdev_t devnum)
...
@@ -336,8 +336,8 @@ void devfs_dealloc_devnum (char type, kdev_t devnum)
semaphore
=
&
block_semaphore
;
semaphore
=
&
block_semaphore
;
list
=
&
block_list
;
list
=
&
block_list
;
}
}
major
=
major
(
devnum
);
major
=
MAJOR
(
devnum
);
minor
=
minor
(
devnum
);
minor
=
MINOR
(
devnum
);
down
(
semaphore
);
down
(
semaphore
);
for
(
entry
=
list
->
first
;
entry
!=
NULL
;
entry
=
entry
->
next
)
for
(
entry
=
list
->
first
;
entry
!=
NULL
;
entry
=
entry
->
next
)
{
{
...
@@ -348,12 +348,12 @@ void devfs_dealloc_devnum (char type, kdev_t devnum)
...
@@ -348,12 +348,12 @@ void devfs_dealloc_devnum (char type, kdev_t devnum)
if
(
was_set
)
list
->
none_free
=
0
;
if
(
was_set
)
list
->
none_free
=
0
;
up
(
semaphore
);
up
(
semaphore
);
if
(
!
was_set
)
if
(
!
was_set
)
PRINTK
(
"(): device %s was already free
\n
"
,
kdevname
(
devnum
)
);
PRINTK
(
"(): device %s was already free
\n
"
,
kdevname
(
to_kdev_t
(
devnum
)
)
);
return
;
return
;
}
}
up
(
semaphore
);
up
(
semaphore
);
PRINTK
(
"(): major for %s not previously allocated
\n
"
,
PRINTK
(
"(): major for %s not previously allocated
\n
"
,
kdevname
(
devnum
)
);
kdevname
(
to_kdev_t
(
devnum
)
)
);
}
/* End Function devfs_dealloc_devnum */
}
/* End Function devfs_dealloc_devnum */
EXPORT_SYMBOL
(
devfs_dealloc_devnum
);
EXPORT_SYMBOL
(
devfs_dealloc_devnum
);
...
...
include/linux/devfs_fs_kernel.h
View file @
2279d7d0
...
@@ -74,8 +74,8 @@ extern void devfs_register_series (devfs_handle_t dir, const char *format,
...
@@ -74,8 +74,8 @@ extern void devfs_register_series (devfs_handle_t dir, const char *format,
umode_t
mode
,
void
*
ops
,
void
*
info
);
umode_t
mode
,
void
*
ops
,
void
*
info
);
extern
int
devfs_alloc_major
(
char
type
);
extern
int
devfs_alloc_major
(
char
type
);
extern
void
devfs_dealloc_major
(
char
type
,
int
major
);
extern
void
devfs_dealloc_major
(
char
type
,
int
major
);
extern
k
dev_t
devfs_alloc_devnum
(
char
type
);
extern
dev_t
devfs_alloc_devnum
(
char
type
);
extern
void
devfs_dealloc_devnum
(
char
type
,
k
dev_t
devnum
);
extern
void
devfs_dealloc_devnum
(
char
type
,
dev_t
devnum
);
extern
int
devfs_alloc_unique_number
(
struct
unique_numspace
*
space
);
extern
int
devfs_alloc_unique_number
(
struct
unique_numspace
*
space
);
extern
void
devfs_dealloc_unique_number
(
struct
unique_numspace
*
space
,
extern
void
devfs_dealloc_unique_number
(
struct
unique_numspace
*
space
,
int
number
);
int
number
);
...
@@ -199,12 +199,12 @@ static inline void devfs_dealloc_major (char type, int major)
...
@@ -199,12 +199,12 @@ static inline void devfs_dealloc_major (char type, int major)
return
;
return
;
}
}
static
inline
k
dev_t
devfs_alloc_devnum
(
char
type
)
static
inline
dev_t
devfs_alloc_devnum
(
char
type
)
{
{
return
NODEV
;
return
0
;
}
}
static
inline
void
devfs_dealloc_devnum
(
char
type
,
k
dev_t
devnum
)
static
inline
void
devfs_dealloc_devnum
(
char
type
,
dev_t
devnum
)
{
{
return
;
return
;
}
}
...
...
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