summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 19:59:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:05 +0100
commit2ac0fe5c32ff8d0b01d05b3f9e7effde7ff88704 (patch)
tree5d94c6f1d66501f43edd055b7416d067d6a5240e
parent32ee1f61b692b94047c30da71dd9a292bbcb22a3 (diff)
downloadbarebox-2ac0fe5c32ff.tar.gz
barebox-2ac0fe5c32ff.tar.xz
fs: turn creat into static inline helper
creat is a oneliner that can be inlined at no extra cost, so move it into a header. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-28-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/fs.c6
-rw-r--r--include/fcntl.h6
2 files changed, 5 insertions, 7 deletions
diff --git a/fs/fs.c b/fs/fs.c
index bd2f0b6294..7c4e2f250e 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -349,12 +349,6 @@ static int create(struct dentry *dir, struct dentry *dentry)
return inode->i_op->create(inode, dentry, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO);
}
-int creat(const char *pathname, mode_t mode)
-{
- return open(pathname, O_CREAT | O_WRONLY | O_TRUNC);
-}
-EXPORT_SYMBOL(creat);
-
static int fsdev_truncate(struct device *dev, FILE *f, loff_t length)
{
struct fs_driver *fsdrv = f->fsdev->driver;
diff --git a/include/fcntl.h b/include/fcntl.h
index 1b4cd8ad37..06289abc43 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -29,6 +29,10 @@
#define O_RWSIZE_8 010000000
int open(const char *pathname, int flags, ...);
-int creat(const char *pathname, mode_t mode);
+
+static inline int creat(const char *pathname, mode_t mode)
+{
+ return open(pathname, O_CREAT | O_WRONLY | O_TRUNC);
+}
#endif /* __FCNTL_H */