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
e44e3531
Commit
e44e3531
authored
Feb 06, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sysfs: add sysfs_update_file() function.
parent
6b5561f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
fs/sysfs/inode.c
fs/sysfs/inode.c
+41
-0
include/linux/sysfs.h
include/linux/sysfs.h
+3
-0
No files found.
fs/sysfs/inode.c
View file @
e44e3531
...
...
@@ -37,6 +37,7 @@
#include <linux/backing-dev.h>
#include <linux/kobject.h>
#include <linux/mount.h>
#include <linux/dnotify.h>
#include <asm/uaccess.h>
/* Random magic number */
...
...
@@ -716,6 +717,46 @@ static void hash_and_remove(struct dentry * dir, const char * name)
up
(
&
dir
->
d_inode
->
i_sem
);
}
/**
* sysfs_update_file - update the modified timestamp on an object attribute.
* @kobj: object we're acting for.
* @attr: attribute descriptor.
*
* Also call dnotify for the dentry, which lots of userspace programs
* use.
*/
int
sysfs_update_file
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
)
{
struct
dentry
*
dir
=
kobj
->
dentry
;
struct
dentry
*
victim
;
int
res
=
-
ENOENT
;
down
(
&
dir
->
d_inode
->
i_sem
);
victim
=
get_dentry
(
dir
,
attr
->
name
);
if
(
!
IS_ERR
(
victim
))
{
/* make sure dentry is really there */
if
(
victim
->
d_inode
&&
(
victim
->
d_parent
->
d_inode
==
dir
->
d_inode
))
{
victim
->
d_inode
->
i_mtime
=
CURRENT_TIME
;
dnotify_parent
(
victim
,
DN_MODIFY
);
/**
* Drop reference from initial get_dentry().
*/
dput
(
victim
);
res
=
0
;
}
/**
* Drop the reference acquired from get_dentry() above.
*/
dput
(
victim
);
}
up
(
&
dir
->
d_inode
->
i_sem
);
return
res
;
}
/**
* sysfs_remove_file - remove an object attribute.
...
...
include/linux/sysfs.h
View file @
e44e3531
...
...
@@ -30,6 +30,9 @@ sysfs_remove_dir(struct kobject *);
extern
int
sysfs_create_file
(
struct
kobject
*
,
struct
attribute
*
);
extern
int
sysfs_update_file
(
struct
kobject
*
,
struct
attribute
*
);
extern
void
sysfs_remove_file
(
struct
kobject
*
,
struct
attribute
*
);
...
...
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