From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Date: Mon, 9 Aug 2004 18:52:07 -0700 From: geoff@collyer.net MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Subject: [9fans] 9P1 clients? Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: d386bf9c-eacd-11e9-9e20-41e7f4b1d025 Hmm, no answer on plan9dev, so I'll try here=E2=8B=AF Does anybody still have 9P1 clients (other than drawterm, which we have 9P2000 versions of now)? I ask because I've got a version of Ken's file server that uses 64-bit file sizes, offsets and block numbers. It works just fine, but 9P1 isn't a great fit, since some of the relevant fields are only 32 bits wide (e.g., qid.path). Incidentally, here's a program to find the largest file size possible on a given file system empirically. With a 4kB block size and triple-indirect blocks on my 63-bit file server, it prints 542,811,039,744 (5.42811e+11) which matches the theoretical limit. Quadruple-indirect blocks may be called for to reach 2=E2=81=B6=E2=81=B3 bytes. # To unbundle, run this file echo 9fslimit.c sed 's/^X//' >9fslimit.c <<'!' X/* 9fslimit >tempfile - perform a binary search to find largest file siz= e */ X#include X#include static int iswritablebyte(vlong offset) X{ X char c; X return seek(1, offset, 0) >=3D 0 && write(1, &c, 1) =3D=3D 1; X} static int islastbyte(vlong offset) X{ X return iswritablebyte(offset) && !iswritablebyte(offset+1); X} X/* X * sometimes limits are near powers of 2, but sometimes they are X * determined by file system structure (e.g., indirect blocks). X */ void main(int argc, char **argv) X{ X int verbose =3D 0; X uvlong low =3D 0, high =3D ~0ULL, new =3D 0; X ARGBEGIN { X case 'v': X verbose =3D 1; X break; X default: X fprint(2, "usage: %s >junkfile\n", argv0); X exits("usage"); X } ARGEND; X while (low <=3D high){ X new =3D (high + low)/2; X if (verbose) X fprint(2, "new guess: %,lld\n", new); X if (islastbyte(new)) X break; X if (iswritablebyte(new)) X low =3D new + 1; X else X high =3D new - 1; X } X if (low > high) X fprint(2, "failed to converge\n"); X else { X /* X * new is last possible offset with zero-origin, so add 1 to X * get size. X */ X ++new; X fprint(2, "%,lld (%g)\n", new, (double)new); X } X exits(0); X} !