9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] mkfs
@ 2021-07-05 14:23 adr via 9fans
  2021-07-05 19:24 ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: adr via 9fans @ 2021-07-05 14:23 UTC (permalink / raw)
  To: 9fans

Hi,

I was hacking libdisk/proto.c to accept quoted strings, when I
noticed that mkfs is not using libdisk.h. The problem modifying
mkfs.c is that the code taking care of kfs obliges me to keep
functions duplicated on proto.c. The easiest solution is to remove
kfs support and just extract protoenum() from copyfile(). Other
approach is to make these functions needed by the kfs code available
at disk.h, another one is to keep mkfs.c as it is for compatibility
and clone another program, mktree without mkfs support and using
disk.h.

I'd like to be as compatible with the labs|9legacy distribution as
possible, without breaking things other people can be using.

Some thoughts from users?

adr.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] mkfs
  2021-07-05 14:23 [9fans] mkfs adr via 9fans
@ 2021-07-05 19:24 ` cinap_lenrek
  2021-07-07 17:47   ` adr via 9fans
  0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2021-07-05 19:24 UTC (permalink / raw)
  To: 9fans

> The easiest solution is to remove kfs support and just extract
> protoenum() from copyfile().

thats what we did in 9front (just so you dont need to do it all
over again in case you commit to that approach).

--
cinap

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] mkfs
  2021-07-05 19:24 ` cinap_lenrek
@ 2021-07-07 17:47   ` adr via 9fans
  0 siblings, 0 replies; 3+ messages in thread
From: adr via 9fans @ 2021-07-07 17:47 UTC (permalink / raw)
  To: 9fans

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-07 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 14:23 [9fans] mkfs adr via 9fans
2021-07-05 19:24 ` cinap_lenrek
2021-07-07 17:47   ` adr via 9fans

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).