On Mon, 5 Jul 2021, cinap_len...@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 via email to