From: Hao Fang fanghao11@huawei.com
Some code format alignment refer to the linux coding style.
Signed-off-by: Hao Fang fanghao11@huawei.com Signed-off-by: Qi Tao taoqi10@huawei.com --- wd_aead.c | 8 ++++---- wd_alg.c | 4 ++-- wd_cipher.c | 8 ++++---- wd_dh.c | 2 +- wd_digest.c | 10 +++++----- wd_ecc.c | 12 ++++++------ wd_mempool.c | 20 ++++++++++---------- wd_rsa.c | 36 ++++++++++++++++++------------------ wd_sched.c | 6 +++--- wd_util.c | 12 ++++++------ 10 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/wd_aead.c b/wd_aead.c index daed761..0e59768 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -372,7 +372,7 @@ void wd_aead_free_sess(handle_t h_sess) }
static int wd_aead_param_check(struct wd_aead_sess *sess, - struct wd_aead_req *req) + struct wd_aead_req *req) { __u32 len; int ret; @@ -558,7 +558,7 @@ static bool wd_aead_algs_check(const char *alg) }
int wd_aead_init2_(char *alg, __u32 sched_type, int task_type, - struct wd_ctx_params *ctx_params) + struct wd_ctx_params *ctx_params) { struct wd_ctx_nums aead_ctx_num[WD_DIGEST_CIPHER_DECRYPTION + 1] = {0}; struct wd_ctx_params aead_ctx_params = {0}; @@ -697,7 +697,7 @@ static void fill_stream_msg(struct wd_aead_msg *msg, struct wd_aead_req *req, }
static void fill_request_msg(struct wd_aead_msg *msg, struct wd_aead_req *req, - struct wd_aead_sess *sess) + struct wd_aead_sess *sess) { memcpy(&msg->req, req, sizeof(struct wd_aead_req));
@@ -944,7 +944,7 @@ int wd_aead_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_aead_env_config, table, - &wd_aead_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_aead_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_aead_ctx_num_uninit(void) diff --git a/wd_alg.c b/wd_alg.c index 1457573..3d014e1 100644 --- a/wd_alg.c +++ b/wd_alg.c @@ -270,7 +270,7 @@ struct wd_alg_list *wd_get_alg_head(void) }
bool wd_drv_alg_support(const char *alg_name, - struct wd_alg_driver *drv) + struct wd_alg_driver *drv) { struct wd_alg_list *head = &alg_list_head; struct wd_alg_list *pnext = head->next; @@ -358,7 +358,7 @@ struct wd_alg_driver *wd_request_drv(const char *alg_name, bool hw_mask) }
if (!strcmp(alg_name, pnext->alg_name) && pnext->available && - pnext->drv->priority > tmp_priority) { + pnext->drv->priority > tmp_priority) { tmp_priority = pnext->drv->priority; select_node = pnext; drv = pnext->drv; diff --git a/wd_cipher.c b/wd_cipher.c index 505773a..f34a47e 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -321,7 +321,7 @@ static void wd_cipher_clear_status(void) }
static int wd_cipher_common_init(struct wd_ctx_config *config, - struct wd_sched *sched) + struct wd_sched *sched) { int ret;
@@ -346,7 +346,7 @@ static int wd_cipher_common_init(struct wd_ctx_config *config, goto out_clear_sched;
ret = wd_alg_init_driver(&wd_cipher_setting.config, - wd_cipher_setting.driver); + wd_cipher_setting.driver); if (ret) goto out_clear_pool;
@@ -611,7 +611,7 @@ static int cipher_len_check(handle_t h_sess, struct wd_cipher_req *req) }
static int wd_cipher_check_params(handle_t h_sess, - struct wd_cipher_req *req, __u8 mode) + struct wd_cipher_req *req, __u8 mode) { struct wd_cipher_sess *sess = (struct wd_cipher_sess *)h_sess; int ret; @@ -881,7 +881,7 @@ int wd_cipher_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_cipher_env_config, table, - &wd_cipher_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_cipher_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_cipher_ctx_num_uninit(void) diff --git a/wd_dh.c b/wd_dh.c index 36b0cd7..cdcba14 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -320,7 +320,7 @@ void wd_dh_uninit2(void) }
static int fill_dh_msg(struct wd_dh_msg *msg, struct wd_dh_req *req, - struct wd_dh_sess *sess) + struct wd_dh_sess *sess) { memcpy(&msg->req, req, sizeof(*req)); msg->result = WD_EINVAL; diff --git a/wd_digest.c b/wd_digest.c index 7449259..2e9734d 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -277,7 +277,7 @@ static int wd_digest_init_nolock(struct wd_ctx_config *config, goto out_clear_sched;
ret = wd_alg_init_driver(&wd_digest_setting.config, - wd_digest_setting.driver); + wd_digest_setting.driver); if (ret) goto out_clear_pool;
@@ -364,7 +364,7 @@ static bool wd_digest_algs_check(const char *alg) }
int wd_digest_init2_(char *alg, __u32 sched_type, int task_type, - struct wd_ctx_params *ctx_params) + struct wd_ctx_params *ctx_params) { struct wd_ctx_params digest_ctx_params = {0}; struct wd_ctx_nums digest_ctx_num = {0}; @@ -464,7 +464,7 @@ void wd_digest_uninit2(void) }
static int wd_aes_hmac_length_check(struct wd_digest_sess *sess, - struct wd_digest_req *req) + struct wd_digest_req *req) { switch (sess->alg) { case WD_DIGEST_AES_XCBC_MAC_96: @@ -517,7 +517,7 @@ static int wd_mac_length_check(struct wd_digest_sess *sess, }
static int wd_digest_param_check(struct wd_digest_sess *sess, - struct wd_digest_req *req) + struct wd_digest_req *req) { int ret;
@@ -841,7 +841,7 @@ int wd_digest_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_digest_env_config, table, - &wd_digest_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_digest_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_digest_ctx_num_uninit(void) diff --git a/wd_ecc.c b/wd_ecc.c index d36a697..ec5e7ad 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -595,7 +595,7 @@ static struct wd_ecc_in *create_ecc_in(struct wd_ecc_sess *sess, __u32 num) }
static struct wd_ecc_in *create_sm2_sign_in(struct wd_ecc_sess *sess, - __u64 m_len) + __u64 m_len) { struct wd_dtb *dgst, *k, *plaintext; __u32 ksz = sess->key_size; @@ -1238,7 +1238,7 @@ struct wd_ecc_key *wd_ecc_get_key(handle_t sess) }
int wd_ecc_set_prikey(struct wd_ecc_key *ecc_key, - struct wd_dtb *prikey) + struct wd_dtb *prikey) { struct wd_ecc_prikey *ecc_prikey; struct wd_dtb *d; @@ -1264,7 +1264,7 @@ int wd_ecc_set_prikey(struct wd_ecc_key *ecc_key, }
int wd_ecc_get_prikey(struct wd_ecc_key *ecc_key, - struct wd_dtb **prikey) + struct wd_dtb **prikey) { if (!ecc_key || !prikey) { WD_ERR("invalid: get ecc prikey parameter err!\n"); @@ -2259,8 +2259,8 @@ int wd_do_ecc_async(handle_t sess, struct wd_ecc_req *req) }
idx = wd_ecc_setting.sched.pick_next_ctx(h_sched_ctx, - sess_t->sched_key, - CTX_MODE_ASYNC); + sess_t->sched_key, + CTX_MODE_ASYNC); ret = wd_check_ctx(config, CTX_MODE_ASYNC, idx); if (ret) return ret; @@ -2408,7 +2408,7 @@ int wd_ecc_ctx_num_init(__u32 node, __u32 type, __u32 num, __u8 mode) return ret;
return wd_alg_env_init(&wd_ecc_env_config, table, - &wd_ecc_ops, ARRAY_SIZE(table), &ctx_attr); + &wd_ecc_ops, ARRAY_SIZE(table), &ctx_attr); }
void wd_ecc_ctx_num_uninit(void) diff --git a/wd_mempool.c b/wd_mempool.c index 47ad36b..2d21a0d 100644 --- a/wd_mempool.c +++ b/wd_mempool.c @@ -409,10 +409,10 @@ static int check_mempool_real_size(struct mempool *mp, struct blkpool *bp) }
static int alloc_block_from_mempool(struct mempool *mp, - struct blkpool *bp, - int pos, - int mem_combined_num, - int mem_splited_num) + struct blkpool *bp, + int pos, + int mem_combined_num, + int mem_splited_num) { int pos_last = pos; int pos_first; @@ -435,7 +435,7 @@ static int alloc_block_from_mempool(struct mempool *mp, set_bit(mp->bitmap, i);
ret = alloc_memzone(bp, mp->addr + pos_first * mp->blk_size, - mem_splited_num, pos_first, pos_last); + mem_splited_num, pos_first, pos_last); if (ret < 0) goto err_clear_bit;
@@ -461,7 +461,7 @@ static int alloc_mem_multi_in_one(struct mempool *mp, struct blkpool *bp)
while (blk_num > 0) { ret = alloc_block_from_mempool(mp, bp, pos, 1, - MIN(blk_num, mem_splited_num)); + MIN(blk_num, mem_splited_num)); if (ret < 0) goto err_free_memzone;
@@ -488,7 +488,7 @@ err_check_size: static int alloc_mem_one_need_multi(struct mempool *mp, struct blkpool *bp) { int mem_combined_num = bp->blk_size / mp->blk_size + - (bp->blk_size % mp->blk_size ? 1 : 0); + (bp->blk_size % mp->blk_size ? 1 : 0); int blk_num = bp->depth; int ret = -WD_ENOMEM; int pos = 0; @@ -499,7 +499,7 @@ static int alloc_mem_one_need_multi(struct mempool *mp, struct blkpool *bp)
while (blk_num > 0) { ret = alloc_block_from_mempool(mp, bp, pos, - mem_combined_num, 1); + mem_combined_num, 1); if (ret < 0) goto err_free_memzone;
@@ -660,8 +660,8 @@ err_open: }
/* hp_dir is e.g. /sys/devices/system/node/nodex/hugepages/hugepages-64kB */ -static int get_hugepage_info_per_type(const char *hugepage_path, int path_size, - struct dirent *hp_dir, struct sys_hugepage_config *cfg) +static int get_hugepage_info_per_type(const char *hugepage_path, int path_size, struct dirent *hp_dir, + struct sys_hugepage_config *cfg) { char path[MAX_ATTR_STR_SIZE]; char *name = hp_dir->d_name; diff --git a/wd_rsa.c b/wd_rsa.c index f7f815c..c3709de 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -605,10 +605,10 @@ int wd_rsa_kg_out_data(struct wd_rsa_kg_out *ko, char **data)
/* Create a RSA key generate operation input with parameter e, p and q */ struct wd_rsa_kg_in *wd_rsa_new_kg_in(handle_t sess, struct wd_dtb *e, - struct wd_dtb *p, struct wd_dtb *q) + struct wd_dtb *p, struct wd_dtb *q) { - struct wd_rsa_kg_in *kg_in; struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess; + struct wd_rsa_kg_in *kg_in; int kg_in_size;
if (!c || !e || !p || !q) { @@ -745,7 +745,7 @@ void wd_rsa_del_kg_out(handle_t sess, struct wd_rsa_kg_out *kout) }
void wd_rsa_get_kg_out_params(struct wd_rsa_kg_out *kout, struct wd_dtb *d, - struct wd_dtb *n) + struct wd_dtb *n) { if (!kout) { WD_ERR("invalid: input null at get key gen params!\n"); @@ -766,8 +766,8 @@ void wd_rsa_get_kg_out_params(struct wd_rsa_kg_out *kout, struct wd_dtb *d, }
void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout, - struct wd_dtb *qinv, - struct wd_dtb *dq, struct wd_dtb *dp) + struct wd_dtb *qinv, + struct wd_dtb *dq, struct wd_dtb *dp) { if (!kout || !qinv || !dq || !dp) { WD_ERR("invalid: input null at get key gen crt para!\n"); @@ -794,9 +794,9 @@ void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout, }
void wd_rsa_set_kg_out_crt_psz(struct wd_rsa_kg_out *kout, - size_t qinv_sz, - size_t dq_sz, - size_t dp_sz) + size_t qinv_sz, + size_t dq_sz, + size_t dp_sz) { kout->qinvbytes = qinv_sz; kout->dqbytes = dq_sz; @@ -804,8 +804,8 @@ void wd_rsa_set_kg_out_crt_psz(struct wd_rsa_kg_out *kout, }
void wd_rsa_set_kg_out_psz(struct wd_rsa_kg_out *kout, - size_t d_sz, - size_t n_sz) + size_t d_sz, + size_t n_sz) { kout->dbytes = d_sz; kout->nbytes = n_sz; @@ -847,7 +847,7 @@ static void init_pubkey(struct wd_rsa_pubkey *pubkey, int ksz) }
static int create_sess_key(struct wd_rsa_sess_setup *setup, - struct wd_rsa_sess *sess) + struct wd_rsa_sess *sess) { struct wd_rsa_prikey2 *pkey2; struct wd_rsa_prikey1 *pkey1; @@ -1036,7 +1036,7 @@ int wd_rsa_set_pubkey_params(handle_t sess, struct wd_dtb *e, struct wd_dtb *n) }
void wd_rsa_get_pubkey_params(struct wd_rsa_pubkey *pbk, struct wd_dtb **e, - struct wd_dtb **n) + struct wd_dtb **n) { if (!pbk) { WD_ERR("invalid: input NULL in get rsa public key!\n"); @@ -1084,7 +1084,7 @@ int wd_rsa_set_prikey_params(handle_t sess, struct wd_dtb *d, struct wd_dtb *n) }
void wd_rsa_get_prikey_params(struct wd_rsa_prikey *pvk, struct wd_dtb **d, - struct wd_dtb **n) + struct wd_dtb **n) { struct wd_rsa_prikey1 *pkey1;
@@ -1148,8 +1148,8 @@ static int rsa_prikey2_param_set(struct wd_rsa_prikey2 *pkey2, }
int wd_rsa_set_crt_prikey_params(handle_t sess, struct wd_dtb *dq, - struct wd_dtb *dp, struct wd_dtb *qinv, - struct wd_dtb *q, struct wd_dtb *p) + struct wd_dtb *dp, struct wd_dtb *qinv, + struct wd_dtb *q, struct wd_dtb *p) { struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess; struct wd_rsa_prikey2 *pkey2; @@ -1200,9 +1200,9 @@ int wd_rsa_set_crt_prikey_params(handle_t sess, struct wd_dtb *dq, }
void wd_rsa_get_crt_prikey_params(struct wd_rsa_prikey *pvk, - struct wd_dtb **dq, - struct wd_dtb **dp, struct wd_dtb **qinv, - struct wd_dtb **q, struct wd_dtb **p) + struct wd_dtb **dq, + struct wd_dtb **dp, struct wd_dtb **qinv, + struct wd_dtb **q, struct wd_dtb **p) { struct wd_rsa_prikey2 *pkey2;
diff --git a/wd_sched.c b/wd_sched.c index 6766872..aa6c91e 100644 --- a/wd_sched.c +++ b/wd_sched.c @@ -362,13 +362,13 @@ static handle_t sched_none_init(handle_t h_sched_ctx, void *sched_param) }
static __u32 sched_none_pick_next_ctx(handle_t sched_ctx, - void *sched_key, const int sched_mode) + void *sched_key, const int sched_mode) { return 0; }
static int sched_none_poll_policy(handle_t h_sched_ctx, - __u32 expect, __u32 *count) + __u32 expect, __u32 *count) { struct wd_sched_ctx *sched_ctx = (struct wd_sched_ctx *)h_sched_ctx; __u32 loop_times = MAX_POLL_TIMES + expect; @@ -403,7 +403,7 @@ static handle_t sched_single_init(handle_t h_sched_ctx, void *sched_param) }
static __u32 sched_single_pick_next_ctx(handle_t sched_ctx, - void *sched_key, const int sched_mode) + void *sched_key, const int sched_mode) { #define CTX_ASYNC 1 #define CTX_SYNC 0 diff --git a/wd_util.c b/wd_util.c index 5f149a1..99be973 100644 --- a/wd_util.c +++ b/wd_util.c @@ -813,7 +813,7 @@ static void wd_free_ctx_table(struct wd_env_config *config) }
static int get_and_fill_ctx_num(struct wd_env_config_per_numa *config_numa, - const char *p, int ctx_num) + const char *p, int ctx_num) { struct wd_ctx_range **ctx_table = config_numa->ctx_table; const char *type; @@ -891,7 +891,7 @@ static int get_start_ctx_index(struct wd_env_config *config, }
static void set_ctx_index(struct wd_env_config_per_numa *config_numa, - __u8 mode, int *start) + __u8 mode, int *start) { struct wd_ctx_range **ctx_table = config_numa->ctx_table; int size, i, sum = 0; @@ -1551,8 +1551,8 @@ static void wd_uninit_one_task_queue(struct async_task_queue *task_queue) }
static int wd_init_async_polling_thread_per_numa(struct wd_env_config *config, - struct wd_env_config_per_numa *config_numa, - void *alg_poll_ctx) + struct wd_env_config_per_numa *config_numa, + void *alg_poll_ctx) { struct async_task_queue *task_queue, *queue_head; int i, j, ret; @@ -1592,7 +1592,7 @@ static int wd_init_async_polling_thread_per_numa(struct wd_env_config *config, }
static void wd_uninit_async_polling_thread_per_numa(struct wd_env_config *cfg, - struct wd_env_config_per_numa *config_numa) + struct wd_env_config_per_numa *config_numa) { struct async_task_queue *task_queue, *head; double num; @@ -2001,7 +2001,7 @@ void wd_dlclose_drv(void *dlh_list) }
static void add_lib_to_list(struct drv_lib_list *head, - struct drv_lib_list *node) + struct drv_lib_list *node) { struct drv_lib_list *tmp = head;