int hsx_fuse_fill_reply (struct hsfs_inode *inode, struct fuse_entry_param *e) { DEBUG_IN(" ino %lu.\n", inode->ino); if(NULL == inode) { ERR("NULL POINTER in hsx_fuse_fill_reply"); goto out; } if (0 == hsi_nfs3_fattr2stat(&(inode->attr), &(e->attr))) { e->ino = inode->ino; if (NF3REG == inode->attr.type) { e->attr_timeout = inode->sb->acregmin; e->entry_timeout = inode->sb->acregmax; } else if (NF3DIR == inode->attr.type) { e->attr_timeout = inode->sb->acdirmin; e->entry_timeout = inode->sb->acdirmax; }else { ERR("Error in get file type!\n"); goto out; } DEBUG_OUT("OUT %s\n", "hsx_fuse_fill_reply"); return 1; }else { ERR ("Error in fattr2stat\n"); } out: DEBUG_OUT("OUT ino %lu.\n", inode->ino); return 0; }
int hsi_nfs3_do_getattr(struct hsfs_super *sb, struct nfs_fh3 *fh, struct nfs_fattr *fattr, struct stat *st) { struct getattr3res res; struct fattr3 *attr = NULL; int err; DEBUG_IN("(%p, %p, %p, %p)", sb, fh, fattr, st); memset(&res, 0, sizeof(res)); err = hsi_nfs3_clnt_call(sb, sb->clntp, NFSPROC3_GETATTR, (xdrproc_t)xdr_nfs_fh3, (caddr_t)fh, (xdrproc_t)xdr_getattr3res, (caddr_t)&res); if (err) goto out_no_free; if (NFS3_OK != res.status) { err = hsi_nfs3_stat_to_errno(res.status); ERR("RPC Server returns failed status : %d.\n", err); goto out; } attr = &res.getattr3res_u.attributes; if (fattr){ hsi_nfs3_fattr2fattr(attr, fattr); DEBUG("get nfs_fattr(V:%x, U:%u, G:%u, S:%llu, I:%llu)", fattr->valid, fattr->uid, fattr->gid, fattr->size, fattr->fileid); } if (st) hsi_nfs3_fattr2stat(attr, st); out: clnt_freeres(sb->clntp, (xdrproc_t)xdr_getattr3res, (char *)&res); out_no_free: DEBUG_OUT("with errno %d.\n", err); return err; }