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
nexedi
linux
Commits
6f3caf15
Commit
6f3caf15
authored
Nov 27, 2002
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Plain Diff
Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
parents
828bb5f4
fdb47bc6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
16 deletions
+103
-16
drivers/base/node.c
drivers/base/node.c
+2
-2
drivers/block/genhd.c
drivers/block/genhd.c
+2
-2
drivers/pci/probe.c
drivers/pci/probe.c
+1
-0
fs/partitions/check.c
fs/partitions/check.c
+2
-4
fs/sysfs/inode.c
fs/sysfs/inode.c
+52
-8
include/linux/device.h
include/linux/device.h
+1
-0
include/linux/kobject.h
include/linux/kobject.h
+9
-0
lib/kobject.c
lib/kobject.c
+34
-0
No files found.
drivers/base/node.c
View file @
6f3caf15
...
...
@@ -93,7 +93,7 @@ int __init register_node(struct node *node, int num, struct node *parent)
static
int
__init
register_node_type
(
void
)
{
d
river_register
(
&
node_driver
);
return
d
evclass_register
(
&
node_devclass
);
d
evclass_register
(
&
node_devclass
);
return
d
river_register
(
&
node_driver
);
}
postcore_initcall
(
register_node_type
);
drivers/block/genhd.c
View file @
6f3caf15
...
...
@@ -408,11 +408,11 @@ struct gendisk *alloc_disk(int minors)
disk
->
minors
=
minors
;
while
(
minors
>>=
1
)
disk
->
minor_shift
++
;
kobject_init
(
&
disk
->
kobj
);
disk
->
kobj
.
subsys
=
&
block_subsys
;
kobject_init
(
&
disk
->
kobj
);
INIT_LIST_HEAD
(
&
disk
->
full_list
);
}
rand_initialize_disk
(
disk
);
}
return
disk
;
}
...
...
drivers/pci/probe.c
View file @
6f3caf15
...
...
@@ -448,6 +448,7 @@ struct pci_dev * __devinit pci_scan_device(struct pci_dev *temp)
/* now put in global tree */
strcpy
(
dev
->
dev
.
bus_id
,
dev
->
slot_name
);
dev
->
dev
.
dma_mask
=
&
dev
->
dma_mask
;
device_register
(
&
dev
->
dev
);
return
dev
;
...
...
fs/partitions/check.c
View file @
6f3caf15
...
...
@@ -377,7 +377,6 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
p
->
start_sect
=
start
;
p
->
nr_sects
=
len
;
devfs_register_partition
(
disk
,
part
);
kobject_init
(
&
p
->
kobj
);
snprintf
(
p
->
kobj
.
name
,
KOBJ_NAME_LEN
,
"%s%d"
,
disk
->
kobj
.
name
,
part
);
p
->
kobj
.
parent
=
&
disk
->
kobj
;
p
->
kobj
.
subsys
=
&
part_subsys
;
...
...
@@ -406,7 +405,7 @@ void register_disk(struct gendisk *disk)
s
=
strchr
(
disk
->
kobj
.
name
,
'/'
);
if
(
s
)
*
s
=
'!'
;
kobject_
register
(
&
disk
->
kobj
);
kobject_
add
(
&
disk
->
kobj
);
disk_sysfs_symlinks
(
disk
);
if
(
disk
->
flags
&
GENHD_FL_CD
)
...
...
@@ -529,8 +528,7 @@ void del_gendisk(struct gendisk *disk)
sysfs_remove_link
(
&
disk
->
driverfs_dev
->
kobj
,
"block"
);
put_device
(
disk
->
driverfs_dev
);
}
kobject_get
(
&
disk
->
kobj
);
/* kobject model is fucked in head */
kobject_unregister
(
&
disk
->
kobj
);
kobject_del
(
&
disk
->
kobj
);
}
struct
dev_name
{
...
...
fs/sysfs/inode.c
View file @
6f3caf15
...
...
@@ -96,9 +96,10 @@ static int sysfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t
if
(
!
dentry
->
d_inode
)
{
inode
=
sysfs_get_inode
(
dir
->
i_sb
,
mode
,
dev
);
if
(
inode
)
if
(
inode
)
{
d_instantiate
(
dentry
,
inode
);
else
dget
(
dentry
);
}
else
error
=
-
ENOSPC
;
}
else
error
=
-
EEXIST
;
...
...
@@ -135,14 +136,52 @@ static int sysfs_symlink(struct inode * dir, struct dentry *dentry, const char *
if
(
inode
)
{
int
l
=
strlen
(
symname
)
+
1
;
error
=
page_symlink
(
inode
,
symname
,
l
);
if
(
!
error
)
if
(
!
error
)
{
d_instantiate
(
dentry
,
inode
);
else
dget
(
dentry
);
}
else
iput
(
inode
);
}
return
error
;
}
#define to_subsys(k) container_of(k,struct subsystem,kobj)
#define to_sattr(a) container_of(a,struct subsys_attribute,attr)
/**
* Subsystem file operations.
* These operations allow subsystems to have files that can be
* read/written.
*/
ssize_t
subsys_attr_show
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
char
*
page
,
size_t
count
,
loff_t
off
)
{
struct
subsystem
*
s
=
to_subsys
(
kobj
);
struct
subsys_attribute
*
sattr
=
to_sattr
(
attr
);
ssize_t
ret
=
0
;
if
(
sattr
->
show
)
ret
=
sattr
->
show
(
s
,
page
,
count
,
off
);
return
ret
;
}
ssize_t
subsys_attr_store
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
const
char
*
page
,
size_t
count
,
loff_t
off
)
{
struct
subsystem
*
s
=
to_subsys
(
kobj
);
struct
subsys_attribute
*
sattr
=
to_sattr
(
attr
);
ssize_t
ret
=
0
;
if
(
sattr
->
store
)
ret
=
sattr
->
store
(
s
,
page
,
count
,
off
);
return
ret
;
}
static
struct
sysfs_ops
subsys_sysfs_ops
=
{
.
show
=
subsys_attr_show
,
.
store
=
subsys_attr_store
,
};
/**
* sysfs_read_file - read an attribute.
* @file: file pointer.
...
...
@@ -264,8 +303,13 @@ static int check_perm(struct inode * inode, struct file * file)
if
(
!
kobj
||
!
attr
)
goto
Einval
;
/* if the kobject has no subsystem, then it is a subsystem itself,
* so give it the subsys_sysfs_ops.
*/
if
(
kobj
->
subsys
)
ops
=
kobj
->
subsys
->
sysfs_ops
;
else
ops
=
&
subsys_sysfs_ops
;
/* No sysfs operations, either from having no subsystem,
* or the subsystem have no operations.
...
...
@@ -571,8 +615,8 @@ static void hash_and_remove(struct dentry * dir, const char * name)
/* make sure dentry is really there */
if
(
victim
->
d_inode
&&
(
victim
->
d_parent
->
d_inode
==
dir
->
d_inode
))
{
d_invalidate
(
victim
);
simple_unlink
(
dir
->
d_inode
,
victim
);
d_delete
(
victim
);
}
}
up
(
&
dir
->
d_inode
->
i_sem
);
...
...
@@ -631,15 +675,15 @@ void sysfs_remove_dir(struct kobject * kobj)
struct
dentry
*
d
=
list_entry
(
node
,
struct
dentry
,
d_child
);
/* make sure dentry is still there */
if
(
d
->
d_inode
)
{
d_invalidate
(
d
);
simple_unlink
(
dentry
->
d_inode
,
d
);
d_delete
(
dentry
);
}
}
up
(
&
dentry
->
d_inode
->
i_sem
);
d_invalidate
(
dentry
);
simple_rmdir
(
parent
->
d_inode
,
dentry
);
d_delete
(
dentry
);
up
(
&
parent
->
d_inode
->
i_sem
);
dput
(
parent
);
}
...
...
include/linux/device.h
View file @
6f3caf15
...
...
@@ -270,6 +270,7 @@ struct device {
being off. */
unsigned
char
*
saved_state
;
/* saved device state */
u64
*
dma_mask
;
/* dma mask (if dma'able device) */
void
(
*
release
)(
struct
device
*
dev
);
};
...
...
include/linux/kobject.h
View file @
6f3caf15
...
...
@@ -60,4 +60,13 @@ static inline void subsys_put(struct subsystem * s)
kobject_put
(
&
s
->
kobj
);
}
struct
subsys_attribute
{
struct
attribute
attr
;
ssize_t
(
*
show
)(
struct
subsystem
*
,
char
*
,
size_t
,
loff_t
);
ssize_t
(
*
store
)(
struct
subsystem
*
,
const
char
*
,
size_t
,
loff_t
);
};
extern
int
subsys_create_file
(
struct
subsystem
*
,
struct
subsys_attribute
*
);
extern
void
subsys_remove_file
(
struct
subsystem
*
,
struct
subsys_attribute
*
);
#endif
/* _KOBJECT_H_ */
lib/kobject.c
View file @
6f3caf15
...
...
@@ -229,6 +229,38 @@ void subsystem_unregister(struct subsystem * s)
}
/**
* subsystem_create_file - export sysfs attribute file.
* @s: subsystem.
* @a: subsystem attribute descriptor.
*/
int
subsys_create_file
(
struct
subsystem
*
s
,
struct
subsys_attribute
*
a
)
{
int
error
=
0
;
if
(
subsys_get
(
s
))
{
error
=
sysfs_create_file
(
&
s
->
kobj
,
&
a
->
attr
);
subsys_put
(
s
);
}
return
error
;
}
/**
* subsystem_remove_file - remove sysfs attribute file.
* @s: subsystem.
* @a: attribute desciptor.
*/
void
subsys_remove_file
(
struct
subsystem
*
s
,
struct
subsys_attribute
*
a
)
{
if
(
subsys_get
(
s
))
{
sysfs_remove_file
(
&
s
->
kobj
,
&
a
->
attr
);
subsys_put
(
s
);
}
}
EXPORT_SYMBOL
(
kobject_init
);
EXPORT_SYMBOL
(
kobject_register
);
EXPORT_SYMBOL
(
kobject_unregister
);
...
...
@@ -238,3 +270,5 @@ EXPORT_SYMBOL(kobject_put);
EXPORT_SYMBOL
(
subsystem_init
);
EXPORT_SYMBOL
(
subsystem_register
);
EXPORT_SYMBOL
(
subsystem_unregister
);
EXPORT_SYMBOL
(
subsys_create_file
);
EXPORT_SYMBOL
(
subsys_remove_file
);
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