From 4f17444eccebeeadeaed212568a202ef97f4e71f Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 11 Apr 2016 11:06:07 +0200 Subject: libfile: move open_and_lseek() to libfile libfile is a collection of helpers for handling files. open_and_lseek() is a perfect match for this, so move it there. Signed-off-by: Sascha Hauer --- include/libfile.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/libfile.h') diff --git a/include/libfile.h b/include/libfile.h index d5b914a47a..51fa06008f 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -19,4 +19,6 @@ int copy_recursive(const char *src, const char *dst); int compare_file(const char *f1, const char *f2); +int open_and_lseek(const char *filename, int mode, loff_t pos); + #endif /* __LIBFILE_H */ -- cgit v1.2.3 From 69858c74b2de4c03c969712fc016a8ce8ac09a0a Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 11 Apr 2016 16:12:51 +0200 Subject: move make_directory declaration to libfile.h As a utility function for file handling make_directory() is well suited for libfile. Move it there. Signed-off-by: Sascha Hauer --- commands/automount.c | 1 + commands/mkdir.c | 1 + fs/efi.c | 1 + fs/fs.c | 1 + include/fs.h | 3 --- include/libfile.h | 3 +++ lib/make_directory.c | 1 + 7 files changed, 8 insertions(+), 3 deletions(-) (limited to 'include/libfile.h') diff --git a/commands/automount.c b/commands/automount.c index b491d203fd..a71430c9ef 100644 --- a/commands/automount.c +++ b/commands/automount.c @@ -20,6 +20,7 @@ #include #include #include +#include static int do_automount(int argc, char *argv[]) { diff --git a/commands/mkdir.c b/commands/mkdir.c index 1f978869ab..7d024c871d 100644 --- a/commands/mkdir.c +++ b/commands/mkdir.c @@ -22,6 +22,7 @@ #include #include #include +#include static int do_mkdir(int argc, char *argv[]) { diff --git a/fs/efi.c b/fs/efi.c index 5ae796bdd9..26f2f669bb 100644 --- a/fs/efi.c +++ b/fs/efi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/fs/fs.c b/fs/fs.c index ad8d99b8d5..1711a0c6aa 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -34,6 +34,7 @@ #include #include #include +#include char *mkmodestr(unsigned long mode, char *str) { diff --git a/include/fs.h b/include/fs.h index b9d1e6e09a..21490db7b9 100644 --- a/include/fs.h +++ b/include/fs.h @@ -126,9 +126,6 @@ ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset); loff_t lseek(int fildes, loff_t offset, int whence); int mkdir (const char *pathname, mode_t mode); - -/* Create a directory and its parents */ -int make_directory(const char *pathname); int rmdir (const char *pathname); const char *getcwd(void); diff --git a/include/libfile.h b/include/libfile.h index 51fa06008f..3f81718bbd 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -21,4 +21,7 @@ int compare_file(const char *f1, const char *f2); int open_and_lseek(const char *filename, int mode, loff_t pos); +/* Create a directory and its parents */ +int make_directory(const char *pathname); + #endif /* __LIBFILE_H */ diff --git a/lib/make_directory.c b/lib/make_directory.c index 7432efc192..29d08cf536 100644 --- a/lib/make_directory.c +++ b/lib/make_directory.c @@ -3,6 +3,7 @@ #include #ifdef __BAREBOX__ #include +#include #include #include #define STATIC -- cgit v1.2.3 From e1385b3399b606c2fe495f2e1967822af715edec Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 12 Apr 2016 11:20:31 +0200 Subject: move unlink_recursive declaration to libfile.h unlink_recursive is a file utility function, so move the prototype to libfile.h Signed-off-by: Sascha Hauer --- commands/loadenv.c | 1 + commands/rm.c | 1 + include/fs.h | 2 -- include/libfile.h | 2 ++ lib/unlink-recursive.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include/libfile.h') diff --git a/commands/loadenv.c b/commands/loadenv.c index 8d6be2fa83..44e96c3b60 100644 --- a/commands/loadenv.c +++ b/commands/loadenv.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/commands/rm.c b/commands/rm.c index 5f1f582f5e..4eebb3d159 100644 --- a/commands/rm.c +++ b/commands/rm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/include/fs.h b/include/fs.h index 21490db7b9..7081227780 100644 --- a/include/fs.h +++ b/include/fs.h @@ -179,8 +179,6 @@ void automount_remove(const char *_path); int automount_add(const char *path, const char *cmd); void automount_print(void); -int unlink_recursive(const char *path, char **failedpath); - int fsdev_open_cdev(struct fs_device_d *fsdev); const char *cdev_get_mount_path(struct cdev *cdev); const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions); diff --git a/include/libfile.h b/include/libfile.h index 3f81718bbd..de4f42dbd1 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -24,4 +24,6 @@ int open_and_lseek(const char *filename, int mode, loff_t pos); /* Create a directory and its parents */ int make_directory(const char *pathname); +int unlink_recursive(const char *path, char **failedpath); + #endif /* __LIBFILE_H */ diff --git a/lib/unlink-recursive.c b/lib/unlink-recursive.c index 78dc01593d..434fdc791b 100644 --- a/lib/unlink-recursive.c +++ b/lib/unlink-recursive.c @@ -1,4 +1,5 @@ #include +#include #include #include #include -- cgit v1.2.3