[4/5] lib: restrict use of keyword extern

Message ID 20230614142651.1456116-5-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series cleanup in library header files |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon June 14, 2023, 2:26 p.m. UTC
  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(-)
  

Patch

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