Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2540886pxb; Sun, 17 Oct 2021 18:20:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXdGYt/w8xzvKD/KdhsPbFok1K07IqMqKzdB7Bhf5+qNvmKuE/MfUwoNH05mlVLw3480P5 X-Received: by 2002:a05:6a00:1407:b0:44c:d2cc:916e with SMTP id l7-20020a056a00140700b0044cd2cc916emr25801292pfu.64.1634520029906; Sun, 17 Oct 2021 18:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634520029; cv=none; d=google.com; s=arc-20160816; b=wXlU0bzQni3eKZk/G5a+FMIG+480xlLlOGZqAb+myRmGvCZ9sFP5k50eJv8PVvX8JF dYNwroYldBA8UvqJByR2qVmnJcPhBVEpRGPip+SwPhuQg9TNeIm/sQy8gVn8bmvZXtJ9 Imn/vT6VaF1iY7imGxsupFQVaARnaN1UIOFYZkv4027Eqwfct2BlfMrQfYB1kjHfRkzW XjA6zePfmpSJzPZDT0DtmLsetVZSHB9h1izdToIk51qXTv+BCgD8du17UTwip6RVrhlB UwyGNcsZtTsGuQWXVC36MVLCHG9QYqiB35JxRLNdwLuxo2HY3V9pdJ8tGPFkiP3MYyJl JKDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Ol7dGMnxIP8+KPWWH6L668Vern3JJSiNw/+boTFnz1w=; b=wzBs6DPbUqzLg2cuw3PwRc+Gp/eL07HjMZxefZVBq1cFWdv4ImKZP8bFJnM3AgZc72 rKOu98WHxNcd9BE5+mCl7Y4+sy66v/Xh08X+eyqwKKgPx2SdzNjdZRQbs36iKc8myy7P A0vHVuR4Kr0mrbeAlx2Mkie7QGKEPBUbxJdDrt65AZ00e8+JltDqCRm/enQF6jAGH5pj 44/vXhOyh9pSBTW2yCJYiyrXZLKxqYmIgSWYD16QQFEGWns4yYuUkJztpI2OXcgaQ1y8 ScAthY6t0tVugQCijkm8MxlH+5rnz5MsLtiFBvSl017Vbb6m00Gp45ytZe1Y6f/roIQa r+1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si10435166plc.16.2021.10.17.18.20.09; Sun, 17 Oct 2021 18:20:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238545AbhJOUck (ORCPT + 99 others); Fri, 15 Oct 2021 16:32:40 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:60811 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242451AbhJOUcj (ORCPT ); Fri, 15 Oct 2021 16:32:39 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 19FKUSeW022631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Oct 2021 16:30:29 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 5E5DA15C00CA; Fri, 15 Oct 2021 16:30:28 -0400 (EDT) Date: Fri, 15 Oct 2021 16:30:28 -0400 From: "Theodore Ts'o" To: Avi Deitcher Cc: linux-ext4@vger.kernel.org Subject: Re: algorithm for half-md4 used in htree directories Message-ID: References: <3A493D20-568A-4D63-A575-5DEEBFAAF41A@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Oct 15, 2021 at 12:43:33PM -0700, Avi Deitcher wrote: > Thanks, Ted, I will try yours and step through it to figure out what is off. > > You ask a fair question: other than madness, why would someone want to > recreate the exact algorithm? > > I have had a number of cases where I have needed to manipulate disks, > filesystems, partition tables, etc. from within a non-C-source > program. The options have been: fork/exec to some external program; > run a VM where I can mount the fs and manipulate content as needed. > Those both work, but have had issues in various environments. > > I made the mistake of saying, "well, all of this is just manipulating > bytes on a disk image or block device; how hard could it be?" :-) > So understanding the algorithm actually becomes important. I think once you take a look at all of the "byte manipulation" that is needed for any kind of non-trivial file system operation, you're probably better off trying to figure out how to link the library in. > I probably could link the library in if I am working on languages that > support it (go, rust), but not all do, and there are reasons that is > more difficult for the target use case. Have you looked at SWIG? SWIG suppotrs a *lot* of lanaguages, including Tcl, Python, Perl, Guile, Java, Ruby, Mzscheme, PHP, OCaml, C#, Lua, R, Octave, Go, D, Javascript, Scilab, etc. If you end up writing the equivalent of libext2fs for one language, it's really not going to help you all that much for another language. I also note you've not really been specific about "the target use case". Is that something you'd be willing to say more about? In any case, if you're interested in implementing SWIG bindings for libext2fs, that is certainly something we could discuss integrating into e2fsprogs, so that other people could also benefit from that work. Let me know if you're interested! - Ted