aboutsummaryrefslogtreecommitdiff
path: root/fs/sysfs/file.c
AgeCommit message (Collapse)AuthorFilesLines
2007-02-16PCI/sysfs/kobject kernel-doc fixesRandy Dunlap1-1/+1
Fix kernel-doc warnings in PCI, sysfs, and kobject files. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-02-07sysfs: error handling in sysfs, fill_read_buffer()Oliver Neukum1-4/+6
if a driver returns an error in fill_read_buffer(), the buffer will be marked as filled. Subsequent reads will return eof. But there is no data because of an error, not because it has been read. Not marking the buffer filled is the obvious fix. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-02-07sysfs: kobject_put cleanupMariusz Kozlowski1-3/+2
This patch removes redundant argument checks for kobject_put(). Signed-off-by: Mariusz Kozlowski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-02-07Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()Oliver Neukum1-17/+50
This patch prevents a race between IO and removing a file from sysfs. It introduces a list of sysfs_buffers associated with a file at the inode. Upon removal of a file the list is walked and the buffers marked orphaned. IO to orphaned buffers fails with -ENODEV. The driver can safely free associated data structures or be unloaded. Signed-off-by: Oliver Neukum <[email protected]> Acked-by: Maneesh Soni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-12-08[PATCH] sysfs: change uses of f_{dentry, vfsmnt} to use f_pathJosef "Jeff" Sipek1-8/+8
Change all the uses of f_{dentry,vfsmnt} to f_path.{dentry,mnt} in the sysfs filesystem code. Signed-off-by: Josef "Jeff" Sipek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-12-01sysfs: sysfs_write_file() writes zero terminated dataThomas Maier1-0/+3
since most of the files in sysfs are text files, it would be nice, if the "store" function called during sysfs_write_file() gets a zero terminated string / data. The current implementation seems not to ensure this. (But only if it is the first time the zeroed buffer page is allocated.) So the buffer can be scanned by sscanf() easily, for example. This patch simply sets a \0 char behind the data in buffer->page. Signed-off-by: Thomas Maier <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-10-18sysfs: update obsolete comment in sysfs_update_fileHidetoshi Seto1-1/+1
And the obsolete comment should be updated (or totally removed). Signed-off-by: Hidetoshi Seto <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-10-18sysfs: remove duplicated dput in sysfs_update_fileHidetoshi Seto1-5/+0
Following function can drops d_count twice against one reference by lookup_one_len. <SOURCE> /** * sysfs_update_file - update the modified timestamp on an object attribute. * @kobj: object we're acting for. * @attr: attribute descriptor. */ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) { struct dentry * dir = kobj->dentry; struct dentry * victim; int res = -ENOENT; mutex_lock(&dir->d_inode->i_mutex); victim = lookup_one_len(attr->name, dir, strlen(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; fsnotify_modify(victim); /** * Drop reference from initial sysfs_get_dentry(). */ dput(victim); res = 0; } else d_drop(victim); /** * Drop the reference acquired from sysfs_get_dentry() above. */ dput(victim); } mutex_unlock(&dir->d_inode->i_mutex); return res; } </SOURCE> PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/* have negative d_count value. This patch removes unnecessary dput(). Signed-off-by: Hidetoshi Seto <[email protected]> Acked-by: Maneesh Soni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-10-03[PATCH] pr_debug: sysfs: use size_t length modifier in pr_debug format argumentsZach Brown1-2/+2
sysfs: use size_t length modifier in pr_debug format arguments Signed-off-by: Zach Brown <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-04-14[PATCH] sysfs: Allow sysfs attribute files to be pollableNeilBrown1-0/+76
It works like this: Open the file Read all the contents. Call poll requesting POLLERR or POLLPRI (so select/exceptfds works) When poll returns, close the file and go to top of loop. or lseek to start of file and go back to the 'read'. Events are signaled by an object manager calling sysfs_notify(kobj, dir, attr); If the dir is non-NULL, it is used to find a subdirectory which contains the attribute (presumably created by sysfs_create_group). This has a cost of one int per attribute, one wait_queuehead per kobject, one int per open file. The name "sysfs_notify" may be confused with the inotify functionality. Maybe it would be nice to support inotify for sysfs attributes as well? This patch also uses sysfs_notify to allow /sys/block/md*/md/sync_action to be pollable Signed-off-by: Neil Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-04-02[PATCH] sysfs: zero terminate sysfs write buffersGreg Kroah-Hartman1-1/+1
No one should be writing a PAGE_SIZE worth of data to a normal sysfs file, so properly terminate the buffer. Thanks to Al Viro for pointing out my supidity here. Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-03-28[PATCH] Make most file operations structs in fs/ constArjan van de Ven1-1/+1
This is a conversion to make the various file_operations structs in fs/ const. Basically a regexp job, with a few manual fixups The goal is both to increase correctness (harder to accidentally write to shared datastructures) and reducing the false sharing of cachelines with things that get dirty in .data (while .rodata is nicely read only and thus cache clean) Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-03-20[PATCH] sysfs: fix problem with duplicate sysfs directories and filesManeesh Soni1-2/+4
The following patch checks for existing sysfs_dirent before preparing new one while creating sysfs directories and files. Signed-off-by: Maneesh Soni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-03-20[PATCH] sysfs: kzalloc conversionEric Sesterhenn1-2/+1
this converts fs/sysfs to kzalloc() usage. compile tested with make allyesconfig Signed-off-by: Eric Sesterhenn <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-01-09[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_semJes Sorensen1-9/+8
This patch converts the inode semaphore to a mutex. I have tested it on XFS and compiled as much as one can consider on an ia64. Anyway your luck with it might be different. Modified-by: Ingo Molnar <[email protected]> (finished the conversion) Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2005-07-29[PATCH] sysfs: fix sysfs_chmod_fileManeesh Soni1-8/+10
o sysfs_chmod_file() must update the new iattr field in sysfs_dirent else the mode change will not be persistent in case of inode evacuation from cache. Signed-off-by: Maneesh Soni <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-07-12[PATCH] inotifyRobert Love1-5/+2
inotify is intended to correct the deficiencies of dnotify, particularly its inability to scale and its terrible user interface: * dnotify requires the opening of one fd per each directory that you intend to watch. This quickly results in too many open files and pins removable media, preventing unmount. * dnotify is directory-based. You only learn about changes to directories. Sure, a change to a file in a directory affects the directory, but you are then forced to keep a cache of stat structures. * dnotify's interface to user-space is awful. Signals? inotify provides a more usable, simple, powerful solution to file change notification: * inotify's interface is a system call that returns a fd, not SIGIO. You get a single fd, which is select()-able. * inotify has an event that says "the filesystem that the item you were watching is on was unmounted." * inotify can watch directories or files. Inotify is currently used by Beagle (a desktop search infrastructure), Gamin (a FAM replacement), and other projects. See Documentation/filesystems/inotify.txt. Signed-off-by: Robert Love <[email protected]> Cc: John McCutchan <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-24[PATCH] DocBook: update commentsMartin Waitz1-2/+3
This patch updates some comments to match code changes. Signed-off-by: Martin Waitz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-23[PATCH] remove duplicate get_dentry functions in various placesChristoph Hellwig1-2/+3
Various filesystem drivers have grown a get_dentry() function that's a duplicate of lookup_one_len, except that it doesn't take a maximum length argument and doesn't check for \0 or / in the passed in filename. Switch all these places to use lookup_one_len. Signed-off-by: Christoph Hellwig <[email protected]> Cc: Greg KH <[email protected]> Cc: Paul Jackson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-20[PATCH] SYSFS: fix PAGE_SIZE checkJon Smirl1-1/+1
Without this change I can't set an attribute exactly PAGE_SIZE in length. There is no need for zero termination because the interface uses lengths. From: Jon Smirl <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-06-20[PATCH] sysfs: if show/store is missing return -EIODmitry Torokhov1-2/+2
sysfs: if attribute does not implement show or store method read/write should return -EIO instead of 0 or -EINVAL. Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-05-01[PATCH] DocBook: fix some descriptionsMartin Waitz1-2/+2
Some KernelDoc descriptions are updated to match the current code. No code changes. Signed-off-by: Martin Waitz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-04-18[PATCH] sysfs: add sysfs_chmod_file()Kay Sievers1-0/+35
sysfs: allow changing the permissions for already created attributes Signed-off-by: Kay Sievers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+447
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!