internal ZfsSymLink(Zpl zpl, ZfsDirectory parent, string name, DNode dn, SaAttributes attr) : base(zpl, parent, name, dn, attr) { var bytes = attr.Get(zpl_attr_t.ZPL_SYMLINK); PointsTo = Encoding.ASCII.GetString(bytes.Array, bytes.Offset, bytes.Count); }
DateTime GetDateTime(SaAttributes attrs, zpl_attr_t attr) { var bytes = attrs.Get(attr); ulong seconds = Program.ToStruct <ulong>(bytes.SubSegment(0, sizeof(ulong))); ulong nanosecs = Program.ToStruct <ulong>(bytes.SubSegment(sizeof(ulong), sizeof(ulong))); return(sEpoc.AddSeconds(seconds).AddTicks((long)(nanosecs / 100))); }
internal ZfsItem(Zpl zpl, ZfsDirectory parent, string name, DNode dn, SaAttributes attrs) { this.mZpl = zpl; this.Name = name; this.Parent = parent; this.mDn = dn; if (mDn.Type != DmuType) { throw new NotSupportedException(); } mMode = attrs.Get <long>(zpl_attr_t.ZPL_MODE); CTIME = GetDateTime(attrs, zpl_attr_t.ZPL_CTIME); MTIME = GetDateTime(attrs, zpl_attr_t.ZPL_MTIME); ATIME = GetDateTime(attrs, zpl_attr_t.ZPL_ATIME); }
internal ZfsFile(Zpl zpl, ZfsDirectory parent, string name, DNode dn, SaAttributes attr) : base(zpl, parent, name, dn, attr) { Length = attr.Get <long>(zpl_attr_t.ZPL_SIZE); }
ZfsItemType GetFileType(SaAttributes attr) { var mode = attr.Get <long>(zpl_attr_t.ZPL_MODE); return((ZfsItemType)((mode >> 12) & 0xf)); }