9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "adr via 9fans" <9fans@9fans.net>
To: 9fans@9fans.net
Subject: Re: [9fans] mkfs
Date: Wed, 7 Jul 2021 17:47:30 +0000 (UTC)	[thread overview]
Message-ID: <514244e5-a8d-e8e0-4558-89ecde5714c3@SDF.ORG> (raw)
In-Reply-To: <61931DE5C7AAEE06877D7B57B15B95FE@felloff.net>

On Mon, 5 Jul 2021, cinap_lenrek@felloff.net wrote:
> thats what we did in 9front (just so you dont need to do it all
> over again in case you commit to that approach).

Maybe you are interested in this then. The default bsize and the
"-8" thing is only for kfs as Erik Quanstrom noticed here (I miss
this guy on the list...)

https://www.mail-archive.com/9fans@9fans.net/msg31636.html

I've experimented and in my case too 8192 is the best value.

You don't need these variables any more:

int     sfd;
int     setuid;                 /* on Fs: set uid and gid? */
char    *user;

You can delete the assignments and the code related to options that use them.

In your code, it seem that option '-a' can be used after '-d', I
just reused the variable i like this:

        i = 0;
        ARGBEGIN{
        case 'a':
                if(i == 1) {
                        fprint(2, "cannot use -a with -d\n");
                        usage();
                }
                fskind = Archive;
                newroot = "";
                Binits(&bout, 1, OWRITE, boutbuf, sizeof boutbuf);
                break;
        case 'd':
                if(fskind == Archive) {
                        fprint(2, "cannot use -d with -a\n");
                        usage();
                }
                i = 1;
                fskind = Fs;
                newroot = ARGF();
                break;

I got frustrated with proto.c. The implementation doesn't much the
description in proto(2) and the way recursion is exploited makes it
hard to fix it. Instead of rethinking the implementation, the code
has been extracted from mkfs.c and hacked to make it work when is
needed. There are places like "lets put a '\' here and see what
happens..." Files in the 4th field only work when the path matches
the source path, not the namespace as said in the manual. You can't
use files in the dest root directly as in

1 - - - /tmp/a/z/1

With the version using proto.c it works (only if the src is /!)
but I don't know if it is for the changes I made, you can test it
with yours.

I don't like how the interface is done. I would prefer something
simpler, for example call a function giving proto file, position
on the proto file, a structure for the new file with its permissions,
owner, etc, a place to store the source path and may be flags for
operations where performance can be improved, like copying entire
directories. This function could return the position of the next
entry in the proto file. Functions to do common operations, like
copying entire directories could be provided in disk.h.

Sorry for the runt,
adr.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te2c67c4bc489fa54-Ma488a88e1c7c138aa329464a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

      reply	other threads:[~2021-07-07 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 14:23 adr via 9fans
2021-07-05 19:24 ` cinap_lenrek
2021-07-07 17:47   ` adr via 9fans [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=514244e5-a8d-e8e0-4558-89ecde5714c3@SDF.ORG \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).