1
0
Fork 0

Merging upstream version 2.10.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:27:38 +01:00
parent 736f2f7c80
commit 37275c4af3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
530 changed files with 12276 additions and 4877 deletions

View file

@ -5,6 +5,8 @@
#include <unistd.h>
#include <stdlib.h>
#include <libnvme.h>
#include "util/mem.h"
#define __cleanup__(fn) __attribute__((cleanup(fn)))
@ -21,17 +23,36 @@ DECLARE_CLEANUP_FUNC(name, type) \
static inline void freep(void *p)
{
free(*(void**) p);
free(*(void **)p);
}
#define _cleanup_free_ __cleanup__(freep)
#define _cleanup_huge_ __cleanup__(nvme_free_huge)
static inline void close_file(int *f)
static inline void cleanup_fd(int *fd)
{
if (*f > STDERR_FILENO)
close(*f);
if (*fd > STDERR_FILENO)
close(*fd);
}
#define _cleanup_file_ __cleanup__(close_file)
#define _cleanup_fd_ __cleanup__(cleanup_fd)
#endif
static inline void cleanup_nvme_root(nvme_root_t *r)
{
nvme_free_tree(*r);
}
#define _cleanup_nvme_root_ __cleanup__(cleanup_nvme_root)
static inline DEFINE_CLEANUP_FUNC(cleanup_nvme_ctrl, nvme_ctrl_t, nvme_free_ctrl)
#define _cleanup_nvme_ctrl_ __cleanup__(cleanup_nvme_ctrl)
static inline void free_uri(struct nvme_fabrics_uri **uri)
{
if (*uri)
nvme_free_uri(*uri);
}
#define _cleanup_uri_ __cleanup__(free_uri)
static inline DEFINE_CLEANUP_FUNC(cleanup_file, FILE *, fclose)
#define _cleanup_file_ __cleanup__(cleanup_file)
#endif /* __CLEANUP_H */