Always use json-c types in internal code.

Sometimes we used "struct json_foo_bar" and sometimes "json_foo_bar"
json-c defined type. Stick with one notation in internal code.
This commit is contained in:
Ondrej Kozina
2025-11-12 10:43:17 +01:00
committed by Milan Broz
parent b36d4be8fa
commit 917b6836a9
5 changed files with 21 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ static json_object *parse_json_len(struct crypt_device *cd, const char *json_are
uint64_t max_length, int *json_len)
{
json_object *jobj;
struct json_tokener *jtok;
json_tokener *jtok;
/* INT32_MAX is internal (json-c) json_tokener_parse_ex() limit */
if (!json_area || max_length > INT32_MAX)

View File

@@ -203,7 +203,7 @@ int LUKS2_generate_hdr(
uint32_t opal_segment_number,
uint32_t opal_key_size)
{
struct json_object *jobj_segment, *jobj_keyslots, *jobj_segments, *jobj_config;
json_object *jobj_segment, *jobj_keyslots, *jobj_segments, *jobj_config;
uuid_t partitionUuid;
int r, digest;

View File

@@ -49,9 +49,9 @@ void JSON_DBG(struct crypt_device *cd, json_object *jobj, const char *desc)
/*
* JSON array helpers
*/
struct json_object *LUKS2_array_jobj(struct json_object *array, const char *num)
json_object *LUKS2_array_jobj(json_object *array, const char *num)
{
struct json_object *jobj1;
json_object *jobj1;
int i;
for (i = 0; i < (int) json_object_array_length(array); i++) {
@@ -63,9 +63,9 @@ struct json_object *LUKS2_array_jobj(struct json_object *array, const char *num)
return NULL;
}
struct json_object *LUKS2_array_remove(struct json_object *array, const char *num)
json_object *LUKS2_array_remove(json_object *array, const char *num)
{
struct json_object *jobj1, *jobj_removing = NULL, *array_new;
json_object *jobj1, *jobj_removing = NULL, *array_new;
int i;
jobj_removing = LUKS2_array_jobj(array, num);

View File

@@ -45,11 +45,11 @@ out:
return r;
}
static int json_luks1_keyslot(const struct luks_phdr *hdr_v1, int keyslot, struct json_object **keyslot_object)
static int json_luks1_keyslot(const struct luks_phdr *hdr_v1, int keyslot, json_object **keyslot_object)
{
char *base64_str, cipher[LUKS_CIPHERNAME_L+LUKS_CIPHERMODE_L];
size_t base64_len;
struct json_object *keyslot_obj, *field, *jobj_kdf, *jobj_af, *jobj_area;
json_object *keyslot_obj, *field, *jobj_kdf, *jobj_af, *jobj_area;
uint64_t offset, area_size, length;
int r;
@@ -136,10 +136,10 @@ err:
return r;
}
static int json_luks1_keyslots(const struct luks_phdr *hdr_v1, struct json_object **keyslots_object)
static int json_luks1_keyslots(const struct luks_phdr *hdr_v1, json_object **keyslots_object)
{
int keyslot, r;
struct json_object *keyslot_obj, *field;
json_object *keyslot_obj, *field;
keyslot_obj = json_object_new_object();
if (!keyslot_obj)
@@ -165,11 +165,11 @@ static int json_luks1_keyslots(const struct luks_phdr *hdr_v1, struct json_objec
return 0;
}
static int json_luks1_segment(const struct luks_phdr *hdr_v1, struct json_object **segment_object)
static int json_luks1_segment(const struct luks_phdr *hdr_v1, json_object **segment_object)
{
const char *c;
char cipher[LUKS_CIPHERNAME_L+LUKS_CIPHERMODE_L];
struct json_object *segment_obj, *field;
json_object *segment_obj, *field;
uint64_t number;
segment_obj = json_object_new_object();
@@ -239,10 +239,10 @@ static int json_luks1_segment(const struct luks_phdr *hdr_v1, struct json_object
return 0;
}
static int json_luks1_segments(const struct luks_phdr *hdr_v1, struct json_object **segments_object)
static int json_luks1_segments(const struct luks_phdr *hdr_v1, json_object **segments_object)
{
int r;
struct json_object *segments_obj, *field;
json_object *segments_obj, *field;
segments_obj = json_object_new_object();
if (!segments_obj)
@@ -264,12 +264,12 @@ static int json_luks1_segments(const struct luks_phdr *hdr_v1, struct json_objec
return 0;
}
static int json_luks1_digest(const struct luks_phdr *hdr_v1, struct json_object **digest_object)
static int json_luks1_digest(const struct luks_phdr *hdr_v1, json_object **digest_object)
{
char keyslot_str[16], *base64_str;
int r, ks;
size_t base64_len;
struct json_object *digest_obj, *array, *field;
json_object *digest_obj, *array, *field;
digest_obj = json_object_new_object();
if (!digest_obj)
@@ -380,10 +380,10 @@ static int json_luks1_digest(const struct luks_phdr *hdr_v1, struct json_object
return 0;
}
static int json_luks1_digests(const struct luks_phdr *hdr_v1, struct json_object **digests_object)
static int json_luks1_digests(const struct luks_phdr *hdr_v1, json_object **digests_object)
{
int r;
struct json_object *digests_obj, *field;
json_object *digests_obj, *field;
digests_obj = json_object_new_object();
if (!digests_obj)
@@ -400,10 +400,10 @@ static int json_luks1_digests(const struct luks_phdr *hdr_v1, struct json_object
return 0;
}
static int json_luks1_object(struct luks_phdr *hdr_v1, struct json_object **luks1_object, uint64_t keyslots_size)
static int json_luks1_object(struct luks_phdr *hdr_v1, json_object **luks1_object, uint64_t keyslots_size)
{
int r;
struct json_object *luks1_obj, *field;
json_object *luks1_obj, *field;
uint64_t json_size;
luks1_obj = json_object_new_object();

View File

@@ -34,7 +34,7 @@ struct luks2_reencrypt {
/* already running reencryption */
json_object *jobj_segs_hot;
struct json_object *jobj_segs_post;
json_object *jobj_segs_post;
/* backup segments */
json_object *jobj_segment_new;