summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-04-11 16:52:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-15 12:21:45 +0200
commit947fb5adf8af450507c978abf1c7ec9f051e5842 (patch)
treeaf790669292308b56baf188611ac430012037cba /fs
parent48b205e32342fc8a2648b2bd3f1f6d9a7d74e6cb (diff)
downloadbarebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.gz
barebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.xz
string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/bpkfs.c6
-rw-r--r--fs/efi.c4
-rw-r--r--fs/efivarfs.c4
-rw-r--r--fs/fs.c7
-rw-r--r--fs/nfs.c9
-rw-r--r--fs/ubifs/ubifs.c4
-rw-r--r--fs/uimagefs.c10
7 files changed, 22 insertions, 22 deletions
diff --git a/fs/bpkfs.c b/fs/bpkfs.c
index 309a122c19..f1db963d09 100644
--- a/fs/bpkfs.c
+++ b/fs/bpkfs.c
@@ -103,7 +103,7 @@ static struct bpkfs_handle_hw *bpkfs_get_or_add_hw_id(
INIT_LIST_HEAD(&h->list_data);
h->hw_id = hw_id;
- h->name = asprintf("hw_id_%x", hw_id);
+ h->name = basprintf("hw_id_%x", hw_id);
list_add_tail(&h->list_hw_id, &handle->list);
return h;
@@ -431,7 +431,7 @@ static int bpkfs_probe(struct device_d *dev)
if (!type) {
type = "unknown";
- d->name = asprintf("%s_%08x", type, d->type);
+ d->name = basprintf("%s_%08x", type, d->type);
} else {
d->name = xstrdup(type);
}
@@ -464,7 +464,7 @@ static int bpkfs_probe(struct device_d *dev)
type = d->name;
d = xzalloc(sizeof(*d));
d->type = be32_to_cpu(data_header.type);
- d->name = asprintf("%s.crc", type);
+ d->name = basprintf("%s.crc", type);
d->type |= (1 << 31);
d->size = 8;
sprintf(d->data, "%08x", be32_to_cpu(data_header.crc));
diff --git a/fs/efi.c b/fs/efi.c
index 0f74cdafff..5ae796bdd9 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -530,8 +530,8 @@ int efi_fs_probe(struct efi_device *efidev)
if (efi_loaded_image && efidev->protocol == volume)
path = xstrdup("/boot");
else
- path = asprintf("/efi%d", index);
- device = asprintf("%s", dev_name(&efidev->dev));
+ path = basprintf("/efi%d", index);
+ device = basprintf("%s", dev_name(&efidev->dev));
ret = make_directory(path);
if (ret)
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index c7a282b05c..86cdcf0b59 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -154,7 +154,7 @@ static int efivars_create(struct device_d *dev, const char *pathname, mode_t mod
name8 = xstrdup_wchar_to_char(inode->name);
- inode->full_name = asprintf("%s-%pUl", name8, &inode->vendor);
+ inode->full_name = basprintf("%s-%pUl", name8, &inode->vendor);
free(name8);
efiret = RT->set_variable(inode->name, &inode->vendor,
@@ -405,7 +405,7 @@ static int efivarfs_probe(struct device_d *dev)
inode->vendor = vendor;
name8 = xstrdup_wchar_to_char(inode->name);
- inode->full_name = asprintf("%s-%pUl", name8, &vendor);
+ inode->full_name = basprintf("%s-%pUl", name8, &vendor);
free(name8);
list_add_tail(&inode->node, &priv->inodes);
diff --git a/fs/fs.c b/fs/fs.c
index d69e1e94cc..ad8d99b8d5 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1298,7 +1298,8 @@ int mount(const char *device, const char *fsname, const char *_path,
}
if (!fsdev->linux_rootarg && fsdev->cdev && fsdev->cdev->partuuid[0] != 0) {
- char *str = asprintf("root=PARTUUID=%s", fsdev->cdev->partuuid);
+ char *str = basprintf("root=PARTUUID=%s",
+ fsdev->cdev->partuuid);
fsdev_set_linux_rootarg(fsdev, str);
}
@@ -1717,10 +1718,10 @@ const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions)
if (path)
return path;
- newpath = asprintf("/mnt/%s", cdev->name);
+ newpath = basprintf("/mnt/%s", cdev->name);
make_directory(newpath);
- devpath = asprintf("/dev/%s", cdev->name);
+ devpath = basprintf("/dev/%s", cdev->name);
ret = mount(devpath, NULL, newpath, fsoptions);
diff --git a/fs/nfs.c b/fs/nfs.c
index 87828fce13..1e874d541e 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -1317,19 +1317,18 @@ static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev)
const char *ip;
ip = ip_to_string(npriv->server);
- str = asprintf("root=/dev/nfs nfsroot=%s:%s%s%s",
- ip, npriv->path, rootnfsopts[0] ? "," : "",
- rootnfsopts);
+ str = basprintf("root=/dev/nfs nfsroot=%s:%s%s%s", ip, npriv->path,
+ rootnfsopts[0] ? "," : "", rootnfsopts);
/* forward specific mount options on demand */
if (npriv->manual_nfs_port == 1) {
- tmp = asprintf("%s,port=%hu", str, npriv->nfs_port);
+ tmp = basprintf("%s,port=%hu", str, npriv->nfs_port);
free(str);
str = tmp;
}
if (npriv->manual_mount_port == 1) {
- tmp = asprintf("%s,mountport=%hu", str, npriv->mount_port);
+ tmp = basprintf("%s,mountport=%hu", str, npriv->mount_port);
free(str);
str = tmp;
}
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index f07ad5e7f9..8062baaa85 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -1269,8 +1269,8 @@ void ubifs_set_rootarg(struct ubifs_priv *priv, struct fs_device_d *fsdev)
mtd = di.mtd;
- str = asprintf("root=ubi0:%s ubi.mtd=%s rootfstype=ubifs",
- vi.name, mtd->cdev.partname);
+ str = basprintf("root=ubi0:%s ubi.mtd=%s rootfstype=ubifs",
+ vi.name, mtd->cdev.partname);
fsdev_set_linux_rootarg(fsdev, str);
diff --git a/fs/uimagefs.c b/fs/uimagefs.c
index c2e34a7f32..13c1fbac05 100644
--- a/fs/uimagefs.c
+++ b/fs/uimagefs.c
@@ -250,7 +250,7 @@ static int uimagefs_add_name(struct uimagefs_handle *priv)
static int uimagefs_add_hex(struct uimagefs_handle *priv, enum uimagefs_type type,
uint32_t data)
{
- char *val = asprintf("0x%x", data);
+ char *val = basprintf("0x%x", data);
return uimagefs_add_str(priv, type, val);
}
@@ -266,7 +266,7 @@ static int __uimagefs_add_data(struct uimagefs_handle *priv, size_t offset,
if (i < 0)
d->name = xstrdup(name);
else
- d->name = asprintf("%s%d", name, i);
+ d->name = basprintf("%s%d", name, i);
d->offset = offset;
d->size = size;
@@ -304,7 +304,7 @@ static int uimagefs_add_time(struct uimagefs_handle *priv)
char *val;
to_tm(header->ih_time, &tm);
- val = asprintf("%4d-%02d-%02d %2d:%02d:%02d UTC",
+ val = basprintf("%4d-%02d-%02d %2d:%02d:%02d UTC",
tm.tm_year, tm.tm_mon, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
@@ -515,8 +515,8 @@ static int uimagefs_probe(struct device_d *dev)
dev_dbg(dev, "mount: %s\n", fsdev->backingstore);
if (IS_BUILTIN(CONFIG_FS_TFTP))
- priv->tmp = asprintf("/.uImage_tmp_%08x",
- crc32(0, fsdev->path, strlen(fsdev->path)));
+ priv->tmp = basprintf("/.uImage_tmp_%08x",
+ crc32(0, fsdev->path, strlen(fsdev->path)));
ret = __uimage_open(priv);
if (ret)