]> wimlib.net Git - wimlib/commit
Limit can_modify_wim() calls; remove can_delete_from_wim()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 14 Oct 2014 00:42:16 +0000 (19:42 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 14 Oct 2014 01:33:19 +0000 (20:33 -0500)
commit4c73e29d8d74a4e969782d2d40e209337414034c
tree9d998d9020e62c994781e59356547af4e861fb78
parent5b6eaafbaab217fc69946685862a09afa28b30cb
Limit can_modify_wim() calls; remove can_delete_from_wim()

It isn't necessary to check for permission to modify a WIM for in-memory
operations such as wimlib_add_image(), wimlib_update_image(), and
wimlib_delete_image().  It is only when the user attempts to modify an
on-disk WIM file using wimlib_overwrite() --- or when the user explicitly
opens an on-disk WIM file for write access --- that write permissions
need to be checked.

This change prevents the library from getting in the way of "unusual" use
cases, such as making last-minute changes to a WIM before extracting it
even when the underlying file is located on read-only media, which
otherwise are fully supported by the existing code.

Also part of this change is the removal of can_delete_from_wim().  This
function did a lot of work (decompressing each metadata resource) that
usually turns out to be a waste of time.  And it turns out that it really
needs to be called for any 'wimlib_update_command', including "add" and
"rename", because both "add" and "rename" can cause files to be deleted
(specifically, replaced).  But this is gone too far.  Instead, just get
rid of can_delete_from_wim() completely: it's not needed if we retain
0-reference streams when not recalculating reference counts as part of
wimlib_write() anyway.
13 files changed:
include/wimlib.h
include/wimlib/lookup_table.h
include/wimlib/wim.h
programs/imagex.c
src/add_image.c
src/delete_image.c
src/export_image.c
src/lookup_table.c
src/mount_image.c
src/update_image.c
src/verify.c
src/wim.c
src/xml.c