summaryrefslogtreecommitdiff
path: root/include/fs.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:38 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:38 +0200
commitcf7a56fc78a3304fd9ad4b22c6da30cc452a5b4b (patch)
treed74423adf47b86daea48bac089b9ecc32afe4d42 /include/fs.h
parent5c1f0869414930fdebc35755217ead72d39879ec (diff)
downloadbarebox-cf7a56fc78a3304fd9ad4b22c6da30cc452a5b4b.tar.gz
svn_rev_268
WIP
Diffstat (limited to 'include/fs.h')
-rw-r--r--include/fs.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/include/fs.h b/include/fs.h
index c600a9dd95..22e5fcf07e 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -10,10 +10,9 @@
struct partition;
struct node_d;
+struct stat;
struct dirent {
- unsigned long mode;
- unsigned long size;
char name[256];
};
@@ -25,20 +24,32 @@ struct dir {
void *priv; /* private data for the fs driver */
};
+typedef struct filep {
+ struct device_d *dev;
+ ulong pos;
+ char used;
+ int no;
+ void *inode; /* private to the filesystem driver */
+} FILE;
+
#define FS_DRIVER_NO_DEV 1
struct fs_driver_d {
ulong type;
char *name;
- int (*load) (char *dst, struct device_d *dev, const char *filename);
int (*probe) (struct device_d *dev);
int (*create)(struct device_d *dev, const char *pathname, ulong type);
int (*mkdir)(struct device_d *dev, const char *pathname);
- struct handle_d *(*open)(struct device_d *dev, const char *pathname);
+
+ 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);
+ int (*write)(struct device_d *dev, FILE *f, void *buf, size_t size);
struct dir* (*opendir)(struct device_d *dev, const char *pathname);
struct dirent* (*readdir)(struct device_d *dev, struct dir *dir);
int (*closedir)(struct device_d *dev, struct dir *dir);
+ int (*stat)(struct device_d *dev, const char *file, struct stat *stat);
struct driver_d drv;
@@ -52,11 +63,29 @@ struct fs_device_d {
struct fs_driver_d *driver;
};
-int register_filesystem(struct device_d *dev, char *fsname);
-//int unregister_filesystem(struct device_d *dev);
+int open(const char *pathname, int flags);
+int close(int fd);
+int read(int fd, void *buf, size_t count);
+ssize_t write(int fd, const void *buf, size_t count);
+int ls(const char *path);
+int mkdir (const char *pathname);
+int mount (struct device_d *dev, char *fsname, char *path);
+int umount(const char *pathname);
-int register_fs_driver(struct fs_driver_d *new_fs_drv);
+struct dir *opendir(const char *pathname);
+struct dirent *readdir(struct dir *dir);
+int closedir(struct dir *dir);
char *mkmodestr(unsigned long mode, char *str);
+struct mtab_entry *get_mtab_entry_by_path(const char *path);
+
+struct mtab_entry {
+ char path[PATH_MAX];
+ struct mtab_entry *next;
+ struct device_d *dev;
+};
+
+void normalise_path(char *path);
+
#endif /* __FS_H */