static int rf_setflags(mdb_tgt_t *t, int flags) { if ((flags ^ t->t_flags) & MDB_TGT_F_RDWR) { uint_t otflags = t->t_flags; rf_data_t *orf = t->t_data; const char *argv[2]; int argc = 0; if (orf->r_object_fio != NULL) argv[argc++] = IOP_NAME(orf->r_object_fio); if (orf->r_core_fio != NULL) argv[argc++] = IOP_NAME(orf->r_core_fio); t->t_flags = (t->t_flags & ~MDB_TGT_F_RDWR) | (flags & MDB_TGT_F_RDWR); if (mdb_rawfile_tgt_create(t, argc, argv) == -1) { t->t_flags = otflags; t->t_data = orf; return (-1); } rf_data_destroy(orf); } return (0); }
static const char * strio_name(mdb_io_t *io) { if (io->io_next != NULL) return (IOP_NAME(io->io_next)); return ("(string)"); }
static const char * pio_name(mdb_io_t *io) { pio_data_t *pdp = io->io_data; if (io->io_next == NULL) return (pdp->pio_name); return (IOP_NAME(io->io_next)); }
static const char * fdio_name(mdb_io_t *io) { fd_data_t *fdp = io->io_data; if (io->io_next == NULL) return (fdp->fd_name); return (IOP_NAME(io->io_next)); }
static ssize_t rf_fwrite(mdb_tgt_t *t, const void *buf, size_t nbytes, uintptr_t addr) { return (rf_write(RF_OBJECT(t->t_data), buf, nbytes, addr)); } static int rf_print_map(mdb_io_t *io, const char *type, int tflags, mdb_tgt_map_f *func, void *private) { mdb_map_t map; (void) mdb_iob_snprintf(map.map_name, MDB_TGT_MAPSZ, "%s (%s)", IOP_NAME(io), type); map.map_base = 0; map.map_size = IOP_SEEK(io, 0, SEEK_END); map.map_flags = MDB_TGT_MAP_R; if (tflags & MDB_TGT_F_RDWR) map.map_flags |= MDB_TGT_MAP_W; return (func(private, &map, map.map_name)); } static int rf_mapping_iter(mdb_tgt_t *t, mdb_tgt_map_f *func, void *private) { rf_data_t *rf = t->t_data;