Skip to content

Commit 7adfa53

Browse files
committed
cleanup: rename __cleanup__ to __cleanup
Follow the new naming pattern of the compiler attributes which is just __NAME. This is what the kernel is using as well. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 87540df commit 7adfa53

7 files changed

Lines changed: 25 additions & 25 deletions

File tree

libnvme/src/nvme/cleanup.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "fabrics.h"
1515

16-
#define __cleanup__(fn) __attribute__((cleanup(fn)))
16+
#define __cleanup(fn) __attribute__((cleanup(fn)))
1717

1818
#define DECLARE_CLEANUP_FUNC(name, type) \
1919
void name(type *__p)
@@ -29,29 +29,29 @@ static inline void freep(void *p)
2929
{
3030
free(*(void **)p);
3131
}
32-
#define _cleanup_free_ __cleanup__(freep)
32+
#define _cleanup_free_ __cleanup(freep)
3333

3434
static inline DEFINE_CLEANUP_FUNC(cleanup_file, FILE *, fclose)
35-
#define _cleanup_file_ __cleanup__(cleanup_file)
35+
#define _cleanup_file_ __cleanup(cleanup_file)
3636

3737
static inline DEFINE_CLEANUP_FUNC(cleanup_dir, DIR *, closedir)
38-
#define _cleanup_dir_ __cleanup__(cleanup_dir)
38+
#define _cleanup_dir_ __cleanup(cleanup_dir)
3939

4040
static inline void cleanup_fd(int *fd)
4141
{
4242
if (*fd >= 0)
4343
close(*fd);
4444
}
45-
#define _cleanup_fd_ __cleanup__(cleanup_fd)
45+
#define _cleanup_fd_ __cleanup(cleanup_fd)
4646

4747
static inline DEFINE_CLEANUP_FUNC(cleanup_addrinfo, struct addrinfo *, freeaddrinfo)
48-
#define _cleanup_addrinfo_ __cleanup__(cleanup_addrinfo)
48+
#define _cleanup_addrinfo_ __cleanup(cleanup_addrinfo)
4949

5050
static inline void free_uri(struct libnvme_fabrics_uri **uri)
5151
{
5252
if (*uri)
5353
libnvmf_free_uri(*uri);
5454
}
55-
#define _cleanup_uri_ __cleanup__(free_uri)
55+
#define _cleanup_uri_ __cleanup(free_uri)
5656

5757
#endif

libnvme/src/nvme/json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void json_parse_host(struct libnvme_global_ctx *ctx, struct json_object *
191191
}
192192

193193
static DEFINE_CLEANUP_FUNC(cleanup_tokener, json_tokener *, json_tokener_free)
194-
#define _cleanup_tokener_ __cleanup__(cleanup_tokener)
194+
#define _cleanup_tokener_ __cleanup(cleanup_tokener)
195195

196196
static struct json_object *parse_json(struct libnvme_global_ctx *ctx, int fd)
197197
{

libnvme/src/nvme/linux.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static const EVP_MD *select_hmac(int hmac, size_t *hmac_len)
263263

264264
static DEFINE_CLEANUP_FUNC(
265265
cleanup_evp_pkey_ctx, EVP_PKEY_CTX *, EVP_PKEY_CTX_free)
266-
#define _cleanup_evp_pkey_ctx_ __cleanup__(cleanup_evp_pkey_ctx)
266+
#define _cleanup_evp_pkey_ctx_ __cleanup(cleanup_evp_pkey_ctx)
267267

268268
/* NVMe is using the TLS 1.3 HkdfLabel structure */
269269
#define HKDF_INFO_MAX_LEN 514
@@ -598,11 +598,11 @@ static int derive_tls_key_compat(struct libnvme_global_ctx *ctx,
598598

599599
static DEFINE_CLEANUP_FUNC(
600600
cleanup_ossl_lib_ctx, OSSL_LIB_CTX *, OSSL_LIB_CTX_free)
601-
#define _cleanup_ossl_lib_ctx_ __cleanup__(cleanup_ossl_lib_ctx)
601+
#define _cleanup_ossl_lib_ctx_ __cleanup(cleanup_ossl_lib_ctx)
602602
static DEFINE_CLEANUP_FUNC(cleanup_evp_mac_ctx, EVP_MAC_CTX *, EVP_MAC_CTX_free)
603-
#define _cleanup_evp_mac_ctx_ __cleanup__(cleanup_evp_mac_ctx)
603+
#define _cleanup_evp_mac_ctx_ __cleanup(cleanup_evp_mac_ctx)
604604
static DEFINE_CLEANUP_FUNC(cleanup_evp_mac, EVP_MAC *, EVP_MAC_free)
605-
#define _cleanup_evp_mac_ __cleanup__(cleanup_evp_mac)
605+
#define _cleanup_evp_mac_ __cleanup(cleanup_evp_mac)
606606

607607
__public int libnvme_gen_dhchap_key(struct libnvme_global_ctx *ctx,
608608
char *hostnqn, enum libnvme_hmac_alg hmac,

libnvme/src/nvme/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void cleanup_dirents(struct dirents *ents)
109109
free(ents->ents);
110110
}
111111

112-
#define _cleanup_dirents_ __cleanup__(cleanup_dirents)
112+
#define _cleanup_dirents_ __cleanup(cleanup_dirents)
113113

114114
static char *nvme_hostid_from_hostnqn(const char *hostnqn)
115115
{

libnvme/test/ioctl/util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ void arbitrary(void *buf, size_t len);
1717

1818
size_t arbitrary_range(size_t max);
1919

20-
#define __cleanup__(fn) __attribute__((cleanup(fn)))
20+
#define __cleanup(fn) __attribute__((cleanup(fn)))
2121

2222
static inline void freep(void *p)
2323
{
2424
free(*(void **)p);
2525
}
26-
#define _cleanup_free_ __cleanup__(freep)
26+
#define _cleanup_free_ __cleanup(freep)
2727

2828
#endif /* #ifndef _LIBNVME_TEST_IOCTL_UTIL_H */

nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ int parse_and_open(struct libnvme_global_ctx **ctx,
117117
// TODO: unsure if we need a double ptr here
118118
static inline DEFINE_CLEANUP_FUNC(
119119
cleanup_nvme_transport_handle, struct libnvme_transport_handle *, libnvme_close)
120-
#define _cleanup_nvme_transport_handle_ __cleanup__(cleanup_nvme_transport_handle)
120+
#define _cleanup_nvme_transport_handle_ __cleanup(cleanup_nvme_transport_handle)
121121

122122
extern const char *uuid_index;
123123
extern const char *namespace_id_desired;

util/cleanup.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "util/mem.h"
1111

12-
#define __cleanup__(fn) __attribute__((cleanup(fn)))
12+
#define __cleanup(fn) __attribute__((cleanup(fn)))
1313

1414
#define DECLARE_CLEANUP_FUNC(name, type) \
1515
void name(type *__p)
@@ -25,42 +25,42 @@ static inline void freep(void *p)
2525
{
2626
free(*(void **)p);
2727
}
28-
#define _cleanup_free_ __cleanup__(freep)
28+
#define _cleanup_free_ __cleanup(freep)
2929

30-
#define _cleanup_huge_ __cleanup__(nvme_free_huge)
30+
#define _cleanup_huge_ __cleanup(nvme_free_huge)
3131

3232
static inline void cleanup_fd(int *fd)
3333
{
3434
if (*fd > STDERR_FILENO)
3535
close(*fd);
3636
}
37-
#define _cleanup_fd_ __cleanup__(cleanup_fd)
37+
#define _cleanup_fd_ __cleanup(cleanup_fd)
3838

3939
static inline void cleanup_nvme_global_ctx(struct libnvme_global_ctx **ctx)
4040
{
4141
libnvme_free_global_ctx(*ctx);
4242
}
43-
#define _cleanup_nvme_global_ctx_ __cleanup__(cleanup_nvme_global_ctx)
43+
#define _cleanup_nvme_global_ctx_ __cleanup(cleanup_nvme_global_ctx)
4444

4545
static inline DEFINE_CLEANUP_FUNC(cleanup_nvme_ctrl, libnvme_ctrl_t, libnvme_free_ctrl)
46-
#define _cleanup_nvme_ctrl_ __cleanup__(cleanup_nvme_ctrl)
46+
#define _cleanup_nvme_ctrl_ __cleanup(cleanup_nvme_ctrl)
4747

4848
#ifdef CONFIG_FABRICS
4949
static inline void free_uri(struct libnvme_fabrics_uri **uri)
5050
{
5151
if (*uri)
5252
libnvmf_free_uri(*uri);
5353
}
54-
#define _cleanup_uri_ __cleanup__(free_uri)
54+
#define _cleanup_uri_ __cleanup(free_uri)
5555

5656
static inline void cleanup_nvmf_context(struct libnvmf_context **fctx)
5757
{
5858
libnvmf_context_free(*fctx);
5959
}
60-
#define _cleanup_nvmf_context_ __cleanup__(cleanup_nvmf_context)
60+
#define _cleanup_nvmf_context_ __cleanup(cleanup_nvmf_context)
6161
#endif
6262

6363
static inline DEFINE_CLEANUP_FUNC(cleanup_file, FILE *, fclose)
64-
#define _cleanup_file_ __cleanup__(cleanup_file)
64+
#define _cleanup_file_ __cleanup(cleanup_file)
6565

6666
#endif /* __CLEANUP_H */

0 commit comments

Comments
 (0)