DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Akhil Goyal <gakhil@marvell.com>,
	Fan Zhang <fanzhang.oss@gmail.com>
Subject: [PATCH 4/5] lib: restrict use of keyword extern
Date: Wed, 14 Jun 2023 16:26:50 +0200	[thread overview]
Message-ID: <20230614142651.1456116-5-thomas@monjalon.net> (raw)
In-Reply-To: <20230614142651.1456116-1-thomas@monjalon.net>

Variable declarations in header files are using extern, it is valid.
But function declarations do not need the keyword extern.

Also, extern "C" should have a space after the keyword extern.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/acl/acl.h                 |  2 +-
 lib/bpf/bpf_impl.h            |  8 ++++----
 lib/cryptodev/cryptodev_pmd.h |  2 +-
 lib/cryptodev/rte_crypto.h    |  2 +-
 lib/cryptodev/rte_cryptodev.h | 35 +++++++++++++++++------------------
 lib/eal/include/rte_hexdump.h |  2 +-
 lib/security/rte_security.h   |  6 +++---
 7 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/lib/acl/acl.h b/lib/acl/acl.h
index f5739a475c..c8e4e72fab 100644
--- a/lib/acl/acl.h
+++ b/lib/acl/acl.h
@@ -6,7 +6,7 @@
 #define	_ACL_H_
 
 #ifdef __cplusplus
-extern"C" {
+extern "C" {
 #endif /* __cplusplus */
 
 #define RTE_ACL_QUAD_MAX	5
diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 3e067c1ff4..b483569071 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -21,10 +21,10 @@ struct rte_bpf {
  * Use '__rte' prefix for non-static internal functions
  * to avoid potential name conflict with other libraries.
  */
-extern int __rte_bpf_validate(struct rte_bpf *bpf);
-extern int __rte_bpf_jit(struct rte_bpf *bpf);
-extern int __rte_bpf_jit_x86(struct rte_bpf *bpf);
-extern int __rte_bpf_jit_arm64(struct rte_bpf *bpf);
+int __rte_bpf_validate(struct rte_bpf *bpf);
+int __rte_bpf_jit(struct rte_bpf *bpf);
+int __rte_bpf_jit_x86(struct rte_bpf *bpf);
+int __rte_bpf_jit_arm64(struct rte_bpf *bpf);
 
 extern int rte_bpf_logtype;
 
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 585c29df8a..8710ed7558 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -534,7 +534,7 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id);
  *   - 0 on success, negative on error
  */
 __rte_internal
-extern int
+int
 rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev);
 
 
diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h
index 7c9c413349..9b8d0331a4 100644
--- a/lib/cryptodev/rte_crypto.h
+++ b/lib/cryptodev/rte_crypto.h
@@ -216,7 +216,7 @@ __rte_crypto_op_get_priv_data_size(struct rte_mempool *mempool)
  *  - On success pointer to mempool
  *  - On failure NULL
  */
-extern struct rte_mempool *
+struct rte_mempool *
 rte_crypto_op_pool_create(const char *name, enum rte_crypto_op_type type,
 		unsigned nb_elts, unsigned cache_size, uint16_t priv_size,
 		int socket_id);
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index be708edc0f..ba730373fb 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -545,8 +545,7 @@ rte_cryptodev_asym_get_xform_string(enum rte_crypto_asym_xform_type xform_enum);
  * @return
  *   The name of this flag, or NULL if it's not a valid feature flag.
  */
-
-extern const char *
+const char *
 rte_cryptodev_get_feature_name(uint64_t flag);
 
 /**  Crypto device information */
@@ -662,7 +661,7 @@ struct rte_cryptodev_stats {
  *   - Returns crypto device identifier on success.
  *   - Return -1 on failure to find named crypto device.
  */
-extern int
+int
 rte_cryptodev_get_dev_id(const char *name);
 
 /**
@@ -675,7 +674,7 @@ rte_cryptodev_get_dev_id(const char *name);
  *   - Returns crypto device name.
  *   - Returns NULL if crypto device is not present.
  */
-extern const char *
+const char *
 rte_cryptodev_name_get(uint8_t dev_id);
 
 /**
@@ -685,7 +684,7 @@ rte_cryptodev_name_get(uint8_t dev_id);
  * @return
  *   - The total number of usable crypto devices.
  */
-extern uint8_t
+uint8_t
 rte_cryptodev_count(void);
 
 /**
@@ -696,7 +695,7 @@ rte_cryptodev_count(void);
  * @return
  *   Returns number of crypto device.
  */
-extern uint8_t
+uint8_t
 rte_cryptodev_device_count_by_driver(uint8_t driver_id);
 
 /**
@@ -723,7 +722,7 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
  *   a default of zero if the socket could not be determined.
  *   -1 if returned is the dev_id value is out of range.
  */
-extern int
+int
 rte_cryptodev_socket_id(uint8_t dev_id);
 
 /** Crypto device configuration structure */
@@ -756,7 +755,7 @@ struct rte_cryptodev_config {
  *   - 0: Success, device configured.
  *   - <0: Error code returned by the driver configuration function.
  */
-extern int
+int
 rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
 
 /**
@@ -774,7 +773,7 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config);
  *   - 0: Success, device started.
  *   - <0: Error code of the driver device start function.
  */
-extern int
+int
 rte_cryptodev_start(uint8_t dev_id);
 
 /**
@@ -783,7 +782,7 @@ rte_cryptodev_start(uint8_t dev_id);
  *
  * @param	dev_id		The identifier of the device.
  */
-extern void
+void
 rte_cryptodev_stop(uint8_t dev_id);
 
 /**
@@ -795,7 +794,7 @@ rte_cryptodev_stop(uint8_t dev_id);
  *  - 0 on successfully closing device
  *  - <0 on failure to close device
  */
-extern int
+int
 rte_cryptodev_close(uint8_t dev_id);
 
 /**
@@ -819,7 +818,7 @@ rte_cryptodev_close(uint8_t dev_id);
  *   - 0: Success, queue pair correctly set up.
  *   - <0: Queue pair configuration failed
  */
-extern int
+int
 rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 		const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
 
@@ -847,7 +846,7 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
  * @return
  *   - The number of configured queue pairs.
  */
-extern uint16_t
+uint16_t
 rte_cryptodev_queue_pair_count(uint8_t dev_id);
 
 
@@ -862,7 +861,7 @@ rte_cryptodev_queue_pair_count(uint8_t dev_id);
  *   - Zero if successful.
  *   - Non-zero otherwise.
  */
-extern int
+int
 rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
 
 /**
@@ -870,7 +869,7 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats);
  *
  * @param	dev_id		The identifier of the device.
  */
-extern void
+void
 rte_cryptodev_stats_reset(uint8_t dev_id);
 
 /**
@@ -886,7 +885,7 @@ rte_cryptodev_stats_reset(uint8_t dev_id);
  * the last valid element has it's op field set to
  * RTE_CRYPTO_OP_TYPE_UNDEFINED.
  */
-extern void
+void
 rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
 
 
@@ -903,7 +902,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info);
  *  - On success, zero.
  *  - On failure, a negative value.
  */
-extern int
+int
 rte_cryptodev_callback_register(uint8_t dev_id,
 		enum rte_cryptodev_event_type event,
 		rte_cryptodev_cb_fn cb_fn, void *cb_arg);
@@ -921,7 +920,7 @@ rte_cryptodev_callback_register(uint8_t dev_id,
  *  - On success, zero.
  *  - On failure, a negative value.
  */
-extern int
+int
 rte_cryptodev_callback_unregister(uint8_t dev_id,
 		enum rte_cryptodev_event_type event,
 		rte_cryptodev_cb_fn cb_fn, void *cb_arg);
diff --git a/lib/eal/include/rte_hexdump.h b/lib/eal/include/rte_hexdump.h
index 009ce24c5c..59813f2096 100644
--- a/lib/eal/include/rte_hexdump.h
+++ b/lib/eal/include/rte_hexdump.h
@@ -28,7 +28,7 @@ extern "C" {
  * @param len
  *   The number of bytes to dump out.
  */
-extern void
+void
 rte_hexdump(FILE *f, const char *title, const void *buf, unsigned int len);
 
 /**
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index daef846d40..3b2df526ba 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -901,9 +901,9 @@ rte_security_session_fast_mdata_set(void *sess, uint64_t fdata)
 
 /** Function to call PMD specific function pointer set_pkt_metadata() */
 __rte_experimental
-extern int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
-					   void *sess,
-					   struct rte_mbuf *m, void *params);
+int __rte_security_set_pkt_metadata(struct rte_security_ctx *instance,
+				    void *sess,
+				    struct rte_mbuf *m, void *params);
 
 /**
  *  Updates the buffer with device-specific defined metadata
-- 
2.40.1


  parent reply	other threads:[~2023-06-14 14:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 14:26 [PATCH 0/5] cleanup in library header files Thomas Monjalon
2023-06-14 14:26 ` [PATCH 1/5] lib: remove blank line ending comment blocks Thomas Monjalon
2023-06-15  7:27   ` Ruifeng Wang
2023-06-14 14:26 ` [PATCH 2/5] lib: remove extra asterisks " Thomas Monjalon
2023-06-14 14:26 ` [PATCH 3/5] lib: align " Thomas Monjalon
2023-06-15  7:16   ` Ruifeng Wang
2023-06-14 14:26 ` Thomas Monjalon [this message]
2023-06-14 14:26 ` [PATCH 5/5] cryptodev: fix comments of modular operation parameters Thomas Monjalon
2023-06-14 14:42 ` [PATCH 0/5] cleanup in library header files Jerin Jacob
2023-06-14 15:08   ` David Marchand
2023-06-14 15:53     ` Thomas Monjalon
2023-06-14 14:46 ` Bruce Richardson
2023-06-27 14:52   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230614142651.1456116-5-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=gakhil@marvell.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).