summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
commite5a927883ea8f85e2258d5e15ac6ede8f44aeaab (patch)
tree1798a5dc8008c29d688093783e6bece1094cedbc /include
parent62b665b6442c493eb2537d1c5f6c8925a2ce73bf (diff)
parent42d3d24c7152462f7bb40056255ebcfffa8dbd9f (diff)
downloadbarebox-e5a927883ea8f85e2258d5e15ac6ede8f44aeaab.tar.gz
barebox-e5a927883ea8f85e2258d5e15ac6ede8f44aeaab.tar.xz
Merge branch 'for-next/link'
Diffstat (limited to 'include')
-rw-r--r--include/envfs.h15
-rw-r--r--include/fs.h12
-rw-r--r--include/libbb.h2
3 files changed, 26 insertions, 3 deletions
diff --git a/include/envfs.h b/include/envfs.h
index ba976d6d13..3d14fcb9ee 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -5,15 +5,19 @@
#include <asm/byteorder.h>
#endif
+#define ENVFS_MAJOR 1
+#define ENVFS_MINOR 0
+
#define ENVFS_MAGIC 0x798fba79 /* some random number */
#define ENVFS_INODE_MAGIC 0x67a8c78d
+#define ENVFS_INODE_END_MAGIC 0x68a8c78d
#define ENVFS_END_MAGIC 0x6a87d6cd
#define ENVFS_SIGNATURE "barebox envfs"
struct envfs_inode {
uint32_t magic; /* ENVFS_INODE_MAGIC */
uint32_t size; /* data size in bytes */
- uint32_t namelen; /* The length of the filename _including_ a trailing 0 */
+ uint32_t headerlen; /* The length of the filename _including_ a trailing 0 */
char data[0]; /* The filename (zero terminated) + padding to 4 byte boundary
* followed by the data for this inode.
* The next inode follows after the data + padding to 4 byte
@@ -21,6 +25,11 @@ struct envfs_inode {
*/
};
+struct envfs_inode_end {
+ uint32_t magic; /* ENVFS_INODE_END_MAGIC */
+ uint32_t mode; /* file mode */
+};
+
/*
* Superblock information at the beginning of the FS.
*/
@@ -29,8 +38,10 @@ struct envfs_super {
uint32_t priority;
uint32_t crc; /* crc for the data */
uint32_t size; /* size of data */
+ uint8_t major; /* major */
+ uint8_t minor; /* minor */
+ uint16_t future; /* reserved for future use */
uint32_t flags; /* feature flags */
- uint32_t future; /* reserved for future use */
uint32_t sb_crc; /* crc for the superblock */
};
diff --git a/include/fs.h b/include/fs.h
index 22470e6379..3d5714c1fb 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -51,6 +51,11 @@ struct fs_driver_d {
/* Truncate a file to given size */
int (*truncate)(struct device_d *dev, FILE *f, ulong size);
+ int (*symlink)(struct device_d *dev, const char *pathname,
+ const char *newpath);
+ int (*readlink)(struct device_d *dev, const char *pathname, char *name,
+ size_t size);
+
int (*open)(struct device_d *dev, FILE *f, const char *pathname);
int (*close)(struct device_d *dev, FILE *f);
int (*read)(struct device_d *dev, FILE *f, void *buf, size_t size);
@@ -106,6 +111,7 @@ int creat(const char *pathname, mode_t mode);
int unlink(const char *pathname);
int close(int fd);
int flush(int fd);
+int lstat(const char *filename, struct stat *s);
int stat(const char *filename, struct stat *s);
int read(int fd, void *buf, size_t count);
int ioctl(int fd, int request, void *buf);
@@ -129,6 +135,9 @@ DIR *opendir(const char *pathname);
struct dirent *readdir(DIR *dir);
int closedir(DIR *dir);
+int symlink(const char *pathname, const char *newpath);
+int readlink(const char *path, char *buf, size_t bufsiz);
+
int mount (const char *device, const char *fsname, const char *path);
int umount(const char *pathname);
@@ -162,6 +171,9 @@ void *read_file(const char *filename, size_t *size);
* of "..", "." and double slashes. The returned string must be freed wit free().
*/
char *normalise_path(const char *path);
+char *normalise_link(const char *pathname, const char* symlink);
+
+char *get_mounted_path(const char *path);
/* Register a new filesystem driver */
int register_fs_driver(struct fs_driver_d *fsdrv);
diff --git a/include/libbb.h b/include/libbb.h
index 110e8ec39d..47b2e08296 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -14,7 +14,7 @@ char* last_char_is(const char *s, int c);
enum {
ACTION_RECURSE = (1 << 0),
- /* ACTION_FOLLOWLINKS = (1 << 1), - unused */
+ ACTION_FOLLOWLINKS = (1 << 1),
ACTION_DEPTHFIRST = (1 << 2),
/*ACTION_REVERSE = (1 << 3), - unused */
};