summaryrefslogtreecommitdiffstats
path: root/fs/ramfs.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:40 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:40 +0200
commit17fda95040e20f1a263ef8278ccc48f6e631faed (patch)
tree6bced12abe1fcc56d07651183cbf4bf6718d579f /fs/ramfs.c
parent154e62e00f4854c05b814c44912f6a7950b18598 (diff)
downloadbarebox-17fda95040e20f1a263ef8278ccc48f6e631faed.tar.gz
barebox-17fda95040e20f1a263ef8278ccc48f6e631faed.tar.xz
svn_rev_286
Diffstat (limited to 'fs/ramfs.c')
-rw-r--r--fs/ramfs.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/fs/ramfs.c b/fs/ramfs.c
index bff9804878..797b1ae474 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -152,22 +152,6 @@ int ramfs_mkdir(struct device_d *dev, const char *pathname)
return ramfs_create(dev, pathname, S_IFDIR);
}
-int ramfs_probe(struct device_d *dev)
-{
- struct ramfs_priv *priv = malloc(sizeof(struct ramfs_priv));
-
- printf("ramfs_probe\n");
- memset(priv, 0, sizeof(struct ramfs_priv));
-
- dev->priv = priv;
-
- priv->root.name = "/";
- priv->root.mode = S_IFDIR;
-
- printf("root node: %p\n",&priv->root);
- return 0;
-}
-
static int ramfs_open(struct device_d *dev, FILE *file, const char *filename)
{
struct ramfs_priv *priv = dev->priv;
@@ -332,7 +316,7 @@ struct dir* ramfs_opendir(struct device_d *dev, const char *pathname)
struct dir *dir;
struct ramfs_priv *priv = dev->priv;
struct ramfs_inode *node = rlookup(&priv->root, pathname);
-printf("opendir: %s\n",pathname);
+
if (!node)
return NULL;
@@ -371,10 +355,8 @@ int ramfs_stat(struct device_d *dev, const char *filename, struct stat *s)
struct ramfs_priv *priv = dev->priv;
struct ramfs_inode *node = rlookup(&priv->root, filename);
- if (!node) {
- errno = -ENOENT;
+ if (!node)
return -ENOENT;
- }
s->st_size = node->size;
s->st_mode = node->mode;
@@ -382,6 +364,22 @@ int ramfs_stat(struct device_d *dev, const char *filename, struct stat *s)
return 0;
}
+int ramfs_probe(struct device_d *dev)
+{
+ struct ramfs_priv *priv = malloc(sizeof(struct ramfs_priv));
+
+ printf("ramfs_probe\n");
+ memset(priv, 0, sizeof(struct ramfs_priv));
+
+ dev->priv = priv;
+
+ priv->root.name = "/";
+ priv->root.mode = S_IFDIR;
+
+ printf("root node: %p\n",&priv->root);
+ return 0;
+}
+
static struct fs_driver_d ramfs_driver = {
.type = FS_TYPE_RAMFS,
.create = ramfs_create,