Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67343
b: refs/heads/master
c: a595ed6
h: refs/heads/master
i:
  67341: 4bb2f89
  67339: c0dc09e
  67335: 152f005
  67327: 4b07e22
v: v3
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Sep 19, 2007
1 parent 33cec1f commit c20fe44
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c70d4ca52b1390dd2603535600c948cbdb0b9ec9
refs/heads/master: a595ed662c96dcd920415bea3135ff1af60e9a00
58 changes: 38 additions & 20 deletions trunk/arch/powerpc/platforms/cell/spufs/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,11 @@ static int spufs_ctx_note_size(struct spufs_ctx_info *ctx_info)
return total;
}

static int spufs_add_one_context(struct file *file, int dfd)
static int spufs_add_one_context(struct spu_context *ctx, int dfd)
{
struct spu_context *ctx;
struct spufs_ctx_info *ctx_info;
int size;

ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
if (ctx->flags & SPU_CREATE_NOSCHED)
return 0;

ctx_info = kzalloc(sizeof(*ctx_info), GFP_KERNEL);
if (unlikely(!ctx_info))
return -ENOMEM;
Expand All @@ -142,22 +137,45 @@ static int spufs_add_one_context(struct file *file, int dfd)
* internal functionality to dump them without needing to actually
* open the files.
*/
static int spufs_arch_notes_size(void)
static struct spu_context *coredump_next_context(int *fd)
{
struct fdtable *fdt = files_fdtable(current->files);
int size = 0, fd;

for (fd = 0; fd < fdt->max_fds; fd++) {
if (FD_ISSET(fd, fdt->open_fds)) {
struct file *file = fcheck(fd);

if (file && file->f_op == &spufs_context_fops) {
int rval = spufs_add_one_context(file, fd);
if (rval < 0)
break;
size += rval;
}
}
struct file *file;
struct spu_context *ctx = NULL;

for (; *fd < fdt->max_fds; (*fd)++) {
if (!FD_ISSET(*fd, fdt->open_fds))
continue;

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;

/* start searching the next fd next time we're called */
(*fd)++;
break;
}

return ctx;
}

static int spufs_arch_notes_size(void)
{
struct spu_context *ctx;
int size = 0, rc, fd;

fd = 0;
while ((ctx = coredump_next_context(&fd)) != NULL) {
rc = spufs_add_one_context(ctx, fd);
if (rc < 0)
break;

size += rc;
}

return size;
Expand Down

0 comments on commit c20fe44

Please sign in to comment.