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
b99d34fb
Commit
b99d34fb
authored
Jun 05, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://ldm.bkbits.net/linux-2.5-core
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
bc1f1afe
dcba0659
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
96 deletions
+51
-96
drivers/base/core.c
drivers/base/core.c
+29
-0
fs/filesystems.c
fs/filesystems.c
+14
-75
fs/namespace.c
fs/namespace.c
+2
-2
include/linux/device.h
include/linux/device.h
+2
-1
include/linux/fs.h
include/linux/fs.h
+0
-1
lib/kobject.c
lib/kobject.c
+4
-17
No files found.
drivers/base/core.c
View file @
b99d34fb
...
...
@@ -343,11 +343,40 @@ void device_unregister(struct device * dev)
put_device
(
dev
);
}
/**
* device_for_each_child - device child iterator.
* @dev: parent struct device.
* @data: data for the callback.
* @fn: function to be called for each device.
*
* Iterate over @dev's child devices, and call @fn for each,
* passing it @data.
*
* We check the return of @fn each time. If it returns anything
* other than 0, we break out and return that value.
*/
int
device_for_each_child
(
struct
device
*
dev
,
void
*
data
,
int
(
*
fn
)(
struct
device
*
,
void
*
))
{
struct
device
*
child
;
int
error
=
0
;
down_read
(
&
devices_subsys
.
rwsem
);
list_for_each_entry
(
child
,
&
dev
->
children
,
node
)
{
if
((
error
=
fn
(
child
,
data
)))
break
;
}
up_read
(
&
devices_subsys
.
rwsem
);
return
error
;
}
int
__init
devices_init
(
void
)
{
return
subsystem_register
(
&
devices_subsys
);
}
EXPORT_SYMBOL
(
device_for_each_child
);
EXPORT_SYMBOL
(
device_initialize
);
EXPORT_SYMBOL
(
device_add
);
EXPORT_SYMBOL
(
device_register
);
...
...
fs/filesystems.c
View file @
b99d34fb
...
...
@@ -49,38 +49,6 @@ static struct file_system_type **find_filesystem(const char *name)
return
p
;
}
/* define fs_subsys */
static
decl_subsys
(
fs
,
NULL
,
NULL
);
static
int
register_fs_subsys
(
struct
file_system_type
*
fs
)
{
struct
subsystem
*
sub
=
&
fs
->
subsys
;
snprintf
(
sub
->
kset
.
kobj
.
name
,
KOBJ_NAME_LEN
,
"%s"
,
fs
->
name
);
subsys_set_kset
(
fs
,
fs_subsys
);
return
subsystem_register
(
sub
);
}
static
int
unlink_fs
(
struct
file_system_type
*
fs
)
{
struct
file_system_type
**
tmp
;
write_lock
(
&
file_systems_lock
);
tmp
=
&
file_systems
;
while
(
*
tmp
)
{
if
(
fs
==
*
tmp
)
{
*
tmp
=
fs
->
next
;
fs
->
next
=
NULL
;
write_unlock
(
&
file_systems_lock
);
return
0
;
}
tmp
=
&
(
*
tmp
)
->
next
;
}
write_unlock
(
&
file_systems_lock
);
return
-
EINVAL
;
}
/**
* register_filesystem - register a new filesystem
* @fs: the file system structure
...
...
@@ -111,12 +79,6 @@ int register_filesystem(struct file_system_type * fs)
else
*
p
=
fs
;
write_unlock
(
&
file_systems_lock
);
if
(
!
res
)
{
/* we implicitly possess reference to @fs during registration,
* so it cannot be unregister from under us. */
register_fs_subsys
(
fs
);
}
return
res
;
}
...
...
@@ -134,44 +96,21 @@ int register_filesystem(struct file_system_type * fs)
int
unregister_filesystem
(
struct
file_system_type
*
fs
)
{
int
res
;
res
=
unlink_fs
(
fs
);
if
(
!
res
)
subsystem_unregister
(
&
fs
->
subsys
);
return
res
;
}
extern
int
sysfs_init
(
void
);
/**
* fs_subsys_init - initialize sysfs and fs subsystem.
*
* In order to register filesystems in sysfs, it has to be
* initialized. Also, we need the base fs filesystem, so the
* registered filesystems have a home.
*
* During sysfs_init(), the registration of sysfs into itself
* will fail, since it's not mounted yet. To make sure that
* sysfs does show up, we re-register sysfs's embedded subsystem,
* which will get added, since sysfs is now mounted.
*/
void
__init
fs_subsys_init
(
void
)
{
struct
file_system_type
**
p
;
/* make sure sysfs is up and running */
sysfs_init
();
/* register fs_subsys */
subsystem_register
(
&
fs_subsys
);
p
=
find_filesystem
(
"sysfs"
);
struct
file_system_type
**
tmp
;
if
(
p
)
/* make sure it's registered */
register_fs_subsys
(
*
p
);
write_lock
(
&
file_systems_lock
);
tmp
=
&
file_systems
;
while
(
*
tmp
)
{
if
(
fs
==
*
tmp
)
{
*
tmp
=
fs
->
next
;
fs
->
next
=
NULL
;
write_unlock
(
&
file_systems_lock
);
return
0
;
}
tmp
=
&
(
*
tmp
)
->
next
;
}
write_unlock
(
&
file_systems_lock
);
return
-
EINVAL
;
}
static
int
fs_index
(
const
char
__user
*
__name
)
...
...
fs/namespace.c
View file @
b99d34fb
...
...
@@ -24,7 +24,7 @@
#include <asm/uaccess.h>
extern
int
__init
init_rootfs
(
void
);
extern
int
__init
fs_subsy
s_init
(
void
);
extern
int
__init
sysf
s_init
(
void
);
static
struct
list_head
*
mount_hashtable
;
static
int
hash_mask
,
hash_bits
;
...
...
@@ -1144,7 +1144,7 @@ void __init mnt_init(unsigned long mempages)
d
++
;
i
--
;
}
while
(
i
);
fs_subsy
s_init
();
sysf
s_init
();
init_rootfs
();
init_mount_tree
();
}
include/linux/device.h
View file @
b99d34fb
...
...
@@ -194,7 +194,6 @@ struct class_device {
void
*
class_data
;
/* class-specific data */
char
class_id
[
BUS_ID_SIZE
];
/* unique to this class */
void
(
*
release
)(
struct
class_device
*
class_dev
);
};
static
inline
void
*
...
...
@@ -303,6 +302,8 @@ extern void device_unregister(struct device * dev);
extern
void
device_initialize
(
struct
device
*
dev
);
extern
int
device_add
(
struct
device
*
dev
);
extern
void
device_del
(
struct
device
*
dev
);
extern
int
device_for_each_child
(
struct
device
*
,
void
*
,
int
(
*
fn
)(
struct
device
*
,
void
*
));
/*
* Manual binding of a device to driver. See drivers/base/bus.c
...
...
include/linux/fs.h
View file @
b99d34fb
...
...
@@ -917,7 +917,6 @@ struct export_operations {
struct
file_system_type
{
const
char
*
name
;
struct
subsystem
subsys
;
int
fs_flags
;
struct
super_block
*
(
*
get_sb
)
(
struct
file_system_type
*
,
int
,
const
char
*
,
void
*
);
...
...
lib/kobject.c
View file @
b99d34fb
...
...
@@ -17,10 +17,6 @@
#include <linux/module.h>
#include <linux/stat.h>
/* This lock can be removed entirely when the sysfs_init() code is cleaned up
* to not try to reference itself before it is initialized. */
static
spinlock_t
kobj_lock
=
SPIN_LOCK_UNLOCKED
;
/**
* populate_dir - populate directory with attributes.
* @kobj: object we're working on.
...
...
@@ -350,14 +346,12 @@ void kobject_unregister(struct kobject * kobj)
struct
kobject
*
kobject_get
(
struct
kobject
*
kobj
)
{
struct
kobject
*
ret
=
kobj
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
kobj_lock
,
flags
);
if
(
kobj
&&
atomic_read
(
&
kobj
->
refcount
)
>
0
)
if
(
kobj
)
{
WARN_ON
(
!
atomic_read
(
&
kobj
->
refcount
));
atomic_inc
(
&
kobj
->
refcount
);
else
}
else
ret
=
NULL
;
spin_unlock_irqrestore
(
&
kobj_lock
,
flags
);
return
ret
;
}
...
...
@@ -387,15 +381,8 @@ void kobject_cleanup(struct kobject * kobj)
void
kobject_put
(
struct
kobject
*
kobj
)
{
unsigned
long
flags
;
local_irq_save
(
flags
);
if
(
atomic_dec_and_lock
(
&
kobj
->
refcount
,
&
kobj_lock
))
{
spin_unlock_irqrestore
(
&
kobj_lock
,
flags
);
if
(
atomic_dec_and_test
(
&
kobj
->
refcount
))
kobject_cleanup
(
kobj
);
}
else
{
local_irq_restore
(
flags
);
}
}
...
...
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