Introduced burn_offst_source_new() flag bit0 which bans size changes

This commit is contained in:
Thomas Schmitt 2012-01-23 09:36:47 +00:00
parent 024701c220
commit a75a838af9
2 changed files with 11 additions and 2 deletions

View File

@ -779,7 +779,7 @@ static off_t offst_get_size(struct burn_source *source)
if ((fs = offst_auth(source, 0)) == NULL)
return (off_t) 0;
return fs->size;
return fs->nominal_size;
}
static int offst_set_size(struct burn_source *source, off_t size)
@ -788,7 +788,10 @@ static int offst_set_size(struct burn_source *source, off_t size)
if ((fs = offst_auth(source, 0)) == NULL)
return 0;
fs->size = size;
fs->nominal_size = size;
if (fs->size <= 0 || fs->size_adjustable)
fs->size = size;
return 1;
}
@ -907,6 +910,8 @@ struct burn_source *burn_offst_source_new(
}
fs->start = start;
fs->size = size;
fs->size_adjustable = !(flag & 1);
fs->nominal_size = size;
fs->running = 0;
fs->pos = 0;
inp->refcount++; /* make sure inp lives longer than src */

View File

@ -82,6 +82,10 @@ struct burn_source_offst {
struct burn_source *prev;
off_t start;
off_t size;
int size_adjustable;
/* for set_size/get_size */
int nominal_size;
/* To help offst_free() */
struct burn_source *next;