Skip to content

Commit ee56b21

Browse files
committed
cleanup: rename _cleanup_file_ to __cleanup_file
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 7a11717 commit ee56b21

8 files changed

Lines changed: 11 additions & 11 deletions

File tree

libnvme/src/nvme/cleanup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static inline void freep(void *p)
3232
#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)
3838
#define _cleanup_dir_ __cleanup(cleanup_dir)

libnvme/src/nvme/linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ static int uuid_from_dmi_entries(char *system_uuid)
18161816
*/
18171817
static int uuid_from_product_uuid(char *system_uuid)
18181818
{
1819-
_cleanup_file_ FILE *stream = NULL;
1819+
__cleanup_file FILE *stream = NULL;
18201820
ssize_t nread;
18211821
__cleanup_free char *line = NULL;
18221822
size_t len = 0;

libnvme/src/nvme/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ char *kv_keymatch(const char *kv, const char *key)
581581
static size_t read_file(const char * fname, char *buffer, size_t *bufsz)
582582
{
583583
char *p;
584-
_cleanup_file_ FILE *file = NULL;
584+
__cleanup_file FILE *file = NULL;
585585
size_t len;
586586

587587
file = fopen(fname, "re");
@@ -630,7 +630,7 @@ size_t get_entity_name(char *buffer, size_t bufsz)
630630

631631
size_t get_entity_version(char *buffer, size_t bufsz)
632632
{
633-
_cleanup_file_ FILE *file = NULL;
633+
__cleanup_file FILE *file = NULL;
634634
size_t num_bytes = 0;
635635

636636
/* /proc/sys/kernel/ostype typically contains the string "Linux" */

nvme-rpmb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static void write_file(unsigned char *data, size_t len, const char *dir,
210210
const char *file, const char *msg)
211211
{
212212
char temp_folder[PATH_MAX] = { 0 };
213-
_cleanup_file_ FILE *fp = NULL;
213+
__cleanup_file FILE *fp = NULL;
214214

215215
if (dir != NULL)
216216
sprintf(temp_folder, "%s/%s", dir, file);

nvme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9743,7 +9743,7 @@ static int append_keyfile(struct libnvme_global_ctx *ctx, const char *keyring,
97439743
__cleanup_free unsigned char *key_data = NULL;
97449744
__cleanup_free char *exported_key = NULL;
97459745
__cleanup_free char *identity = NULL;
9746-
_cleanup_file_ FILE *fd = NULL;
9746+
__cleanup_file FILE *fd = NULL;
97479747
int err, ver, hmac, key_len;
97489748
mode_t old_umask;
97499749
long kr_id;
@@ -10166,7 +10166,7 @@ static int tls_key(int argc, char **argv, struct command *acmd, struct plugin *p
1016610166
const char *revoke = "Revoke key from the keyring.";
1016710167

1016810168
_cleanup_nvme_global_ctx_ struct libnvme_global_ctx *ctx = NULL;
10169-
_cleanup_file_ FILE *fd = NULL;
10169+
__cleanup_file FILE *fd = NULL;
1017010170
mode_t old_umask = 0;
1017110171
int cnt, err = 0;
1017210172

plugins/innogrit/innogrit-nvme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int innogrit_geteventlog(int argc, char **argv,
176176
const char *desc = "Recrieve event log for the given device ";
177177
_cleanup_nvme_transport_handle_ struct libnvme_transport_handle *hdl = NULL;
178178
_cleanup_nvme_global_ctx_ struct libnvme_global_ctx *ctx = NULL;
179-
_cleanup_file_ FILE *fp = NULL;
179+
__cleanup_file FILE *fp = NULL;
180180
char currentdir[128], filename[512];
181181
struct tm *logtime;
182182
time_t timep;

plugins/lm/lm-nvme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static int lm_migration_send(int argc, char **argv, struct command *acmd, struct
277277
_cleanup_nvme_transport_handle_ struct libnvme_transport_handle *hdl = NULL;
278278
_cleanup_nvme_global_ctx_ struct libnvme_global_ctx *ctx = NULL;
279279
_cleanup_huge_ struct nvme_mem_huge mh = { 0, };
280-
_cleanup_file_ FILE *file = NULL;
280+
__cleanup_file FILE *file = NULL;
281281
struct libnvme_passthru_cmd cmd;
282282
void *data = NULL;
283283
int err = -1;
@@ -409,7 +409,7 @@ static int lm_migration_recv(int argc, char **argv, struct command *acmd, struct
409409
_cleanup_nvme_transport_handle_ struct libnvme_transport_handle *hdl = NULL;
410410
_cleanup_nvme_global_ctx_ struct libnvme_global_ctx *ctx = NULL;
411411
_cleanup_huge_ struct nvme_mem_huge mh = { 0, };
412-
_cleanup_file_ FILE *fd = NULL;
412+
__cleanup_file FILE *fd = NULL;
413413
struct libnvme_passthru_cmd cmd;
414414
nvme_print_flags_t flags;
415415
void *data = NULL;

util/cleanup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ static inline void cleanup_nvmf_context(struct libnvmf_context **fctx)
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)