예제 #1
0
 public void SetExtendedAttributes(string path, string name, byte[] value, XattrFlags flags)
 {
     if (Syscall.lsetxattr(path.GetPath(_source), name, value, (ulong)value.Length, flags) == -1)
     {
         throw new NativeException((int)Stdlib.GetLastError());
     }
 }
        public static Int32 FromXattrFlags(XattrFlags value)
        {
            Int32 rval;

            if (FromXattrFlags(value, out rval) == -1)
            {
                ThrowArgumentException(value);
            }
            return(rval);
        }
        public override Errno OnSetPathExtendedAttribute(
            string path, string name, byte[] value, XattrFlags flags)
        {
            Trace.WriteLine($"OnSetPathExtendedAttribute Path:{path} Attribute:{value}");

            int r = Syscall.setxattr(GetTargetPath(path), name, value, flags);

            if (r < 0)
            {
                return(GetLastError());
            }

            return(0);
        }
예제 #4
0
        private int _OnSetPathExtendedAttribute(
            string path, string name, byte[] value, ulong size, int flags)
        {
            Errno errno;

            try
            {
                XattrFlags f = NativeConvert.ToXattrFlags(flags);
                errno = _filesystem.OnSetPathExtendedAttribute(path, name, value, f);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
                errno = Errno.EIO;
            }
            return(Interop.ConvertErrno(errno));
        }
예제 #5
0
        public Result SetExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            return(ReadFile(path)
                   .Then(file =>
            {
                var attributes = file.ExtendedAttributes.Attributes;
                if (attributes.ContainsKey(name) && flags == XattrFlags.XATTR_CREATE)
                {
                    return Result.Fail(FileSystemError.AlreadyExist);
                }

                if (!attributes.ContainsKey(name) && flags == XattrFlags.XATTR_REPLACE)
                {
                    return Result.Fail(FileSystemError.NoAttribute);
                }

                attributes.Add(name, value);
                WriteFile(file);
                return Result.Ok();
            }));
        }
예제 #6
0
 private static int ToXattrFlags(Int32 value, out XattrFlags rval)
 {
     throw new System.NotImplementedException();
 }
예제 #7
0
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     int r = Syscall.lsetxattr (basedir+path, name, value, (ulong) value.Length, flags);
     if (r == -1)
         return Stdlib.GetLastError ();
     return 0;
 }
예제 #8
0
 public virtual Errno OnSetPathExtendedAttribute(
     string path, string name, byte[] value, XattrFlags flags)
 {
     return(Errno.ENOSYS);
 }
예제 #9
0
		private static extern int ToXattrFlags (Int32 value, out XattrFlags rval);
예제 #10
0
		public static bool TryFromXattrFlags (XattrFlags value, out Int32 rval)
		{
			return FromXattrFlags (value, out rval) == 0;
		}
예제 #11
0
 public static bool TryToXattrFlags(Int32 value, out XattrFlags rval)
 {
     return(ToXattrFlags(value, out rval) == 0);
 }
예제 #12
0
		public static extern int fsetxattr (int fd, string name, byte[] value, ulong size, XattrFlags flags);
예제 #13
0
 private static extern int FromXattrFlags(XattrFlags value, out Int32 rval);
예제 #14
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            if (_umountToken == null)
            {
                return(Errno.EROFS);
            }

            if (path != "/.fuse_umount")
            {
                return(Errno.EROFS);
            }

            if (name != _umountToken)
            {
                return(Errno.EROFS);
            }

            if (value?.Length != 0)
            {
                return(Errno.EROFS);
            }

            _umountToken = null;
            Stop();

            return(0);
        }
예제 #15
0
        public Result SetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
#if DEBUG
            var request = new CrazyFsRequest(CrazyFsRequestName.SetPathExtendedAttribute, new[]
            {
                new KeyValuePair <string, string>("path", path),
                new KeyValuePair <string, string>("name", name),
                new KeyValuePair <string, string>("flags", flags.ToString())
            }).Log();
#endif
            try
            {
                FileSystem.Path.SetExtendedAttributes(path, name, value, flags);
                var result = new Result(ResultStatus.Success);
#if DEBUG
                request.Log(result);
#endif
                return(result);
            }
            catch (Exception ex)
            {
                var result = ex.GetResult();
#if DEBUG
                request.Log(result);
#endif
                return(result);
            }
        }
예제 #16
0
		public static int fsetxattr (int fd,
		string name, byte[] value, ulong size, XattrFlags flags)
		{
			throw new System.NotImplementedException();
		}
예제 #17
0
		public static int fsetxattr (int fd, string name, byte [] value, XattrFlags flags)
		{
			return fsetxattr (fd, name, value, (ulong) value.Length, flags);
		}
예제 #18
0
 public static void SetExtendedAttributes(this IPath pathInterface, string path, string name, byte[] value, XattrFlags flags)
 {
     if (pathInterface is not ILinuxPath pathWrapper)
     {
         throw new Exception("IPath is not the linux version");
     }
     pathWrapper.SetExtendedAttributes(path, name, value, flags);
 }
예제 #19
0
		public static extern int lsetxattr (string path, string name, byte[] value, ulong size, XattrFlags flags);
예제 #20
0
 public static int fsetxattr(int fd,
                             string name, byte[] value, ulong size, XattrFlags flags)
 {
     throw new System.NotImplementedException();
 }
예제 #21
0
		public static int lsetxattr (string path, string name, byte [] value, XattrFlags flags)
		{
			return lsetxattr (path, name, value, (ulong) value.Length, flags);
		}
예제 #22
0
파일: FS.cs 프로젝트: gurudvlp/SoundCloudFS
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     Logging.Write (string.Format("(OnSetPathExtendedAttribute {0})", path));
     if (path != "/hello") {
         return Errno.ENOSPC;
     }
     lock (hello_attrs) {
         hello_attrs [name] = value;
     }
     return 0;
 }
예제 #23
0
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     return(0);
 }
예제 #24
0
 public static bool TryFromXattrFlags(XattrFlags value, out Int32 rval)
 {
     return(FromXattrFlags(value, out rval) == 0);
 }
예제 #25
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            int r = Syscall.lsetxattr(_basedir + path, name, value, (ulong)value.Length, flags);

            return(GetResult(r));
        }
예제 #26
0
 private static extern int ToXattrFlags(Int32 value, out XattrFlags rval);
예제 #27
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            Logger.WriteLineIf(LogLevel.Verbose, _fslog_props, string.Format("OnSetPathExtendedAttribute, path={0}, name={1}, value={2}, flags={3}", path, name, Encoding.UTF8.GetString(value), flags));

            return(this._rfs.SetPathExtendedAttribute(path, name, value, flags));
        }
예제 #28
0
		private static extern int FromXattrFlags (XattrFlags value, out Int32 rval);
예제 #29
0
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     Trace.WriteLine("(OnSetPathExtendedAttribute {0})", path);
     if (path != hello_path)
     {
         return(Errno.ENOSPC);
     }
     lock (hello_attrs) {
         hello_attrs [name] = value;
     }
     return(0);
 }
예제 #30
0
		public static Int32 FromXattrFlags (XattrFlags value)
		{
			Int32 rval;
			if (FromXattrFlags (value, out rval) == -1)
				ThrowArgumentException (value);
			return rval;
		}
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     return(_fileSystem.SetPathExtendedAttribute(path, name, value, flags).ToErrno());
 }
예제 #32
0
		public static bool TryToXattrFlags (Int32 value, out XattrFlags rval)
		{
			return ToXattrFlags (value, out rval) == 0;
		}
		private static int FromXattrFlags (XattrFlags value, out Int32 rval)
		{
			throw new System.NotImplementedException();
		}
예제 #34
0
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     return(WithLogging(
                () => fileSystemRepository.SetExtendedAttribute(path, name, value, flags),
                $"OnSetPathExtendedAttribute({path}, {name}, {flags})"));
 }
		private static int ToXattrFlags (Int32 value, out XattrFlags rval)
		{
			throw new System.NotImplementedException();
		}
예제 #36
0
 private static int FromXattrFlags(XattrFlags value, out Int32 rval)
 {
     throw new System.NotImplementedException();
 }
예제 #37
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            if (path != writable_path)
                return Errno.ENOSPC;

            writable_attrs [name] = value;
            return 0;
        }
예제 #38
0
 protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
 {
     Trace.WriteLine ("(OnSetPathExtendedAttribute {0})", path);
     if (path != hello_path) {
         return Errno.ENOSPC;
     }
     lock (hello_attrs) {
         hello_attrs [name] = value;
     }
     return 0;
 }
예제 #39
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            Logger.WriteLineIf(LogLevel.Verbose, _fslog_props, string.Format("OnSetPathExtendedAttribute, path={0}, name={1}, value={2}, flags={3}", path, name, Encoding.UTF8.GetString(value), flags));

              return this._rfs.SetPathExtendedAttribute(path, name, value, flags);
        }
예제 #40
0
        protected override Errno OnSetPathExtendedAttribute(string path, string name, byte[] value, XattrFlags flags)
        {
            int r = Syscall.lsetxattr(basedir + path, name, value, (ulong)value.Length, flags);

            if (r == -1)
            {
                return(Stdlib.GetLastError());
            }
            return(0);
        }
예제 #41
0
		public static extern int fsetxattr (int fd, 
		[MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileNameMarshaler))]
		string name, byte[] value, ulong size, XattrFlags flags);