On Wed, 2007-09-19 at 18:26 +0100, Christoph Hellwig wrote:Appended. I started to write the comments to describe the function arguments, but they all looked pretty retarded. Yeah, there are a few left. But, they're in the middle of what is sometimes tricky error handling, so I think we should trickle those in later. -- Dave lxc-dave/fs/file_table.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff -puN fs/file_table.c~document fs/file_table.c --- lxc/fs/file_table.c~document 2007-09-19 10:31:13.000000000 -0700 +++ lxc-dave/fs/file_table.c 2007-09-19 10:39:34.000000000 -0700 @@ -137,6 +137,18 @@ fail: EXPORT_SYMBOL(get_empty_filp); +/** + * alloc_file - allocate and initialize a 'struct file' with + * the given arguments + * + * Use this instead of get_empty_filp() to get a new + * 'struct file'. Do so because of the same initialization + * pitfalls reasons listed for init_file(). This is a + * preferred interface to using init_file(). + * + * If all the callers of init_file() are eliminated, its + * code should be moved into this function. + */ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, mode_t mode, const struct file_operations *fop) { @@ -152,7 +164,15 @@ struct file *alloc_file(struct vfsmount } EXPORT_SYMBOL(alloc_file); -/* +/** + * init_file - initialize a 'struct file' + * @file: the already allocated 'struct file' to initialized + * @mnt: the vfsmount on which the file resides + * + * Use this instead of setting the members directly. Doing so + * avoids making mistakes like forgetting the mntget() or + * forgetting to take a write on the mnt. + * * Note: This is a crappy interface. It is here to make * merging with the existing users of get_empty_filp() * who have complex failure logic easier. All users _ -
| Arnd Bergmann | Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures |
| Andrew Morton | 2.6.23-rc1-mm2 |
| Nick Piggin | [patch 3/6] mm: fix fault vs invalidate race for linear mappings |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Herbert Xu | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| David Miller | Re: [BUG] New Kernel Bugs |
