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
ef2dc22f
Commit
ef2dc22f
authored
Jun 03, 2003
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Plain Diff
Merge hostme.bitkeeper.com:/ua/repos/l/ldm/linux-2.5
into hostme.bitkeeper.com:/ua/repos/l/ldm/linux-2.5-core
parents
1096ae58
c189bfeb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
17 deletions
+45
-17
drivers/base/base.h
drivers/base/base.h
+9
-0
drivers/base/class.c
drivers/base/class.c
+8
-3
fs/sysfs/bin.c
fs/sysfs/bin.c
+21
-12
fs/sysfs/inode.c
fs/sysfs/inode.c
+3
-2
include/linux/device.h
include/linux/device.h
+1
-0
include/linux/sysfs.h
include/linux/sysfs.h
+3
-0
No files found.
drivers/base/base.h
View file @
ef2dc22f
...
@@ -4,3 +4,12 @@ extern void bus_remove_device(struct device * dev);
...
@@ -4,3 +4,12 @@ extern void bus_remove_device(struct device * dev);
extern
int
bus_add_driver
(
struct
device_driver
*
);
extern
int
bus_add_driver
(
struct
device_driver
*
);
extern
void
bus_remove_driver
(
struct
device_driver
*
);
extern
void
bus_remove_driver
(
struct
device_driver
*
);
static
inline
struct
class_device
*
to_class_dev
(
struct
kobject
*
obj
)
{
return
container_of
(
obj
,
struct
class_device
,
kobj
);
}
static
inline
struct
class_device_attribute
*
to_class_dev_attr
(
struct
attribute
*
_attr
)
{
return
container_of
(
_attr
,
struct
class_device_attribute
,
attr
);
}
drivers/base/class.c
View file @
ef2dc22f
...
@@ -148,9 +148,6 @@ static void class_device_driver_unlink(struct class_device * class_dev)
...
@@ -148,9 +148,6 @@ static void class_device_driver_unlink(struct class_device * class_dev)
}
}
#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
#define to_class_dev_attr(_attr) container_of(_attr,struct class_device_attribute,attr)
static
ssize_t
static
ssize_t
class_device_attr_show
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
class_device_attr_show
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
char
*
buf
)
char
*
buf
)
...
@@ -182,7 +179,15 @@ static struct sysfs_ops class_dev_sysfs_ops = {
...
@@ -182,7 +179,15 @@ static struct sysfs_ops class_dev_sysfs_ops = {
.
store
=
class_device_attr_store
,
.
store
=
class_device_attr_store
,
};
};
static
void
class_dev_release
(
struct
kobject
*
kobj
)
{
struct
class_device
*
class_dev
=
to_class_dev
(
kobj
);
if
(
class_dev
->
release
)
class_dev
->
release
(
class_dev
);
}
static
struct
kobj_type
ktype_class_device
=
{
static
struct
kobj_type
ktype_class_device
=
{
.
release
=
&
class_dev_release
,
.
sysfs_ops
=
&
class_dev_sysfs_ops
,
.
sysfs_ops
=
&
class_dev_sysfs_ops
,
};
};
...
...
fs/sysfs/bin.c
View file @
ef2dc22f
...
@@ -30,10 +30,15 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off)
...
@@ -30,10 +30,15 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off)
loff_t
offs
=
*
off
;
loff_t
offs
=
*
off
;
int
ret
;
int
ret
;
if
(
count
>
PAGE_SIZE
)
count
=
PAGE_SIZE
;
if
(
size
)
{
if
(
offs
>
size
)
if
(
offs
>
size
)
return
0
;
return
0
;
if
(
offs
+
count
>
size
)
if
(
offs
+
count
>
size
)
count
=
size
-
offs
;
count
=
size
-
offs
;
}
ret
=
fill_read
(
dentry
,
buffer
,
offs
,
count
);
ret
=
fill_read
(
dentry
,
buffer
,
offs
,
count
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -41,7 +46,7 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off)
...
@@ -41,7 +46,7 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off)
count
=
ret
;
count
=
ret
;
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
if
(
copy_to_user
(
userbuf
,
buffer
+
offs
,
count
)
!=
0
)
if
(
copy_to_user
(
userbuf
,
buffer
,
count
)
!=
0
)
goto
Done
;
goto
Done
;
*
off
=
offs
+
count
;
*
off
=
offs
+
count
;
...
@@ -69,19 +74,23 @@ static ssize_t write(struct file * file, const char * userbuf,
...
@@ -69,19 +74,23 @@ static ssize_t write(struct file * file, const char * userbuf,
loff_t
offs
=
*
off
;
loff_t
offs
=
*
off
;
int
ret
;
int
ret
;
if
(
count
>
PAGE_SIZE
)
count
=
PAGE_SIZE
;
if
(
size
)
{
if
(
offs
>
size
)
if
(
offs
>
size
)
return
0
;
return
0
;
if
(
offs
+
count
>
size
)
if
(
offs
+
count
>
size
)
count
=
size
-
offs
;
count
=
size
-
offs
;
}
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
if
(
copy_from_user
(
buffer
+
offs
,
userbuf
,
count
))
if
(
copy_from_user
(
buffer
,
userbuf
,
count
))
goto
Done
;
goto
Done
;
count
=
flush_write
(
dentry
,
buffer
,
offs
,
count
);
count
=
flush_write
(
dentry
,
buffer
,
offs
,
count
);
if
(
count
>
0
)
if
(
count
>
0
)
*
off
=
offs
+
count
;
*
off
=
offs
+
count
;
ret
=
0
;
ret
=
count
;
Done:
Done:
return
ret
;
return
ret
;
}
}
...
@@ -102,7 +111,7 @@ static int open(struct inode * inode, struct file * file)
...
@@ -102,7 +111,7 @@ static int open(struct inode * inode, struct file * file)
goto
Done
;
goto
Done
;
error
=
-
ENOMEM
;
error
=
-
ENOMEM
;
file
->
private_data
=
kmalloc
(
attr
->
size
,
GFP_KERNEL
);
file
->
private_data
=
kmalloc
(
PAGE_SIZE
,
GFP_KERNEL
);
if
(
!
file
->
private_data
)
if
(
!
file
->
private_data
)
goto
Done
;
goto
Done
;
...
...
fs/sysfs/inode.c
View file @
ef2dc22f
...
@@ -60,9 +60,10 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *))
...
@@ -60,9 +60,10 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *))
Proceed:
Proceed:
if
(
init
)
if
(
init
)
error
=
init
(
inode
);
error
=
init
(
inode
);
if
(
!
error
)
if
(
!
error
)
{
d_instantiate
(
dentry
,
inode
);
d_instantiate
(
dentry
,
inode
);
else
dget
(
dentry
);
/* Extra count - pin the dentry in core */
}
else
iput
(
inode
);
iput
(
inode
);
Done:
Done:
return
error
;
return
error
;
...
...
include/linux/device.h
View file @
ef2dc22f
...
@@ -204,6 +204,7 @@ struct class_device {
...
@@ -204,6 +204,7 @@ struct class_device {
void
*
class_data
;
/* class-specific data */
void
*
class_data
;
/* class-specific data */
char
class_id
[
BUS_ID_SIZE
];
/* unique to this class */
char
class_id
[
BUS_ID_SIZE
];
/* unique to this class */
void
(
*
release
)(
struct
class_device
*
class_dev
);
};
};
static
inline
void
*
static
inline
void
*
...
...
include/linux/sysfs.h
View file @
ef2dc22f
...
@@ -23,6 +23,9 @@ struct bin_attribute {
...
@@ -23,6 +23,9 @@ struct bin_attribute {
ssize_t
(
*
write
)(
struct
kobject
*
,
char
*
,
loff_t
,
size_t
);
ssize_t
(
*
write
)(
struct
kobject
*
,
char
*
,
loff_t
,
size_t
);
};
};
int
sysfs_create_bin_file
(
struct
kobject
*
kobj
,
struct
bin_attribute
*
attr
);
int
sysfs_remove_bin_file
(
struct
kobject
*
kobj
,
struct
bin_attribute
*
attr
);
struct
sysfs_ops
{
struct
sysfs_ops
{
ssize_t
(
*
show
)(
struct
kobject
*
,
struct
attribute
*
,
char
*
);
ssize_t
(
*
show
)(
struct
kobject
*
,
struct
attribute
*
,
char
*
);
ssize_t
(
*
store
)(
struct
kobject
*
,
struct
attribute
*
,
const
char
*
,
size_t
);
ssize_t
(
*
store
)(
struct
kobject
*
,
struct
attribute
*
,
const
char
*
,
size_t
);
...
...
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