From patchwork Wed Aug 31 13:01:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9307179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7FCD0601C0 for ; Wed, 31 Aug 2016 13:02:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 719A628DE4 for ; Wed, 31 Aug 2016 13:02:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65FC928F27; Wed, 31 Aug 2016 13:02:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F2C928F23 for ; Wed, 31 Aug 2016 13:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934444AbcHaNB5 (ORCPT ); Wed, 31 Aug 2016 09:01:57 -0400 Received: from hr2.samba.org ([144.76.82.148]:31412 "EHLO hr2.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934281AbcHaNBz (ORCPT ); Wed, 31 Aug 2016 09:01:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42627210; h=Message-Id:Date:Cc:To:From; bh=kaLBa4EVfWin86lVYXbKgszfUYGbRrYr/sa97bt4Fak=; b=Ju5SLitdc/avoHQWsoKLftrnsy4hXrQydEqcKkw7v42vlMnVBUmnvLeiVJgJG4W677QU/WTR2uBQ2SlR4cebQOgFBaJhpqKPvhfer2hhCgDM4Ro79DIxWtOOzGzMf/0Xbfy5vnQCoN2LtZkTuenHhNt9YbpcqZk98thMgPC1NOg=; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim) id 1bf59M-0003ib-6s; Wed, 31 Aug 2016 13:01:52 +0000 From: Jeff Layton To: samba-technical@lists.samba.org Cc: ira@wakeful.net, ceph-devel@vger.kernel.org Subject: [samba RFC PATCH 3/6] vfs:ceph: convert cephwrap_stat to use ceph_statx Date: Wed, 31 Aug 2016 09:01:11 -0400 Message-Id: <1472648474-3131-4-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472648474-3131-1-git-send-email-jlayton@samba.org> References: <1472648474-3131-1-git-send-email-jlayton@samba.org> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jeff Layton --- source3/modules/vfs_ceph.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 62ed469843de..f8c43f93f4b5 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -564,7 +564,41 @@ static void init_stat_ex_from_ceph_statx(struct stat_ex *dst, const struct ceph_ dst->st_ex_blksize = stx->stx_blksize; dst->st_ex_blocks = stx->stx_blocks; } -#endif /* HAVE_CEPH_STATX */ + +static int cephwrap_stat(struct vfs_handle_struct *handle, + struct smb_filename *smb_fname) +{ + int result = -1; + struct ceph_statx stx; + + DEBUG(10, ("[CEPH] stat(%p, %s)\n", handle, smb_fname_str_dbg(smb_fname))); + + if (smb_fname->stream_name) { + errno = ENOENT; + return result; + } + + result = ceph_statx(handle->data, smb_fname->base_name, &stx, + CEPH_STATX_BASIC_STATS|CEPH_STATX_BTIME, 0); + DEBUG(10, ("[CEPH] statx(...) = %d\n", result)); + if (result < 0) { + WRAP_RETURN(result); + } else { + DEBUG(10, ("[CEPH]\tstx = {dev = %llx/%llx, ino = %llu, mode = 0x%x, nlink = %llu, " + "uid = %d, gid = %d, rdev = %llx/%llx, size = %llu, blksize = %llu, " + "blocks = %llu, atime = %llu, mtime = %llu, ctime = %llu, btime = %llu}\n", + llu(stx.stx_dev_major), llu(stx.stx_dev_minor), llu(stx.stx_ino), stx.stx_mode, + llu(stx.stx_nlink), stx.stx_uid, stx.stx_gid, llu(stx.stx_rdev_major), + llu(stx.stx_rdev_minor), llu(stx.stx_size), llu(stx.stx_blksize), + llu(stx.stx_blocks), llu(stx.stx_atime), llu(stx.stx_mtime), llu(stx.stx_ctime), + llu(stx.stx_btime))); + } + init_stat_ex_from_ceph_statx(&smb_fname->st, &stx); + DEBUG(10, ("[CEPH] mode = 0x%x\n", smb_fname->st.st_ex_mode)); + return result; +} + +#else /* HAVE_CEPH_STATX */ static int cephwrap_stat(struct vfs_handle_struct *handle, struct smb_filename *smb_fname) @@ -597,6 +631,7 @@ static int cephwrap_stat(struct vfs_handle_struct *handle, DEBUG(10, ("[CEPH] mode = 0x%x\n", smb_fname->st.st_ex_mode)); return result; } +#endif /* HAVE_CEPH_STATX */ static int cephwrap_fstat(struct vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) {