nasd_status_t
, and all
drive RPCs include a nasd_status_t
in their result. This
type is an all-purpose result code which can either indicate total
success of an operation, indicate failure and the nature of the cause,
or indicate some more complex status. Total success
is always indicated by NASD_SUCCESS
, which is guaranteed
to be zero.
The function nasd_error_string()
takes such a value
as input, and returns a string describing the error code verbally.
This function violates the normal NASD convention that all exported
functions return nasd_status_t
because it is expected
that its primary use will be calls within calls to printf()
.
This function is always guaranteed to return a valid C string, but
if the input value is garbage, the string may be uninformative.
For example:
nasd_error.idl
include/nasd/nasd_error.idl
.
The result codes are broken into several ranges (note that these ranges
may be redefined without warning; users of the API are not guaranteed
that these ranges are meaningful):
Range | Reserved for |
---|---|
0.999 | Codes that may be returned by drive operations |
1000.4999 | Errors returned by local libraries or modules |
5000.9999 | Errors returned by modules within the drive (code outside the drive should never see or use these) |
10000+ | Reserved for filesystems and applications built on NASD |
Error codes are added as follows:
nasd_error.c
nasd_error.idl
, it is important
to make nasd_error_string()
aware of how to translate this error
to informative text. Do this by adding a translation entry to the location within
nasd_error_string()
(found in common/nasd_error.c
which corresponds to the same ordering and location
your new error code occupies in nasd_error.idl
. For example:
![]() | ![]() | ![]() |
---|---|---|
Output | Modules | NASD Programmer's Documentation |