switch spufs/coredump to iterate_fd()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
179e037fc1
commit
2be7fd55d4
@ -106,6 +106,17 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int match_context(const void *v, struct file *file, unsigned fd)
|
||||||
|
{
|
||||||
|
struct spu_context *ctx;
|
||||||
|
if (file->f_op != &spufs_context_fops)
|
||||||
|
return 0;
|
||||||
|
ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
|
||||||
|
if (ctx->flags & SPU_CREATE_NOSCHED)
|
||||||
|
return 0;
|
||||||
|
return fd + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The additional architecture-specific notes for Cell are various
|
* The additional architecture-specific notes for Cell are various
|
||||||
* context files in the spu context.
|
* context files in the spu context.
|
||||||
@ -115,29 +126,18 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
|
|||||||
* internal functionality to dump them without needing to actually
|
* internal functionality to dump them without needing to actually
|
||||||
* open the files.
|
* open the files.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* descriptor table is not shared, so files can't change or go away.
|
||||||
|
*/
|
||||||
static struct spu_context *coredump_next_context(int *fd)
|
static struct spu_context *coredump_next_context(int *fd)
|
||||||
{
|
{
|
||||||
struct fdtable *fdt = files_fdtable(current->files);
|
|
||||||
struct file *file;
|
struct file *file;
|
||||||
struct spu_context *ctx = NULL;
|
int n = iterate_fd(current->files, *fd, match_context, NULL);
|
||||||
|
if (!n)
|
||||||
for (; *fd < fdt->max_fds; (*fd)++) {
|
return NULL;
|
||||||
if (!fd_is_open(*fd, fdt))
|
*fd = n - 1;
|
||||||
continue;
|
file = fcheck(*fd);
|
||||||
|
return SPUFS_I(file->f_dentry->d_inode)->i_ctx;
|
||||||
file = fcheck(*fd);
|
|
||||||
|
|
||||||
if (!file || file->f_op != &spufs_context_fops)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
|
|
||||||
if (ctx->flags & SPU_CREATE_NOSCHED)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int spufs_coredump_extra_notes_size(void)
|
int spufs_coredump_extra_notes_size(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user