mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Make json_segments_count fn return unsigned value.
This commit is contained in:
@@ -379,7 +379,7 @@ json_object *json_segment_get_flags(json_object *jobj_segment);
|
|||||||
bool json_segment_is_backup(json_object *jobj_segment);
|
bool json_segment_is_backup(json_object *jobj_segment);
|
||||||
bool json_segment_is_reencrypt(json_object *jobj_segment);
|
bool json_segment_is_reencrypt(json_object *jobj_segment);
|
||||||
json_object *json_segments_get_segment(json_object *jobj_segments, int segment);
|
json_object *json_segments_get_segment(json_object *jobj_segments, int segment);
|
||||||
int json_segments_count(json_object *jobj_segments);
|
unsigned json_segments_count(json_object *jobj_segments);
|
||||||
json_object *json_segments_get_segment_by_flag(json_object *jobj_segments, const char *flag);
|
json_object *json_segments_get_segment_by_flag(json_object *jobj_segments, const char *flag);
|
||||||
void json_segment_remove_flag(json_object *jobj_segment, const char *flag);
|
void json_segment_remove_flag(json_object *jobj_segment, const char *flag);
|
||||||
uint64_t json_segments_get_minimal_offset(json_object *jobj_segments, unsigned blockwise);
|
uint64_t json_segments_get_minimal_offset(json_object *jobj_segments, unsigned blockwise);
|
||||||
|
|||||||
@@ -187,12 +187,10 @@ json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr)
|
|||||||
|
|
||||||
int LUKS2_segments_count(struct luks2_hdr *hdr)
|
int LUKS2_segments_count(struct luks2_hdr *hdr)
|
||||||
{
|
{
|
||||||
json_object *jobj_segments;
|
if (!hdr)
|
||||||
|
|
||||||
if (!hdr || !(jobj_segments = LUKS2_get_segments_jobj(hdr)))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return json_segments_count(jobj_segments);
|
return json_segments_count(LUKS2_get_segments_jobj(hdr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int LUKS2_get_default_segment(struct luks2_hdr *hdr)
|
int LUKS2_get_default_segment(struct luks2_hdr *hdr)
|
||||||
@@ -2040,9 +2038,6 @@ static int _reload_custom_multi(struct crypt_device *cd,
|
|||||||
.size = device_size >> SECTOR_SHIFT
|
.size = device_size >> SECTOR_SHIFT
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* do not allow activation when particular requirements detected */
|
/* do not allow activation when particular requirements detected */
|
||||||
if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
|
if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
|
||||||
return r;
|
return r;
|
||||||
@@ -2094,9 +2089,6 @@ int LUKS2_activate_multi(struct crypt_device *cd,
|
|||||||
.uuid = crypt_get_uuid(cd)
|
.uuid = crypt_get_uuid(cd)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* do not allow activation when particular requirements detected */
|
/* do not allow activation when particular requirements detected */
|
||||||
if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
|
if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -178,12 +178,12 @@ json_object *json_segments_get_segment(json_object *jobj_segments, int segment)
|
|||||||
return jobj;
|
return jobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
int json_segments_count(json_object *jobj_segments)
|
unsigned json_segments_count(json_object *jobj_segments)
|
||||||
{
|
{
|
||||||
int count = 0;
|
unsigned count = 0;
|
||||||
|
|
||||||
if (!jobj_segments)
|
if (!jobj_segments)
|
||||||
return -EINVAL;
|
return 0;
|
||||||
|
|
||||||
json_object_object_foreach(jobj_segments, slot, val) {
|
json_object_object_foreach(jobj_segments, slot, val) {
|
||||||
UNUSED(slot);
|
UNUSED(slot);
|
||||||
|
|||||||
Reference in New Issue
Block a user