// // estimate the byte size of attribute names list... public int listxattrsize(ByteBuffer path, FuseSizeSetter sizeSetter) { if (xattrSupport == null) return handleErrno(Errno.ENOTSUPP); String pathStr = cs.decode(path).ToString(); if (log != null && log.IsDebugEnabled) log.Debug("listxattrsize: path=" + pathStr); int errno; XattrSizeLister lister = new XattrSizeLister(); try { errno = xattrSupport.listxattr(pathStr, lister); } catch (System.Exception e) { return handleException(e); } sizeSetter.setSize(lister.size); return handleErrno(errno, sizeSetter); }
/** * This method can be called to query for the size of the extended attribute * * @params path the path to file or directory containing extended attribute * @params name the name of the extended attribute * @params sizeSetter a callback interface that should be used to set the attribute's size * @return 0 if Ok or errno when error * @throws fuse.FuseException an alternative to returning errno is to throw this exception with errno initialized */ //throws FuseException public int getxattrsize(String path, String name, FuseSizeSetter sizeSetter) { N n = lookup(path); if (n == null) return Errno.ENOENT; byte[] value= null; n.xattrs.TryGetValue(name, out value); if (value == null) return Errno.ENOATTR; sizeSetter.setSize(value.Length); return 0; }
// // extended attribute support is optional public int getxattrsize(ByteBuffer path, ByteBuffer name, FuseSizeSetter sizeSetter) { if (xattrSupport == null) return handleErrno(Errno.ENOTSUPP); String pathStr = cs.decode(path).ToString(); String nameStr = cs.decode(name).ToString(); if (log != null && log.IsDebugEnabled) log.Debug("getxattrsize: path=" + pathStr + ", name=" + nameStr); try { return handleErrno(xattrSupport.getxattrsize(pathStr, nameStr, sizeSetter), sizeSetter); } catch (System.Exception e) { return handleException(e); } }