From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B3FFC43381 for ; Sun, 24 Mar 2019 13:21:55 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A1FF222D0 for ; Sun, 24 Mar 2019 13:21:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="klXDEcoF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A1FF222D0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1h834R-00012b-Ub; Sun, 24 Mar 2019 09:21:51 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1h834Q-00012U-0J for kernelnewbies@kernelnewbies.org; Sun, 24 Mar 2019 09:21:50 -0400 Received: by mail-pf1-x436.google.com with SMTP id 9so4513344pfj.13 for ; Sun, 24 Mar 2019 06:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9GtdX7t+2GGfsTKvFI7NdkJEbcawNXF2DhOiiKK+sUU=; b=klXDEcoFqY+c8NL9TmwV8iVgSmolB7S6jKbCuuSsnGVzK9wJxTBRCxcEDg6assIynJ hW/Ltc0mIbCfo4zOpYoFSSpW7UsH8pKfwRGTEyby4cPxAVkL5JOZLjx7usOlw/tWtYak yCdU03s7GLaDzZAuReSGzzbNel79mpdxqW/c5WhCnOiXHFfCKhA4vlahE27JOiOKXlRv Mwm4iS232nKJ4Hr99zVQz03dPUNwGLPPEH4s2HE2UxBRR0gDpIvSwmVuAeXz+vwNaV6g jZGsT2lz6I8ZQkqY5EGqHrYNE8nFZRqwd+pZ3NAz/FyQRxr0tqyH97Z0W0zyj1wIKNa9 UGxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9GtdX7t+2GGfsTKvFI7NdkJEbcawNXF2DhOiiKK+sUU=; b=kSuTM21YwmLpnOSX/Tb95tHNWq/KCpJEW9fO+SU5ZXLB6SwV1N0ta9cWle2bEx2tlB 2HA6JMdrLm0oFiHW96ACNcEUVBhP7pGpgzP2t9RvJgvX3cFtW928bXzzmUQzEXXInZhG HbdtIuNRHK40npFznnZWXbORKmzJkox1kNCmj/nzT5CtbP/pUWTz7REs4HEphqgYj+9l +DQ7VAiU7solWOKGQgUzYy9a3WgQyDK0aqN+1+7BGSUGdnuc8x/E6kII+XhuNcBS42N4 B8RNuK5MgOwsukW7ra+enja/Ukr7xSS1c10xdHwWg9AvV/8I7ROWqbxhQ2anVs+KtgM5 yLLg== X-Gm-Message-State: APjAAAUT2i4nUOCpsMaqgtuLOMqebYZPTZ5AKqLCzPPPgAM+OSbO++P4 ewR5b2F4kNODRxZ4WMmZnvqfKLFf X-Google-Smtp-Source: APXvYqzQNX/E3qQxcEm/1dMAOrWgoumAzEpR/uuAX8sdIVzjcmmQnui/4Gyf5LVwA2ZczTFZuaVVSQ== X-Received: by 2002:a65:6098:: with SMTP id t24mr18689420pgu.57.1553433707877; Sun, 24 Mar 2019 06:21:47 -0700 (PDT) Received: from bharath12345-Inspiron-5559 ([103.110.42.35]) by smtp.gmail.com with ESMTPSA id 17sm18451486pgt.0.2019.03.24.06.21.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 06:21:47 -0700 (PDT) Date: Sun, 24 Mar 2019 18:51:41 +0530 From: Bharath Vedartham To: Bernd Petrovitsch Subject: Re: Overwriting copy functionality in filesystem Message-ID: <20190324132141.GB24735@bharath12345-Inspiron-5559> References: <20190323165945.GA13199@bharath12345-Inspiron-5559> <2d5aea0b-23ad-ba50-a73a-399d89dbf060@petrovitsch.priv.at> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2d5aea0b-23ad-ba50-a73a-399d89dbf060@petrovitsch.priv.at> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Sat, Mar 23, 2019 at 08:03:20PM +0100, Bernd Petrovitsch wrote: > Hi all! > > On 23/03/2019 17:59, Bharath Vedartham wrote: > [..] > > I was wondering how we can overwrite the copy functionality while > > writing our own filesystem in linux. > > VFS does not offer any sort of API for copy. I think it calls create and > > Yes. > > > write when we execute the copy the file/dir. > > I am interested in overwriting the way copy happens in my > > filesystem(which I am writing for fun :p). > > Any ideas? > > strace a "cp" and see which system calls are used. > Look into the source code and see how it's implemented. > > There is actually more than one method but the usual (while simplest, > most versatile and probably fastest) method used is: open source and > destination files, read from the source, write into the destination > until EOF. > I have observed that it is a mixture of system calls. I am interested in implementing copy-on-write in my filesystem(for fun). I feel that, it would require my creat vfs api to be aware of the fact that "cp" is calling it. I want to keep things as generic as possible. I ll proceed by reading the source of union filesystems (overlayfs) to see how they implement copy-on-write. > MfG, > Bernd > -- > Bernd Petrovitsch Email : bernd@petrovitsch.priv.at > LUGA : http://www.luga.at _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies