Finally fixed all warnings (we probably won't really need bootfs later anymore

for the standard boot process).
Removed the STREAM_TYPE_* definitions, it's now using the stat definitions
instead.
Cleaned the source a bit.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5188 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-10-28 13:46:48 +00:00
parent 9699c52992
commit 7530b569ec
+75 -175
View File
@@ -22,31 +22,25 @@
#define BOOTFS_TRACE 0 #define BOOTFS_TRACE 0
#if BOOTFS_TRACE #if BOOTFS_TRACE
#define TRACE(x) dprintf x # define TRACE(x) dprintf x
#else #else
#define TRACE(x) # define TRACE(x)
#endif #endif
static char *bootdir = NULL; static char *bootdir = NULL;
static off_t bootdir_len = 0; static off_t bootdir_len = 0;
static region_id bootdir_region = -1; static region_id bootdir_region = -1;
typedef enum {
STREAM_TYPE_FILE = S_IFREG,
STREAM_TYPE_DIR = S_IFDIR,
} stream_type;
struct bootfs_stream { struct bootfs_stream {
stream_type type; int type;
union { union {
struct stream_dir { struct stream_dir {
struct bootfs_vnode *dir_head; struct bootfs_vnode *dir_head;
struct bootfs_cookie *jar_head; struct bootfs_cookie *jar_head;
} dir; } dir;
struct stream_file { struct stream_file {
void *start; uint8 *start;
off_t len; off_t len;
} file; } file;
} u; } u;
@@ -142,7 +136,7 @@ bootfs_delete_vnode(struct bootfs *fs, struct bootfs_vnode *v, bool force_delete
// cant delete it if it's in a directory or is a directory // cant delete it if it's in a directory or is a directory
// and has children // and has children
if (!force_delete if (!force_delete
&& ((v->stream.type == STREAM_TYPE_DIR && v->stream.u.dir.dir_head != NULL) && ((v->stream.type == S_IFDIR && v->stream.u.dir.dir_head != NULL)
|| v->dir_next != NULL)) || v->dir_next != NULL))
return EPERM; return EPERM;
@@ -156,7 +150,7 @@ bootfs_delete_vnode(struct bootfs *fs, struct bootfs_vnode *v, bool force_delete
return 0; return 0;
} }
#if 0
static void static void
insert_cookie_in_jar(struct bootfs_vnode *dir, struct bootfs_cookie *cookie) insert_cookie_in_jar(struct bootfs_vnode *dir, struct bootfs_cookie *cookie)
{ {
@@ -193,6 +187,7 @@ update_dircookies(struct bootfs_vnode *dir, struct bootfs_vnode *v)
} }
} }
} }
#endif
static struct bootfs_vnode * static struct bootfs_vnode *
@@ -200,17 +195,17 @@ bootfs_find_in_dir(struct bootfs_vnode *dir, const char *path)
{ {
struct bootfs_vnode *v; struct bootfs_vnode *v;
if(dir->stream.type != STREAM_TYPE_DIR) if (dir->stream.type != S_IFDIR)
return NULL; return NULL;
if(!strcmp(path, ".")) if (!strcmp(path, "."))
return dir; return dir;
if(!strcmp(path, "..")) if (!strcmp(path, ".."))
return dir->parent; return dir->parent;
for(v = dir->stream.u.dir.dir_head; v; v = v->dir_next) { for (v = dir->stream.u.dir.dir_head; v; v = v->dir_next) {
// dprintf("bootfs_find_in_dir: looking at entry '%s'\n", v->name); // dprintf("bootfs_find_in_dir: looking at entry '%s'\n", v->name);
if(strcmp(v->name, path) == 0) { if (strcmp(v->name, path) == 0) {
// dprintf("bootfs_find_in_dir: found it at 0x%x\n", v); // dprintf("bootfs_find_in_dir: found it at 0x%x\n", v);
return v; return v;
} }
@@ -222,7 +217,7 @@ bootfs_find_in_dir(struct bootfs_vnode *dir, const char *path)
static status_t static status_t
bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v) bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v)
{ {
if(dir->stream.type != STREAM_TYPE_DIR) if (dir->stream.type != S_IFDIR)
return EINVAL; return EINVAL;
v->dir_next = dir->stream.u.dir.dir_head; v->dir_next = dir->stream.u.dir.dir_head;
@@ -232,7 +227,7 @@ bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v)
return 0; return 0;
} }
#if 0
static status_t static status_t
bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit) bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit)
{ {
@@ -256,15 +251,14 @@ bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit)
} }
/* XXX seems to be unused
static bool static bool
bootfs_is_dir_empty(struct bootfs_vnode *dir) bootfs_is_dir_empty(struct bootfs_vnode *dir)
{ {
if(dir->stream.type != STREAM_TYPE_DIR) if(dir->stream.type != S_IFDIR)
return false; return false;
return !dir->stream.u.dir.dir_head; return !dir->stream.u.dir.dir_head;
} }
*/ #endif
/** Creates a path of vnodes up to the last part of the passed in path. /** Creates a path of vnodes up to the last part of the passed in path.
@@ -281,12 +275,12 @@ bootfs_create_path(struct bootfs *fs, char *path, struct bootfs_vnode *base, cha
bool done; bool done;
// strip off any leading '/' or spaces // strip off any leading '/' or spaces
for(; *path == '/' || *path == ' '; path++) for (; *path == '/' || *path == ' '; path++)
; ;
// first, find the leaf // first, find the leaf
*path_leaf = strrchr(path, '/'); *path_leaf = strrchr(path, '/');
if(*path_leaf == NULL) { if (*path_leaf == NULL) {
// didn't find it, so this path only is a leaf // didn't find it, so this path only is a leaf
*path_leaf = path; *path_leaf = path;
return base; return base;
@@ -295,34 +289,34 @@ bootfs_create_path(struct bootfs *fs, char *path, struct bootfs_vnode *base, cha
// this is a multipart path, seperate the leaf off // this is a multipart path, seperate the leaf off
**path_leaf = '\0'; **path_leaf = '\0';
(*path_leaf)++; (*path_leaf)++;
if(**path_leaf == '\0') { if (**path_leaf == '\0') {
// the path ended with '/'. That's invalid // the path ended with '/'. That's invalid
return NULL; return NULL;
} }
// now, lets walk down the path, building vnodes as we need em // now, lets walk down the path, building vnodes as we need em
done = false; done = false;
for(; !done; path = temp+1) { for (; !done; path = temp+1) {
// find the next seperator and knock it out // find the next seperator and knock it out
temp = strchr(path, '/'); temp = strchr(path, '/');
if(temp) { if (temp) {
*temp = '\0'; *temp = '\0';
} else { } else {
done = true; done = true;
} }
if(*path == '\0') { if (*path == '\0') {
// zero length path segment, continue // zero length path segment, continue
continue; continue;
} }
v = bootfs_find_in_dir(base, path); v = bootfs_find_in_dir(base, path);
if(!v) { if (!v) {
v = bootfs_create_vnode(fs, path); v = bootfs_create_vnode(fs, path);
if(!v) if (!v)
return NULL; return NULL;
v->stream.type = STREAM_TYPE_DIR; v->stream.type = S_IFDIR;
v->stream.u.dir.dir_head = NULL; v->stream.u.dir.dir_head = NULL;
v->stream.u.dir.jar_head = NULL; v->stream.u.dir.jar_head = NULL;
@@ -330,7 +324,7 @@ bootfs_create_path(struct bootfs *fs, char *path, struct bootfs_vnode *base, cha
hash_insert(fs->vnode_list_hash, v); hash_insert(fs->vnode_list_hash, v);
} else { } else {
// we found one // we found one
if(v->stream.type != STREAM_TYPE_DIR) if (v->stream.type != S_IFDIR)
return NULL; return NULL;
} }
base = v; base = v;
@@ -344,7 +338,6 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
{ {
int i; int i;
boot_entry *entry; boot_entry *entry;
int err;
struct bootfs_vnode *new_vnode; struct bootfs_vnode *new_vnode;
struct bootfs_vnode *dir; struct bootfs_vnode *dir;
char path[SYS_MAX_PATH_LEN]; char path[SYS_MAX_PATH_LEN];
@@ -352,21 +345,20 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
entry = (boot_entry *)bootdir; entry = (boot_entry *)bootdir;
for (i = 0; i < BOOTDIR_MAX_ENTRIES; i++) { for (i = 0; i < BOOTDIR_MAX_ENTRIES; i++) {
if(entry[i].be_type != BE_TYPE_NONE && entry[i].be_type != BE_TYPE_DIRECTORY) { if (entry[i].be_type != BE_TYPE_NONE && entry[i].be_type != BE_TYPE_DIRECTORY) {
strncpy(path, entry[i].be_name, SYS_MAX_PATH_LEN-1); strlcpy(path, entry[i].be_name, SYS_MAX_PATH_LEN);
path[SYS_MAX_PATH_LEN-1] = '\0';
dir = bootfs_create_path(fs, path, root, &leaf); dir = bootfs_create_path(fs, path, root, &leaf);
if(!dir) if (!dir)
continue; continue;
new_vnode = bootfs_create_vnode(fs, leaf); new_vnode = bootfs_create_vnode(fs, leaf);
if(new_vnode == NULL) if (new_vnode == NULL)
return ENOMEM; return ENOMEM;
// set up the new node // set up the new node
new_vnode->stream.type = STREAM_TYPE_FILE; new_vnode->stream.type = S_IFREG;
new_vnode->stream.u.file.start = bootdir + entry[i].be_offset * PAGE_SIZE; new_vnode->stream.u.file.start = bootdir + entry[i].be_offset * B_PAGE_SIZE;
new_vnode->stream.u.file.len = entry[i].be_vsize; new_vnode->stream.u.file.len = entry[i].be_vsize;
dprintf("bootfs_create_vnode_tree: added entry '%s', start %p, len 0x%Lx\n", new_vnode->name, dprintf("bootfs_create_vnode_tree: added entry '%s', start %p, len 0x%Lx\n", new_vnode->name,
@@ -396,29 +388,26 @@ bootfs_mount(mount_id id, const char *device, void *args, fs_volume *_fs, vnode_
TRACE(("bootfs_mount: entry\n")); TRACE(("bootfs_mount: entry\n"));
fs = malloc(sizeof(struct bootfs)); fs = malloc(sizeof(struct bootfs));
if(fs == NULL) { if (fs == NULL)
err = ENOMEM; return B_NO_MEMORY;
goto err;
}
fs->id = id; fs->id = id;
fs->next_vnode_id = 0; fs->next_vnode_id = 0;
err = mutex_init(&fs->lock, "bootfs_mutex"); err = mutex_init(&fs->lock, "bootfs_mutex");
if(err < 0) { if (err < 0)
goto err1; goto err1;
}
fs->vnode_list_hash = hash_init(BOOTFS_HASH_SIZE, (addr)&v->all_next - (addr)v, fs->vnode_list_hash = hash_init(BOOTFS_HASH_SIZE, (addr)&v->all_next - (addr)v,
&bootfs_vnode_compare_func, &bootfs_vnode_hash_func); &bootfs_vnode_compare_func, &bootfs_vnode_hash_func);
if(fs->vnode_list_hash == NULL) { if (fs->vnode_list_hash == NULL) {
err = ENOMEM; err = ENOMEM;
goto err2; goto err2;
} }
// create a vnode // create a vnode
v = bootfs_create_vnode(fs, ""); v = bootfs_create_vnode(fs, "");
if(v == NULL) { if (v == NULL) {
err = ENOMEM; err = ENOMEM;
goto err3; goto err3;
} }
@@ -427,16 +416,15 @@ bootfs_mount(mount_id id, const char *device, void *args, fs_volume *_fs, vnode_
v->parent = v; v->parent = v;
// create a dir stream for it to hold // create a dir stream for it to hold
v->stream.type = STREAM_TYPE_DIR; v->stream.type = S_IFDIR;
v->stream.u.dir.dir_head = NULL; v->stream.u.dir.dir_head = NULL;
fs->root_vnode = v; fs->root_vnode = v;
hash_insert(fs->vnode_list_hash, v); hash_insert(fs->vnode_list_hash, v);
err = bootfs_create_vnode_tree(fs, fs->root_vnode); err = bootfs_create_vnode_tree(fs, fs->root_vnode);
if(err < 0) { if (err < 0)
goto err4; goto err4;
}
*root_vnid = v->id; *root_vnid = v->id;
*_fs = fs; *_fs = fs;
@@ -451,7 +439,7 @@ err2:
mutex_destroy(&fs->lock); mutex_destroy(&fs->lock);
err1: err1:
free(fs); free(fs);
err:
return err; return err;
} }
@@ -499,7 +487,7 @@ bootfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int
TRACE(("bootfs_lookup: entry dir %p, name '%s'\n", dir, name)); TRACE(("bootfs_lookup: entry dir %p, name '%s'\n", dir, name));
if (dir->stream.type != STREAM_TYPE_DIR) if (dir->stream.type != S_IFDIR)
return B_NOT_A_DIRECTORY; return B_NOT_A_DIRECTORY;
mutex_lock(&fs->lock); mutex_lock(&fs->lock);
@@ -564,9 +552,7 @@ bootfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *v, bool r)
static status_t static status_t
bootfs_put_vnode(fs_volume _fs, fs_vnode _v, bool r) bootfs_put_vnode(fs_volume _fs, fs_vnode _v, bool r)
{ {
struct bootfs_vnode *v = (struct bootfs_vnode *)_v; TRACE(("bootfs_put_vnode: entry on vnode 0x%Lx r %d\n", ((struct bootfs_vnode *)_v)->id, r));
TRACE(("bootfs_put_vnode: entry on vnode 0x%Lx r %d\n", v->id, r));
return 0; // whatever return 0; // whatever
} }
@@ -577,8 +563,6 @@ bootfs_remove_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
{ {
struct bootfs *fs = (struct bootfs *)_fs; struct bootfs *fs = (struct bootfs *)_fs;
struct bootfs_vnode *v = (struct bootfs_vnode *)_v; struct bootfs_vnode *v = (struct bootfs_vnode *)_v;
struct bootfs_vnode dummy;
status_t err;
TRACE(("bootfs_remove_vnode: remove %p (0x%Lx) r %d\n", v, v->id, reenter)); TRACE(("bootfs_remove_vnode: remove %p (0x%Lx) r %d\n", v, v->id, reenter));
@@ -592,13 +576,10 @@ bootfs_remove_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
bootfs_delete_vnode(fs, v, false); bootfs_delete_vnode(fs, v, false);
err = 0;
err:
if (!reenter) if (!reenter)
mutex_unlock(&fs->lock); mutex_unlock(&fs->lock);
return err; return B_OK;
} }
@@ -637,79 +618,71 @@ bootfs_open(fs_volume _fs, fs_vnode _v, int oflags, fs_cookie *_cookie)
static status_t static status_t
bootfs_close(fs_volume _fs, fs_vnode _v, fs_cookie _cookie) bootfs_close(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct bootfs *fs = _fs; TRACE(("bootfs_close: entry vnode %p, cookie %p\n", _v, _cookie));
struct bootfs_vnode *v = _v;
struct bootfs_cookie *cookie = _cookie;
TRACE(("bootfs_close: entry vnode %p, cookie %p\n", v, cookie)); return B_OK;
return 0;
} }
static status_t static status_t
bootfs_free_cookie(fs_volume _fs, fs_vnode _v, fs_cookie _cookie) bootfs_free_cookie(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v;
struct bootfs_cookie *cookie = _cookie; struct bootfs_cookie *cookie = _cookie;
TRACE(("bootfs_freecookie: entry vnode %p, cookie %p\n", v, cookie)); TRACE(("bootfs_freecookie: entry vnode %p, cookie %p\n", _v, cookie));
if (cookie) free(cookie);
free(cookie); return B_OK;
return 0;
} }
static status_t static status_t
bootfs_fsync(fs_volume _fs, fs_vnode _v) bootfs_fsync(fs_volume _fs, fs_vnode _v)
{ {
return 0; return B_OK;
} }
static ssize_t static ssize_t
bootfs_read(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, void *buf, size_t *len) bootfs_read(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, void *buffer, size_t *_length)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v;
struct bootfs_cookie *cookie = _cookie; struct bootfs_cookie *cookie = _cookie;
ssize_t err = 0; ssize_t err = 0;
TRACE(("bootfs_read: vnode %p, cookie %p, pos 0x%Lx, len 0x%lx\n", v, cookie, pos, *len)); TRACE(("bootfs_read: vnode %p, cookie %p, pos 0x%Lx, len 0x%lx\n", _v, cookie, pos, *_length));
mutex_lock(&fs->lock); mutex_lock(&fs->lock);
switch(cookie->s->type) { switch (cookie->s->type) {
case STREAM_TYPE_FILE: case S_IFREG:
if(*len <= 0) { if (*_length <= 0) {
err = 0; err = 0;
break; break;
} }
if(pos < 0) { if (pos < 0) {
// we'll read where the cookie is at // we'll read where the cookie is at
pos = cookie->u.file.pos; pos = cookie->u.file.pos;
} }
if(pos >= cookie->s->u.file.len) { if (pos >= cookie->s->u.file.len) {
*len = 0; *_length = 0;
err = ESPIPE; err = ESPIPE;
break; break;
} }
if(pos + *len > cookie->s->u.file.len) { if (pos + *_length > cookie->s->u.file.len) {
// trim the read // trim the read
*len = cookie->s->u.file.len - pos; *_length = cookie->s->u.file.len - pos;
} }
err = user_memcpy(buf, cookie->s->u.file.start + pos, *len); err = user_memcpy(buffer, cookie->s->u.file.start + pos, *_length);
if(err < 0) { if (err < 0)
goto err; goto err;
}
cookie->u.file.pos = pos + *len; cookie->u.file.pos = pos + *_length;
err = 0; err = 0;
break; break;
default: default:
*len = 0; *_length = 0;
err = EINVAL; err = EINVAL;
} }
err: err:
@@ -728,60 +701,6 @@ bootfs_write(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *
} }
static off_t
bootfs_seek(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, int seekType)
{
struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v;
struct bootfs_cookie *cookie = _cookie;
status_t err = B_OK;
TRACE(("bootfs_seek: vnode %p, cookie %p, pos 0x%Lx , seek_type %d\n", v, cookie, pos, seekType));
if (cookie->s->type != STREAM_TYPE_FILE)
return EINVAL;
mutex_lock(&fs->lock);
switch (seekType) {
case SEEK_SET:
if (pos < 0)
pos = 0;
if (pos > cookie->s->u.file.len)
pos = cookie->s->u.file.len;
cookie->u.file.pos = pos;
break;
case SEEK_CUR:
if (pos + cookie->u.file.pos > cookie->s->u.file.len)
pos = cookie->s->u.file.len;
else if (pos + cookie->u.file.pos < 0)
pos = 0;
else
pos += cookie->u.file.pos;
break;
case SEEK_END:
if (pos > 0)
pos = cookie->s->u.file.len;
else if (pos + cookie->s->u.file.len < 0)
pos = 0;
else
pos += cookie->s->u.file.len;
break;
default:
err = EINVAL;
}
if (err == B_OK)
cookie->u.file.pos = pos;
mutex_unlock(&fs->lock);
if (err < B_OK)
return err;
return pos;
}
static status_t static status_t
bootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) bootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
@@ -799,7 +718,7 @@ bootfs_open_dir(fs_volume _fs, fs_vnode _v, fs_cookie *_cookie)
TRACE(("bootfs_open_dir: vnode %p\n", vnode)); TRACE(("bootfs_open_dir: vnode %p\n", vnode));
if (vnode->stream.type != STREAM_TYPE_DIR) if (vnode->stream.type != S_IFDIR)
return EINVAL; return EINVAL;
cookie = malloc(sizeof(struct bootfs_cookie)); cookie = malloc(sizeof(struct bootfs_cookie));
@@ -887,7 +806,7 @@ bootfs_can_page(fs_volume _fs, fs_vnode _v)
TRACE(("bootfs_canpage: vnode %p\n", v)); TRACE(("bootfs_canpage: vnode %p\n", v));
if (v->stream.type == STREAM_TYPE_FILE) if (v->stream.type == S_IFREG)
return 1; return 1;
else else
return 0; return 0;
@@ -897,11 +816,10 @@ bootfs_can_page(fs_volume _fs, fs_vnode _v)
static ssize_t static ssize_t
bootfs_read_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos) bootfs_read_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
unsigned int i; unsigned int i;
TRACE(("bootfs_readpage: fs_cookie %p vnode %p, vecs %p, pos 0x%Ld\n",fs, v, vecs, pos)); TRACE(("bootfs_readpage: fs_cookie %p vnode %p, vecs %p, pos 0x%Ld\n", _fs, v, vecs, pos));
for (i = 0; i < vecs->num; i++) { for (i = 0; i < vecs->num; i++) {
if (pos >= v->stream.u.file.len) { if (pos >= v->stream.u.file.len) {
@@ -928,10 +846,7 @@ bootfs_read_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
static ssize_t static ssize_t
bootfs_write_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos) bootfs_write_pages(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct bootfs *fs = _fs; TRACE(("bootfs_writepage: fs_cookie %p vnode %p, vecs %p, pos %Ld \n", _fs, _v, vecs, pos));
struct bootfs_vnode *v = _v;
TRACE(("bootfs_writepage: fs_cookie %p vnode %p, vecs %p, pos %Ld \n", fs, v, vecs, pos));
return EPERM; return EPERM;
} }
@@ -966,24 +881,14 @@ bootfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
/** XXX - no pretense at access control, just tell people /** XXX - no pretense at access control, just tell people
* they can read it :) * they can read it :)
*/ */
stat->st_mode = (S_IRUSR | S_IRGRP | S_IROTH);
stat->st_size = 0;
stat->st_ino = v->id; stat->st_ino = v->id;
stat->st_mode = v->stream.type | S_IRUSR | S_IRGRP | S_IROTH;
switch(v->stream.type) { if (v->stream.type == S_IFREG)
case STREAM_TYPE_DIR: stat->st_size = v->stream.u.file.len;
stat->st_mode |= S_IFDIR; else
break; stat->st_size = 0;
case STREAM_TYPE_FILE:
stat->st_size = v->stream.u.file.len;
stat->st_mode |= S_IFREG;
break;
default:
err = EINVAL;
break;
}
err:
mutex_unlock(&fs->lock); mutex_unlock(&fs->lock);
return err; return err;
@@ -991,13 +896,8 @@ err:
static status_t static status_t
bootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_mask) bootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int statMask)
{ {
struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v;
TRACE(("bootfs_wstat: fs_cookie %p, vnode %p, v->id 0x%Lx, stat 0x%p, stat_mask 0x%x\n", fs, v, v->id, stat, stat_mask));
// cannot change anything // cannot change anything
return EROFS; return EROFS;
} }