summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:52 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:52 +0200
commite694adc6a4716fc589693eb8eb8e67bbf54e8edc (patch)
treef8af4d37d05c8f628ecc3abbe8c8d48a43794482 /fs
parent2692aaeb76f66cc8fe2f1196697d9a75b06c4522 (diff)
downloadbarebox-e694adc6a4716fc589693eb8eb8e67bbf54e8edc.tar.gz
barebox-e694adc6a4716fc589693eb8eb8e67bbf54e8edc.tar.xz
svn_rev_420
- do more POSIX: - use DIR instead of struct dirent - use (struct dirent)->d_name instead of (struct dirent)->name - switch to a new layout for U_BOOT_CMD: - use C99 initializers to be able to add more fields to the command struct - add aliases for commands (needed mainly for help -> ? and test -> [ - This is not done for all commands yet, but the compiler will tell you ;)
Diffstat (limited to 'fs')
-rw-r--r--fs/cramfs/cramfs.c12
-rw-r--r--fs/devfs.c12
-rw-r--r--fs/fs.c12
-rw-r--r--fs/ramfs.c12
4 files changed, 24 insertions, 24 deletions
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index b66c700bda..b37dd9842b 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -183,7 +183,7 @@ static int cramfs_fill_dirent (struct device_d *dev, unsigned long offset, struc
if (!inode)
return -EINVAL;
- memset(d->name, 0, 256);
+ memset(d->d_name, 0, 256);
/*
* Namelengths on disk are shifted by two
@@ -192,7 +192,7 @@ static int cramfs_fill_dirent (struct device_d *dev, unsigned long offset, struc
*/
namelen = CRAMFS_GET_NAMELEN (inode) << 2;
- dev_read(dev, d->name, namelen, offset + sizeof(struct cramfs_inode), 0);
+ dev_read(dev, d->d_name, namelen, offset + sizeof(struct cramfs_inode), 0);
free(inode);
return namelen;
}
@@ -200,10 +200,10 @@ static int cramfs_fill_dirent (struct device_d *dev, unsigned long offset, struc
struct cramfs_dir {
unsigned long offset, size;
unsigned long inodeoffset;
- struct dir dir;
+ DIR dir;
};
-struct dir* cramfs_opendir(struct device_d *_dev, const char *filename)
+DIR* cramfs_opendir(struct device_d *_dev, const char *filename)
{
char *f;
struct cramfs_priv *priv = _dev->priv;
@@ -249,7 +249,7 @@ err_free:
return NULL;
}
-static struct dirent* cramfs_readdir(struct device_d *_dev, struct dir *_dir)
+static struct dirent* cramfs_readdir(struct device_d *_dev, DIR *_dir)
{
struct fs_device_d *fsdev = _dev->type_data;
struct device_d *dev = fsdev->parent;
@@ -266,7 +266,7 @@ static struct dirent* cramfs_readdir(struct device_d *_dev, struct dir *_dir)
return NULL;
}
-static int cramfs_closedir(struct device_d *dev, struct dir *_dir)
+static int cramfs_closedir(struct device_d *dev, DIR *_dir)
{
struct cramfs_dir *dir = _dir->priv;
free(dir);
diff --git a/fs/devfs.c b/fs/devfs.c
index 3716aaeb2d..6510664140 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -36,11 +36,11 @@ static int devfs_close(struct device_d *dev, FILE *f)
return 0;
}
-struct dir* devfs_opendir(struct device_d *dev, const char *pathname)
+DIR* devfs_opendir(struct device_d *dev, const char *pathname)
{
- struct dir *dir;
+ DIR *dir;
- dir = malloc(sizeof(struct dir));
+ dir = malloc(sizeof(DIR));
if (!dir)
return NULL;
@@ -49,7 +49,7 @@ struct dir* devfs_opendir(struct device_d *dev, const char *pathname)
return dir;
}
-struct dirent* devfs_readdir(struct device_d *_dev, struct dir *dir)
+struct dirent* devfs_readdir(struct device_d *_dev, DIR *dir)
{
struct device_d *dev = dir->priv;
@@ -57,14 +57,14 @@ struct dirent* devfs_readdir(struct device_d *_dev, struct dir *dir)
dev = dev->next;
if (dev) {
- strcpy(dir->d.name, dev->id);
+ strcpy(dir->d.d_name, dev->id);
dir->priv = dev->next;
return &dir->d;
}
return NULL;
}
-int devfs_closedir(struct device_d *dev, struct dir *dir)
+int devfs_closedir(struct device_d *dev, DIR *dir)
{
free(dir);
return 0;
diff --git a/fs/fs.c b/fs/fs.c
index 0dd2f07491..1d56c863f6 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -188,7 +188,7 @@ static struct device_d *get_device_by_path(char **path)
int dir_is_empty(const char *pathname)
{
- struct dir *dir;
+ DIR *dir;
struct dirent *d;
int ret = 1;
@@ -199,7 +199,7 @@ int dir_is_empty(const char *pathname)
}
while ((d = readdir(dir))) {
- if (!strcmp(d->name, ".") || !strcmp(d->name, ".."))
+ if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
continue;
ret = 0;
break;
@@ -575,9 +575,9 @@ int umount(const char *pathname)
return 0;
}
-struct dir *opendir(const char *pathname)
+DIR *opendir(const char *pathname)
{
- struct dir *dir = NULL;
+ DIR *dir = NULL;
struct device_d *dev;
struct fs_driver_d *fsdrv;
char *p = normalise_path(pathname);
@@ -604,12 +604,12 @@ out:
return dir;
}
-struct dirent *readdir(struct dir *dir)
+struct dirent *readdir(DIR *dir)
{
return dir->fsdrv->readdir(dir->dev, dir);
}
-int closedir(struct dir *dir)
+int closedir(DIR *dir)
{
return dir->fsdrv->closedir(dir->dev, dir);
}
diff --git a/fs/ramfs.c b/fs/ramfs.c
index 5047d7c399..d0b60bd20e 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -426,9 +426,9 @@ int ramfs_truncate(struct device_d *dev, FILE *f, ulong size)
return 0;
}
-struct dir* ramfs_opendir(struct device_d *dev, const char *pathname)
+DIR* ramfs_opendir(struct device_d *dev, const char *pathname)
{
- struct dir *dir;
+ DIR *dir;
struct ramfs_priv *priv = dev->priv;
struct ramfs_inode *node;
// printf("opendir: %s\n", pathname);
@@ -441,26 +441,26 @@ struct dir* ramfs_opendir(struct device_d *dev, const char *pathname)
if (node->mode != S_IFDIR)
return NULL;
- dir = xmalloc(sizeof(struct dir));
+ dir = xmalloc(sizeof(DIR));
dir->priv = node->child;
return dir;
}
-struct dirent* ramfs_readdir(struct device_d *dev, struct dir *dir)
+struct dirent* ramfs_readdir(struct device_d *dev, DIR *dir)
{
struct ramfs_inode *node = dir->priv;
if (node) {
- strcpy(dir->d.name, node->name);
+ strcpy(dir->d.d_name, node->name);
dir->priv = node->next;
return &dir->d;
}
return NULL;
}
-int ramfs_closedir(struct device_d *dev, struct dir *dir)
+int ramfs_closedir(struct device_d *dev, DIR *dir)
{
free(dir);
return 0;