Project

General

Profile

Actions

Bug #1279

closed

vnconfig: unintuitive error message

Added by corecode almost 16 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

If you forget to specify the filename, vnconfig reports a totally bogus error
message:

  1. vnconfig -s labels -c vn0
    vnconfig: VNIOCATTACH: Numerical argument out of domain
Actions #1

Updated by Anonymous almost 16 years ago

: If you forget to specify the filename, vnconfig reports a totally bogus error
: message:
:
: # vnconfig -s labels -c vn0
: vnconfig: VNIOCATTACH: Numerical argument out of domain

If you don't specify a filename, the code assumes that you want to use a swap
backing store. And since you haven't specified a size via -S, vniocattach_swap()
returns EDOM, which corresponds to "Numerical argument out of domain".

Perhaps make vnconfig print an error:
"Either specify a regular filename or the size of a swap backing store via -S" ?

Cheers,
Stathis

Actions #2

Updated by Anonymous almost 16 years ago

Patch in:
http://stathisk.ath.cx/patches/dragonflybsd/vnconfig

Please review. My tests:

[root@sadness ~] vnconfig -l vn0
vn0: not in use
[root@sadness ~] vnconfig vn0
Specify regular filename or swap size via -S
[root@sadness ~] vnconfig -S10m vn0
[root@sadness ~] vnconfig -l vn0
vn0: consuming 2560 VM pages
[root@sadness ~] vnconfig -u vn0
[root@sadness ~] vnconfig vn0 lala.img
[root@sadness ~] vnconfig -l vn0
vn0: covering /root/lala.img on #B116:0x40000, inode 16289
[root@sadness ~] vnconfig -u vn0
[root@sadness ~] vnconfig -s labels -c vn0
Specify regular filename or swap size via -S
[root@sadness ~] vnconfig -s labels -S10m -c vn0
[root@sadness ~] vnconfig -l vn0
vn0: consuming 2560 VM pages
[root@sadness ~] vnconfig -u vn0
[root@sadness ~] vnconfig -T -S10m -c vn0 doesntexist.img
[root@sadness ~] vnconfig -l vn0
vn0: covering /root/doesntexist.img on #B116:0x40000, inode 16353
[root@sadness ~] vnconfig -u vn0
[root@sadness ~] vnconfig -S10m vn0
[root@sadness ~] vnconfig vn1
Specify regular filename or swap size via -S
[root@sadness ~] vnconfig vn1 lala.img
[root@sadness ~] vnconfig -l
vn0: consuming 2560 VM pages
vn1: covering /root/lala.img on #B116:0x40000, inode 16289
[root@sadness ~]

Cheers,
Stathis

Actions #3

Updated by Anonymous almost 16 years ago

: Perhaps make vnconfig print an error:
: "Either specify a regular filename or the size of a swap backing store via :
-S" ?

I omitted the -S flag to avoid ambiguity from the user point of view (ie, does
-S refer to swap size or filename also?) based on discussion at #dragonflybsd.
Also I switched printf() to warnx().

Patch in, as before:
http://stathisk.ath.cx/patches/dragonflybsd/vnconfig

Cheers,
Stathis

Actions #4

Updated by swildner almost 16 years ago

Committed, thanks!

Actions

Also available in: Atom PDF