summaryrefslogtreecommitdiffstats
path: root/include/fs.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:02:12 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:02:12 +0200
commita46f705cd96a97012bc2eaaa15ef68360e9fce08 (patch)
treeed29fb3f0fbe76096cba623fc2b3cb7e20eaafad /include/fs.h
parent3fd64b7c4532bd4efe240539783d75682252fa2d (diff)
downloadbarebox-a46f705cd96a97012bc2eaaa15ef68360e9fce08.tar.gz
barebox-a46f705cd96a97012bc2eaaa15ef68360e9fce08.tar.xz
svn_rev_634
add comments
Diffstat (limited to 'include/fs.h')
-rw-r--r--include/fs.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/include/fs.h b/include/fs.h
index a16702136f..f0d63bfd6e 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -79,13 +79,15 @@ struct fs_device_d {
struct fs_driver_d *driver;
};
+/*
+ * standard posix file functions
+ */
int open(const char *pathname, int flags);
int creat(const char *pathname, mode_t mode);
int unlink(const char *pathname);
int close(int fd);
int stat(const char *filename, struct stat *s);
int read(int fd, void *buf, size_t count);
-int erase(int fd, size_t count, unsigned long offset);
ssize_t write(int fd, const void *buf, size_t count);
#define SEEK_SET 1
@@ -93,11 +95,8 @@ ssize_t write(int fd, const void *buf, size_t count);
#define SEEK_END 3
off_t lseek(int fildes, off_t offset, int whence);
-int ls(const char *path, ulong flags);
int mkdir (const char *pathname);
int rmdir (const char *pathname);
-int mount (const char *device, const char *fsname, const char *path);
-int umount(const char *pathname);
const char *getcwd(void);
int chdir(const char *pathname);
@@ -106,8 +105,23 @@ DIR *opendir(const char *pathname);
struct dirent *readdir(DIR *dir);
int closedir(DIR *dir);
+int mount (const char *device, const char *fsname, const char *path);
+int umount(const char *pathname);
+
+/* not-so-standard erase */
+int erase(int fd, size_t count, unsigned long offset);
+
+#define LS_RECURSIVE 1
+#define LS_SHOWARG 2
+int ls(const char *path, ulong flags);
+
char *mkmodestr(unsigned long mode, char *str);
+/*
+ * Information about mounted devices.
+ * Note that we only support mounting on directories lying
+ * directly in / and of course the root directory itself
+ */
struct mtab_entry *get_mtab_entry_by_path(const char *path);
struct mtab_entry *mtab_next_entry(struct mtab_entry *entry);
@@ -118,7 +132,18 @@ struct mtab_entry {
struct device_d *parent_device;
};
+/*
+ * Read a file into memory. Memory is allocated with malloc and must
+ * be freed with free() afterwards. This function allocates one
+ * byte more than actually needed and sets this to zero, so that
+ * it cn be used for text files.
+ */
void *read_file(const char *filename);
+
+/*
+ * This function turn 'path' into an absolute path and removes all occurrences
+ * of "..", "." and double slashes. The returned string must be freed wit free().
+ */
char *normalise_path(const char *path);
#endif /* __FS_H */