venti/fmtarenas: can't determine size of partition

16 views
Skip to first unread message

ashley

unread,
Jun 15, 2024, 12:02:22 PM (4 days ago) Jun 15
to plan9p...@googlegroups.com
hey folks,

I'm running plan9port on OpenBSD and would like to format sd1f as
a venti arena partition, which fails with the following error:

% venti/fmtarenas foo /dev/sd1f
venti/fmtarenas: can't open partition /dev/sd1f: can't determine size of partition /dev/sd1f

I'd hazard a guess that venti is trying to fstat sd1f since plan9
provides more uniform file abstractions for this sort of thing, but
that's not possible in OpenBSD as far as I'm aware.

formatting a disk file filled with zeros works fine. indeed I suppose
I could just format all of sd1 as an OpenBSD filesystem and use it
as a sort of glorified block allocator for my venti files, but that
sounds very wasteful. I'd appreciate any advice.

thanks in advance,
ashley

Russ Cox

unread,
Jun 15, 2024, 12:35:50 PM (4 days ago) Jun 15
to ash...@tilde.institute, plan9p...@googlegroups.com
Hi Ashley,

The plan9port C library tries to emulate Plan 9's disk device behavior, namely that stat shows the actual disk size. The code is in $PLAN9/src/lib9/_p9dir.c in the function disksize. It sounds like maybe the OpenBSD version needs an update.

Best,
Russ

ashley

unread,
Jun 15, 2024, 9:47:18 PM (4 days ago) Jun 15
to plan9p...@googlegroups.com
(forgot to cc the list, my bad)

hi russ,

I believe the problem is in the S_ISCHR check, which is presumably intended to
weed out character devices, but actually does the opposite. erasing the negation
seems to fix the issue.

ashley

@@ -51,7 +51,7 @@ disksize(int fd, struct stat *st)
struct disklabel lab;
int n;

- if(!S_ISCHR(st->st_mode))
+ if(S_ISCHR(st->st_mode))
return 0;
if(ioctl(fd, DIOCGDINFO, &lab) < 0)
return 0;


Russ Cox

unread,
Jun 15, 2024, 10:22:33 PM (4 days ago) Jun 15
to ashley, plan9port-dev
Fixed, thanks! 

Reply all
Reply to author
Forward
0 new messages