diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-21 22:50:49 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 21:10:00 -0400 |
commit | 2be7fd55d44882c9818ed2d1dabc0f0abab5eeed (patch) | |
tree | f00416a3467fff577330753012c58784dd3292dd /arch/powerpc | |
parent | 179e037fc1370288188cb1f90b81156d75a3cb2d (diff) |
switch spufs/coredump to iterate_fd()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/coredump.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index c2c5b078ba8..657e3f233a6 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -106,6 +106,17 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) | |||
106 | return total; | 106 | return total; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int match_context(const void *v, struct file *file, unsigned fd) | ||
110 | { | ||
111 | struct spu_context *ctx; | ||
112 | if (file->f_op != &spufs_context_fops) | ||
113 | return 0; | ||
114 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | ||
115 | if (ctx->flags & SPU_CREATE_NOSCHED) | ||
116 | return 0; | ||
117 | return fd + 1; | ||
118 | } | ||
119 | |||
109 | /* | 120 | /* |
110 | * The additional architecture-specific notes for Cell are various | 121 | * The additional architecture-specific notes for Cell are various |
111 | * context files in the spu context. | 122 | * context files in the spu context. |
@@ -115,29 +126,18 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) | |||
115 | * internal functionality to dump them without needing to actually | 126 | * internal functionality to dump them without needing to actually |
116 | * open the files. | 127 | * open the files. |
117 | */ | 128 | */ |
129 | /* | ||
130 | * descriptor table is not shared, so files can't change or go away. | ||
131 | */ | ||
118 | static struct spu_context *coredump_next_context(int *fd) | 132 | static struct spu_context *coredump_next_context(int *fd) |
119 | { | 133 | { |
120 | struct fdtable *fdt = files_fdtable(current->files); | ||
121 | struct file *file; | 134 | struct file *file; |
122 | struct spu_context *ctx = NULL; | 135 | int n = iterate_fd(current->files, *fd, match_context, NULL); |
123 | 136 | if (!n) | |
124 | for (; *fd < fdt->max_fds; (*fd)++) { | 137 | return NULL; |
125 | if (!fd_is_open(*fd, fdt)) | 138 | *fd = n - 1; |
126 | continue; | 139 | file = fcheck(*fd); |
127 | 140 | return SPUFS_I(file->f_dentry->d_inode)->i_ctx; | |
128 | file = fcheck(*fd); | ||
129 | |||
130 | if (!file || file->f_op != &spufs_context_fops) | ||
131 | continue; | ||
132 | |||
133 | ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; | ||
134 | if (ctx->flags & SPU_CREATE_NOSCHED) | ||
135 | continue; | ||
136 | |||
137 | break; | ||
138 | } | ||
139 | |||
140 | return ctx; | ||
141 | } | 141 | } |
142 | 142 | ||
143 | int spufs_coredump_extra_notes_size(void) | 143 | int spufs_coredump_extra_notes_size(void) |