* [9fans] 9P1 clients?
@ 2004-08-10 1:52 geoff
2004-08-10 4:58 ` geoff
0 siblings, 1 reply; 3+ messages in thread
From: geoff @ 2004-08-10 1:52 UTC (permalink / raw)
To: 9fans
Hmm, no answer on plan9dev, so I'll try here⋯
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⁶ 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 size */
X#include <u.h>
X#include <libc.h>
static int
iswritablebyte(vlong offset)
X{
X char c;
X return seek(1, offset, 0) >= 0 && write(1, &c, 1) == 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 = 0;
X uvlong low = 0, high = ~0ULL, new = 0;
X ARGBEGIN {
X case 'v':
X verbose = 1;
X break;
X default:
X fprint(2, "usage: %s >junkfile\n", argv0);
X exits("usage");
X } ARGEND;
X while (low <= high){
X new = (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 = new + 1;
X else
X high = 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}
!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] 9P1 clients?
2004-08-10 1:52 [9fans] 9P1 clients? geoff
@ 2004-08-10 4:58 ` geoff
2004-08-10 10:34 ` Russ Cox
0 siblings, 1 reply; 3+ messages in thread
From: geoff @ 2004-08-10 4:58 UTC (permalink / raw)
To: 9fans
Don't run 9fslimits on a file system that doesn't support sparse files
(holes). Andrey ran it on fossil and it's apparently made fossil
misbehave.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] 9P1 clients?
2004-08-10 4:58 ` geoff
@ 2004-08-10 10:34 ` Russ Cox
0 siblings, 0 replies; 3+ messages in thread
From: Russ Cox @ 2004-08-10 10:34 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
fossil should have no problem with sparse files.
russ
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-08-10 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 1:52 [9fans] 9P1 clients? geoff
2004-08-10 4:58 ` geoff
2004-08-10 10:34 ` Russ Cox
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).