//throws FuseException
        public int getattr(String path, FuseGetattrSetter getattrSetter)
        {
            FuseStat stat = fs2.getattr(path);

            getattrSetter.set(
               stat.inode,
               stat.mode,
               stat.nlink,
               stat.uid,
               stat.gid,
               0,
               stat.size,
               stat.blocks,
               stat.atime,
               stat.mtime,
               stat.ctime
            );

            return 0;
        }
Example #2
0
        //throws FuseException
        public int getattr(String path, FuseGetattrSetter getattrSetter)
        {
            N n = lookup(path);

            int time = (int)(DateTime.Now.Ticks / 1000L);

            if (n is D)
            {
                D d = (D)n;
                getattrSetter.set(
                   d.GetHashCode(),
                   FuseFtypeConstants.TYPE_DIR | d.mode,
                   1,
                   0, 0,
                   0,
                   d.files.Count * NAME_LENGTH,
                   (d.files.Count * NAME_LENGTH + BLOCK_SIZE - 1) / BLOCK_SIZE,
                   time, time, time
                );

                return 0;
            }
            else if (n is F)
            {
                F f = (F)n;
                getattrSetter.set(
                   f.GetHashCode(),
                   FuseFtypeConstants.TYPE_FILE | f.mode,
                   1,
                   0, 0,
                   0,
                   f.content.Length,
                   (f.content.Length + BLOCK_SIZE - 1) / BLOCK_SIZE,
                   time, time, time
                );

                return 0;
            }
            else if (n is L)
            {
                L l = (L)n;
                getattrSetter.set(
                   l.GetHashCode(),
                   FuseFtypeConstants.TYPE_SYMLINK | l.mode,
                   1,
                   0, 0,
                   0,
                   l.link.Length,
                   (l.link.Length + BLOCK_SIZE - 1) / BLOCK_SIZE,
                   time, time, time
                );

                return 0;
            }

            return Errno.ENOENT;
        }
        //
        // FuseFS implementation
        public int getattr(ByteBuffer path, FuseGetattrSetter getattrSetter)
        {
            String pathStr = cs.decode(path).ToString();

            if (log != null && log.IsDebugEnabled)
                log.Debug("getattr: path=" + pathStr);

            try
            {
                return handleErrno(fs3.getattr(pathStr, getattrSetter), getattrSetter);
            }
            catch (System.Exception e)
            {
                return handleException(e);
            }
        }