Re: shoulnt "crypt_init_by_name()" fail when the underlying device is no longer available?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






No it should not. It is explained in API doc:
http://wiki.cryptsetup.googlecode.com/git/API/libcryptsetup_8h.html#a99bc4160e7afacfba1d2c5ee6dbaf3be

"In case device points to active LUKS device but header load fails, context device type
is set to NULL and 0 is returned as if it were successful.
Context with NULL device type can only be deactivated by crypt_deactivate"

So the only think you can do here is deactivate device-mapper device
(which explains why it is needed).

 
So,this function can be used to check if the underlying device is present or not.Good to know,it will be nice if the docs could say this.

The does clearly states the behavior,and i missed it somehow,my bad.

But why does this function behave this way though? Docs states this behavior but it doesnt say why and this gives inconsistent behavior.I always though checking for return value is sufficient to give indication if i should proceed or bail out,it almost became automatic.It looks like with this function,i should not check the return value but "cd".

Let say i want to be lazy and only do one check,should checking if "cd" is NULL be sufficient to cover all invalid cases or its necessary to do bo checks to be 100% sure.
Milan

_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
http://www.saout.de/mailman/listinfo/dm-crypt

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux