fs: fix wrong mode on files

This commit is contained in:
Matheus
2022-09-24 00:04:30 -03:00
parent 58453f4c60
commit 9c6d1157d7
3 changed files with 14 additions and 10 deletions
+6 -6
View File
@@ -87,12 +87,12 @@ static volatile void buildentry(tar_entry* entry, void* addr){
} }
entry->mode = convert(block->mode, 8); entry->mode = convert(block->mode, 7);
entry->uid = convert(block->uid, 8); entry->uid = convert(block->uid, 7);
entry->gid = convert(block->gid, 8); entry->gid = convert(block->gid, 7);
entry->size = convert(block->size, 11); entry->size = convert(block->size, 11);
entry->modtime = convert(block->modtime, 11); entry->modtime = convert(block->modtime, 11);
entry->checksum = convert(block->checksum, 8); entry->checksum = convert(block->checksum, 7);
entry->type = convert(block->type, 1); entry->type = convert(block->type, 1);
if(block->link[99]){ if(block->link[99]){
@@ -104,8 +104,8 @@ static volatile void buildentry(tar_entry* entry, void* addr){
memcpy(entry->indicator, block->indicator, 6); memcpy(entry->indicator, block->indicator, 6);
memcpy(entry->version, block->version, 2); memcpy(entry->version, block->version, 2);
entry->devmajor = convert(block->devmajor, 8); entry->devmajor = convert(block->devmajor, 7);
entry->devminor = convert(block->devminor, 8); entry->devminor = convert(block->devminor, 7);
+5 -1
View File
@@ -21,6 +21,7 @@ static int tmpfs_mount(dirnode_t* mountpoint, vnode_t* device, int mountflags, v
desc->calls = tmpfs_getfuncs(); desc->calls = tmpfs_getfuncs();
mountpoint->mount = root; mountpoint->mount = root;
root->vnode.st.st_mode = MAKETYPE(TYPE_DIR) | 0777;
return 0; return 0;
} }
@@ -84,7 +85,8 @@ static int tmpfs_mkdir(dirnode_t* parent, char* name, mode_t mode){
} }
stat* st = &node->vnode.st; stat* st = &node->vnode.st;
st->st_mode = MAKETYPE(TYPE_DIR) | GETMODE(mode);
st->st_mode = MAKETYPE(TYPE_DIR) | mode;
st->st_blksize = PAGE_SIZE; st->st_blksize = PAGE_SIZE;
return 0; return 0;
@@ -117,6 +119,8 @@ static int tmpfs_create(dirnode_t* parent, char* name, mode_t mode){
stat* st = &node->st; stat* st = &node->st;
st->st_blksize = PAGE_SIZE; st->st_blksize = PAGE_SIZE;
st->st_blocks = 1; st->st_blocks = 1;
st->st_mode = MAKETYPE(TYPE_REGULAR) | mode;
st->st_nlink = 1;
return 0; return 0;
+2 -2
View File
@@ -176,7 +176,7 @@ int vfs_create(dirnode_t* ref, char* path, mode_t mode){
spinlock_release(&lock); spinlock_release(&lock);
return EEXIST; return EEXIST;
} }
result = parent->vnode.fs->calls->create(parent, name, NULL); result = parent->vnode.fs->calls->create(parent, name, mode);
spinlock_release(&lock); spinlock_release(&lock);
@@ -205,7 +205,7 @@ int vfs_mkdir(dirnode_t* ref, char* path, mode_t mode){
return EEXIST; return EEXIST;
} }
result = parent->vnode.fs->calls->mkdir(parent, name, NULL); result = parent->vnode.fs->calls->mkdir(parent, name, mode);
spinlock_release(&lock); spinlock_release(&lock);