Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3991799imu; Mon, 10 Dec 2018 11:09:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/XV6zEamK51v8wavldH+ZVgSa0j4dXsIPtqQ4eClsH/ui84dLdnHmYiLRr8yBHIHEZdcevM X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr13505944plq.286.1544468975379; Mon, 10 Dec 2018 11:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544468975; cv=none; d=google.com; s=arc-20160816; b=UhFsunGqYn1AG9ZyiGu4OHNKhqLvATWSP1NUOgX+0iML/G+Y9uF4ph2bBejM29I3Lt 9fYWhD+VamyQFFTcDXpAJ2vmL/1wLR1E3BKaCFlJ5YiafbGLTNOfkxUbk//HyvMIm1wy S21B0jIkmpX9TX6O0eaFJ3oelAdVfedj/EUAxU+zNGHNdsJG4V41vZhUcWRizaRsTnDn PkBoUMcFgtvz4X2ntwGDQ7Igwa9upsKfPLZf/MT7WaIYalhvwf4gtGquycxRSoHxKfTg BHscxpmRmmF3eV7pPyiVg61xBn/TdV1MiXnoMBmKnBlGhhNm6uH0bn6uB5Z9MQYGE5+/ /Ahg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=nGOCm20qHA3TrbeQrKmmcfyt31xvnJRkSeQ3cXd84Aw=; b=jfB4Gw9hI0L7q9LKasv9xJwI3LeRk7fVjkDDwXK/10sZh04aVnAGsjzb24N9rTFiWW Mf5iC7m5DTGdzg7yAk4VjA0XYNVzaV5FZwEIHuCJNOUokpZiteMDZSQ0uybK92zNsPOS HcX96a5060mCXcI9mJjzZje+V1ZY0Lj58zS9IFyEhDIWuHd5OpN+YPaem/LXgkh3bFQM 0Kncp/r4ppXlPh/whPPgfT+I8yodG4CJ0ujKjfsDkWtE2hDiLdeQXsT+i29y0j/CPbd2 Dl6diJQg1/I+UWbKamqqgKCkPevisDpPWokjr7Rk2Zmdav5pVsjIIlcHxCxKB4/rlkn2 5kMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t65si11048706pfb.247.2018.12.10.11.09.20; Mon, 10 Dec 2018 11:09:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbeLJROJ (ORCPT + 99 others); Mon, 10 Dec 2018 12:14:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39829 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728655AbeLJRNv (ORCPT ); Mon, 10 Dec 2018 12:13:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 004D8307D96B; Mon, 10 Dec 2018 17:13:51 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02E2C18501; Mon, 10 Dec 2018 17:13:34 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 658F4224263; Mon, 10 Dec 2018 12:13:30 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vgoyal@redhat.com, miklos@szeredi.hu, stefanha@redhat.com, dgilbert@redhat.com, sweil@redhat.com, swhiteho@redhat.com Subject: [PATCH 24/52] fuse: Introduce setupmapping/removemapping commands Date: Mon, 10 Dec 2018 12:12:50 -0500 Message-Id: <20181210171318.16998-25-vgoyal@redhat.com> In-Reply-To: <20181210171318.16998-1-vgoyal@redhat.com> References: <20181210171318.16998-1-vgoyal@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Dec 2018 17:13:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce two new fuse commands to setup/remove memory mappings. Signed-off-by: Vivek Goyal --- include/uapi/linux/fuse.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index b4967d48bfda..867fdafc4a5e 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -394,6 +394,8 @@ enum fuse_opcode { FUSE_RENAME2 = 45, FUSE_LSEEK = 46, FUSE_COPY_FILE_RANGE = 47, + FUSE_SETUPMAPPING = 48, + FUSE_REMOVEMAPPING = 49, /* CUSE specific operations */ CUSE_INIT = 4096, @@ -817,4 +819,35 @@ struct fuse_copy_file_range_in { uint64_t flags; }; +#define FUSE_SETUPMAPPING_ENTRIES 8 +#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) +struct fuse_setupmapping_in { + /* An already open handle */ + uint64_t fh; + /* Offset into the file to start the mapping */ + uint64_t foffset; + /* Length of mapping required */ + uint64_t len; + /* Flags, FUSE_SETUPMAPPING_FLAG_* */ + uint64_t flags; + /* Offset in Memory Window */ + uint64_t moffset; +}; + +struct fuse_setupmapping_out { + /* Offsets into the cache of mappings */ + uint64_t coffset[FUSE_SETUPMAPPING_ENTRIES]; + /* Lengths of each mapping */ + uint64_t len[FUSE_SETUPMAPPING_ENTRIES]; +}; + +struct fuse_removemapping_in { + /* An already open handle */ + uint64_t fh; + /* Offset into the dax window start the unmapping */ + uint64_t moffset; + /* Length of mapping required */ + uint64_t len; +}; + #endif /* _LINUX_FUSE_H */ -- 2.13.6