* textdump_writeblock() writes TEXTDUMP_BLOCKSIZE-sized blocks of data to * the space between di->mediaoffset and di->mediaoffset + di->mediasize. It * accepts an offset relative to di->mediaoffset. If we're carrying any * error from previous I/O, return that error and don't continue to try to * write. Most writers ignore the error and forge ahead on the basis that * there's not much you c
| 239 | * there's not much you can do. |
| 240 | */ |
| 241 | static int |
| 242 | textdump_writeblock(struct dumperinfo *di, off_t offset, char *buffer) |
| 243 | { |
| 244 | |
| 245 | if (textdump_error) |
| 246 | return (textdump_error); |
| 247 | if (offset + TEXTDUMP_BLOCKSIZE > di->mediasize) |
| 248 | return (EIO); |
| 249 | if (offset < SIZEOF_METADATA) |
| 250 | return (ENOSPC); |
| 251 | textdump_error = dump_write(di, buffer, 0, offset + di->mediaoffset, |
| 252 | TEXTDUMP_BLOCKSIZE); |
| 253 | if (textdump_error) |
| 254 | printf("textdump_writeblock: offset %jd, error %d\n", (intmax_t)offset, |
| 255 | textdump_error); |
| 256 | return (textdump_error); |
| 257 | } |
| 258 | |
| 259 | /* |
| 260 | * Interfaces to save and restore the dump offset, so that printers can go |
no test coverage detected