add r_io_desc_list (possibly useful for bughunting)

This commit is contained in:
condret 2014-10-17 18:29:22 +02:00
parent c20e2c70db
commit 051de62f9e
2 changed files with 18 additions and 0 deletions

View File

@ -425,6 +425,7 @@ R_API RIODesc *r_io_desc_get(RIO *io, int fd);
R_API ut64 r_io_desc_size(RIO *io, RIODesc *desc);
R_API ut64 r_io_fd_size(RIO *io, int fd);
R_API ut64 r_io_desc_seek (RIO *io, RIODesc *desc, ut64 offset);
R_API void r_io_desc_list (RIO *io);
//R_API int r_io_desc_generate(RIO *io);
/* buffer.c */

View File

@ -114,6 +114,23 @@ R_API ut64 r_io_desc_seek (RIO *io, RIODesc *desc, ut64 offset) {
return desc->plugin->lseek (io, desc, offset, SEEK_SET);
}
R_API void r_io_desc_list (RIO *io) {
RIODesc *desc = NULL;
RListIter *iter;
if (io && io->files) {
r_list_foreach (io->files, iter, desc) {
if (desc) {
io->printf ("- %i", desc->fd);
if (desc->uri)
io->printf ("\t%s", desc->uri);
if (desc->name)
io->printf ("\t%s", desc->name);
io->printf ("\tstate: %i\tflags: %i\n", desc->state, desc->flags);
}
}
}
}
#if 0
// XXX: This must be deprecated in order to promote the cast of dataptr to ut32
R_API int r_io_desc_generate(struct r_io_t *io) {