diff --git a/.cproject b/.cproject
index 04b8d6f..eb7a219 100644
--- a/.cproject
+++ b/.cproject
@@ -48,19 +48,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -73,8 +129,8 @@
-
-
-
+
+
+
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index bfaac99..565f8ef 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
index dd1904e..98acb33 100644
--- a/.settings/org.eclipse.cdt.core.prefs
+++ b/.settings/org.eclipse.cdt.core.prefs
@@ -1,4 +1,12 @@
eclipse.preferences.version=1
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/CWD/delimiter=;
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/CWD/operation=replace
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/CWD/value=D\:\\git\\UbixOS\\
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/PWD/delimiter=;
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/PWD/operation=replace
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/PWD/value=D\:\\git\\UbixOS\\
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/append=true
+environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978.772191050/appendContributed=false
environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978/CWD/delimiter=;
environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978/CWD/operation=replace
environment/project/cdt.managedbuild.toolchain.gnu.base.1467187978/CWD/value=D\:\\git\\UbixOS\\
diff --git a/sys/fs/vfs/inode.c b/sys/fs/vfs/inode.c
index c1ef2ce..0cbf5b4 100644
--- a/sys/fs/vfs/inode.c
+++ b/sys/fs/vfs/inode.c
@@ -18,9 +18,10 @@
void iput(struct inode * inode) {
if (!inode)
return;
+
wait_on_inode(inode);
-#ifdef _BALLS
+#ifdef _IGNORE
if (!inode->i_count) {
printk("VFS: iput: trying to free free inode\n");
printk("VFS: device %d/%d, inode %lu, mode=0%07o\n", MAJOR(inode->i_rdev), MINOR(inode->i_rdev), inode->i_ino, inode->i_mode);
@@ -30,26 +31,34 @@
if (inode->i_pipe)
wake_up_interruptible(&PIPE_WAIT(*inode));
- repeat: if (inode->i_count > 1) {
+
+ repeat:
+
+ if (inode->i_count > 1) {
inode->i_count--;
return;
}
+
wake_up(&inode_wait);
+
if (inode->i_pipe) {
unsigned long page = (unsigned long) PIPE_BASE(*inode);
PIPE_BASE (*inode) = NULL;
vmm_freeVirtualPage(page);
}
+
if (inode->i_sb && inode->i_sb->s_op && inode->i_sb->s_op->put_inode) {
inode->i_sb->s_op->put_inode(inode);
if (!inode->i_nlink)
return;
}
+
if (inode->i_dirt) {
write_inode(inode); /* we can sleep - so do again */
wait_on_inode(inode);
goto repeat;
}
+
inode->i_count--;
nr_free_inodes++;
return;
@@ -59,28 +68,40 @@
struct wait_queue wait = { _current, NULL };
add_wait_queue(&inode->i_wait, &wait);
- repeat: _current->state = UNINTERRUPTIBLE;
+
+ repeat:
+
+ _current->state = UNINTERRUPTIBLE;
+
if (inode->i_lock) {
sched_yield();
//schedule();
goto repeat;
}
+
remove_wait_queue(&inode->i_wait, &wait);
+
_current->state = RUNNING;
+
}
static void write_inode(struct inode * inode) {
if (!inode->i_dirt)
return;
+
wait_on_inode(inode);
+
if (!inode->i_dirt)
return;
+
if (!inode->i_sb || !inode->i_sb->s_op || !inode->i_sb->s_op->write_inode) {
inode->i_dirt = 0;
return;
}
+
inode->i_lock = 1;
inode->i_sb->s_op->write_inode(inode);
+
unlock_inode(inode);
}
diff --git a/sys/fs/vfs/namei.c b/sys/fs/vfs/namei.c
index 34153eb..5af932d 100644
--- a/sys/fs/vfs/namei.c
+++ b/sys/fs/vfs/namei.c
@@ -1,18 +1,22 @@
+#include
#include
#include
int follow_link(struct inode * dir, struct inode * inode, int flag, int mode, struct inode ** res_inode) {
+
if (!dir || !inode) {
iput(dir);
iput(inode);
*res_inode = NULL;
return -ENOENT;
}
+
if (!inode->i_op || !inode->i_op->follow_link) {
iput(dir);
*res_inode = inode;
return 0;
}
+
return inode->i_op->follow_link(dir, inode, flag, mode, res_inode);
}
@@ -25,8 +29,10 @@
mode >>= 6;
else if (in_group_p(inode->i_gid))
mode >>= 3;
+
if (((mode & mask & 0007) == mask)) // || suser())
return 1;
+
return 0;
}
@@ -38,13 +44,17 @@
if (!dir)
return -ENOENT;
+
/* check permissions before traversing mount-points */
perm = permission(dir, MAY_EXEC);
+
if (len == 2 && name[0] == '.' && name[1] == '.') {
if (dir == _current->root) {
*result = dir;
return 0;
- } else if ((sb = dir->i_sb) && (dir == sb->s_mounted)) {
+ }
+
+ else if ((sb = dir->i_sb) && (dir == sb->s_mounted)) {
sb = dir->i_sb;
iput(dir);
dir = sb->s_covered;
@@ -53,38 +63,46 @@
dir->i_count++;
}
}
+
if (!dir->i_op || !dir->i_op->lookup) {
iput(dir);
return -ENOTDIR;
}
+
if (!perm) {
iput(dir);
return -EACCES;
}
+
if (!len) {
*result = dir;
return 0;
}
+
return dir->i_op->lookup(dir, name, len, result);
}
static int dir_namei(const char * pathname, int * namelen, const char ** name, struct inode * base, struct inode ** res_inode) {
char c;
- const char * thisname;
- int len, error;
- struct inode * inode;
+ const char *thisname;
+ int len;
+ int error;
+ struct inode *inode;
*res_inode = NULL;
+
if (!base) {
base = _current->pwd;
base->i_count++;
}
+
if ((c = *pathname) == '/') {
iput(base);
base = _current->root;
pathname++;
base->i_count++;
}
+
while (1) {
thisname = pathname;
for (len = 0; (c = *(pathname++)) && (c != '/'); len++)
@@ -135,7 +153,8 @@
error = follow_link(base, inode, 0, 0, &inode);
if (error)
return error;
- } else
+ }
+ else
iput(base);
*res_inode = inode;
diff --git a/sys/fs/vfs/stat.c b/sys/fs/vfs/stat.c
index a6cb89f..647d697 100644
--- a/sys/fs/vfs/stat.c
+++ b/sys/fs/vfs/stat.c
@@ -12,8 +12,20 @@
switch (flags) {
case STAT_LSTAT:
namei(path, NULL, STAT_NO_FOLLOW, &inode);
+ sb.st_dev = inode->i_dev;
+ sb.st_ino = inode->i_ino;
+ sb.st_mode = inode->i_mode;
+ sb.st_nlink = inode->i_nlink;
+ sb.st_uid = inode->i_uid;
+ sb.st_gid = inode->i_gid;
+ sb.st_rdev = inode->i_rdev;
+ sb.st_size = inode->i_size;
+ sb.st_atime = inode->i_atime;
+ sb.st_mtime = inode->i_mtime;
+ sb.st_ctime = inode->i_ctime;
break;
default:
+ kprintf("STAT ERROR: {%s}", path);
error = -1;
break;
}
diff --git a/sys/include/ubixos/sched.h b/sys/include/ubixos/sched.h
index f47e351..d7f5bc9 100644
--- a/sys/include/ubixos/sched.h
+++ b/sys/include/ubixos/sched.h
@@ -27,8 +27,8 @@
*****************************************************************************************/
-#ifndef _SCHED_H
-#define _SCHED_H
+#ifndef _UBIXOS_SCHED_H
+#define _UBIXOS_SCHED_H
#include
#include