#include "util.h"
#include "kdbus.h"
+#include "bus-label.h"
#include "sd-memfd.h"
#include "sd-bus.h"
FILE *f;
};
-_public_ int sd_memfd_new(const char *name, sd_memfd **m) {
+_public_ int sd_memfd_new(sd_memfd **m, const char *name) {
struct kdbus_cmd_memfd_make *cmd;
struct kdbus_item *item;
* set here, let's do the usual bus escaping to deal
* with that. */
- g = sd_bus_label_escape(name);
+ g = bus_label_escape(name);
if (!g)
return -ENOMEM;
else {
_cleanup_free_ char *e = NULL;
- e = sd_bus_label_escape(pr);
+ e = bus_label_escape(pr);
if (!e)
return -ENOMEM;
n = new0(struct sd_memfd, 1);
if (!n) {
- close_nointr_nofail(cmd->fd);
+ safe_close(cmd->fd);
return -ENOMEM;
}
return 0;
}
-_public_ int sd_memfd_make(int fd, sd_memfd **m) {
+_public_ int sd_memfd_new_from_fd(sd_memfd **m, int fd) {
sd_memfd *n;
uint64_t sz;
if (m->f)
fclose(m->f);
else
- close_nointr_nofail(m->fd);
+ safe_close(m->fd);
free(m);
}
return r;
}
-_public_ int sd_memfd_new_and_map(const char *name, sd_memfd **m, size_t sz, void **p) {
+_public_ int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p) {
sd_memfd *n;
int r;
- r = sd_memfd_new(name, &n);
+ r = sd_memfd_new(&n, name);
if (r < 0)
return r;
if (!n)
return -ENOMEM;
- e = sd_bus_label_unescape(n);
+ e = bus_label_unescape(n);
if (!e)
return -ENOMEM;