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 _ -
| Justin C. Sherrill | Re: dragonflybsd.org website link? |
| David Woodhouse | Re: -mm merge plans for 2.6.23 |
| Greg Kroah-Hartman | [PATCH 002/196] Chinese: rephrase English introduction in HOWTO |
| Eric Sandeen | Re: [RFC] Heads up on sys_fallocate() |
git: | |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Patrick McHardy | [NET_SCHED 01/15]: sch_atm: fix format string warning |
