From patchwork Wed Aug 31 13:01:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9307177 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 0DA22601C0 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 F3B4628DE4 for ; Wed, 31 Aug 2016 13:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E845D28F28; Wed, 31 Aug 2016 13:02:02 +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 B535128DE4 for ; Wed, 31 Aug 2016 13:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934439AbcHaNB4 (ORCPT ); Wed, 31 Aug 2016 09:01:56 -0400 Received: from hr2.samba.org ([144.76.82.148]:31407 "EHLO hr2.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934231AbcHaNBz (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=Wh/5bfjurvDKMjc88vN7v+hM//L9EEFfZxuQVP+4R9w=; b=rSbk4OiNcEr9VEAsM5clpqeo9WKH8uEfWIrBNhvtNlxVqlHaW5j8ISgofipu6C4PEiysfIUktQOFrRJdJfG5yzYgvjqizZ7e9ivsvDehCrmvMcUnOzpNMEG/3qBVrp7FPx5PTWOCMT2KTh7/l2Q6RK+4Mn99aqikfTpH0i5ucPU=; 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 1bf59L-0003ib-56; Wed, 31 Aug 2016 13:01:51 +0000 From: Jeff Layton To: samba-technical@lists.samba.org Cc: ira@wakeful.net, ceph-devel@vger.kernel.org Subject: [samba RFC PATCH 2/6] vfs:ceph: add init_stat_ex_from_ceph_statx Date: Wed, 31 Aug 2016 09:01:10 -0400 Message-Id: <1472648474-3131-3-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 Add a helper function that will convert a ceph_statx structure to a stat_ex. The main difference is that we can now get a proper btime. Signed-off-by: Jeff Layton --- source3/modules/vfs_ceph.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 59e9b9cf9b3e..62ed469843de 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -535,6 +535,37 @@ static int cephwrap_fsync(struct vfs_handle_struct *handle, files_struct *fsp) WRAP_RETURN(result); } +#ifdef HAVE_CEPH_STATX +#define MINORBITS (20) +#define MINORMASK ((1U << MINORBITS) - 1) +#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) +#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) +#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) + +static void init_stat_ex_from_ceph_statx(struct stat_ex *dst, const struct ceph_statx *stx) +{ + dst->st_ex_dev = MKDEV(stx->stx_dev_major, stx->stx_dev_minor); + dst->st_ex_rdev = MKDEV(stx->stx_rdev_major, stx->stx_rdev_minor); + dst->st_ex_ino = stx->stx_ino; + dst->st_ex_mode = stx->stx_mode; + dst->st_ex_uid = stx->stx_uid; + dst->st_ex_gid = stx->stx_gid; + dst->st_ex_size = stx->stx_size; + dst->st_ex_nlink = stx->stx_nlink; + dst->st_ex_atime.tv_sec = stx->stx_atime; + dst->st_ex_atime.tv_nsec = stx->stx_atime_ns; + dst->st_ex_btime.tv_sec = stx->stx_btime; + dst->st_ex_btime.tv_nsec = stx->stx_btime_ns; + dst->st_ex_ctime.tv_sec = stx->stx_ctime; + dst->st_ex_ctime.tv_nsec = stx->stx_ctime_ns; + dst->st_ex_mtime.tv_sec = stx->stx_mtime; + dst->st_ex_mtime.tv_nsec = stx->stx_mtime_ns; + dst->st_ex_calculated_birthtime = false; + 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) {