Esempio n. 1
0
 void AddTag(string tag_name, string tag_value, PathPart val)
 {
     lock (tags)
     {
         GetTagName(tag_name).AddTag(tag_value, val);
     }
 }
Esempio n. 2
0
 void DeleteTag(string tag_name, string tag_value, PathPart val)
 {
     lock (tags)
     {
         GetTagName(tag_name).DeleteTag(tag_value, val);
     }
 }
Esempio n. 3
0
            public void AddEntry(PathPart val)
            {
                entries[val] = 1;

                foreach (var add_del in add_dels)
                {
                    if (add_del.s != null)
                    {
                        tysos.Syscalls.IPCFunctions.SendMessage(add_del.s,
                                                                new tysos.IPCMessage {
                            Type = add_del.msg_id, Message = val.ToString()
                        });
                    }
                }
            }
Esempio n. 4
0
            public void DeleteEntry(PathPart val)
            {
                if (entries.ContainsKey(val))
                {
                    entries.Remove(val);

                    foreach (var rem_del in rem_dels)
                    {
                        if (rem_del.s != null)
                        {
                            tysos.Syscalls.IPCFunctions.SendMessage(rem_del.s,
                                                                    new tysos.IPCMessage {
                                Type = rem_del.msg_id, Message = val.ToString()
                            });
                        }
                    }
                }
            }
Esempio n. 5
0
            public void DeleteTag(string tag_value, PathPart val)
            {
                var tv = GetTagValue(tag_value);

                tv.DeleteEntry(val);
            }
Esempio n. 6
0
            public void AddTag(string tag_value, PathPart val)
            {
                var tv = GetTagValue(tag_value);

                tv.AddEntry(val);
            }
Esempio n. 7
0
        public Path GetPath(string path)
        {
            //tysos.Syscalls.DebugFunctions.DebugWrite("vfs: GetPath(string) called with path: " + path + "\n");

            path = path.TrimEnd('/');
            if (path == String.Empty)
            {
                path = "/";
            }
            if (path == "*")
            {
                path = "/*";
            }
            if (path[0] != '/')
            {
                throw new Exception("relative paths not supported");
            }

            string[]      split_string = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> new_path     = new List <string>();

            foreach (string s in split_string)
            {
                if (s == ".")
                {
                    continue;
                }
                else if (s == "..")
                {
                    if (new_path.Count == 0)
                    {
                        return(null);
                    }
                    new_path.RemoveAt(new_path.Count - 1);
                }
                else
                {
                    new_path.Add(s);
                }
            }

            List <string> additional = new List <string>();

            PathPart pp_mount = new PathPart {
                path = new_path
            };
            PathPart pp_additional = new PathPart {
                path = additional
            };

            /* The entire path is in pp_mount.  Check if this is a mount point.
             *  If not, take the last element and insert it at the beginning of
             *  additional and repeat until either a mount point is found or
             *  mount is empty, at which point fail
             */
            do
            {
                //tysos.Syscalls.DebugFunctions.DebugWrite("vfs: GetPath: checking for mount point " + mount + "\n");
                if (mounts.ContainsKey(pp_mount))
                {
                    //tysos.Syscalls.DebugFunctions.DebugWrite("vfs: GetPath: found mount point " + mount + " of type " + mounts[mount].GetType().FullName + "\n");
                    return(new Path {
                        device = mounts[pp_mount], path = pp_additional, mount_point = pp_mount
                    });
                }

                // handle being passed the root directory when nothing is mounted
                if (new_path.Count == 0)
                {
                    if (additional.Count == 0)
                    {
                        return new Path {
                                   device = null, mount_point = null, path = pp_additional
                        }
                    }
                    ;
                    else
                    {
                        return(null);
                    }
                }

                string last_elem = new_path[new_path.Count - 1];
                new_path.RemoveAt(new_path.Count - 1);
                additional.Insert(0, last_elem);
            } while (true);
        }