Print this page
11544 ofmt(3OFMT) should talk about the callback handler
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>

*** 9,20 **** .\" http://www.illumos.org/license/CDDL. .\" .\" .\" Copyright 2010 Sun Microsystems, Inc. All rights reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" ! .Dd June 1, 2017 .Dt OFMT 3OFMT .Os .Sh NAME .Nm ofmt_open , .Nm ofmt_print , --- 9,21 ---- .\" http://www.illumos.org/license/CDDL. .\" .\" .\" Copyright 2010 Sun Microsystems, Inc. All rights reserved. .\" Copyright 2017 Nexenta Systems, Inc. + .\" Copyright 2018 Joyent, Inc. .\" ! .Dd December 20, 2018 .Dt OFMT 3OFMT .Os .Sh NAME .Nm ofmt_open , .Nm ofmt_print ,
*** 156,168 **** .Pp .Va of_cb is the application-specified callback function with the following prototype that provides a string representation of the value to be printed for the field: .Bd -literal -offset indent ! (*of_cb)(ofmt_arg_t *ofmt_arg, char *buf, uint_t bufsize) .Ed .Pp The interpretation of the .Va of_id field is completely private to the caller, and can be optionally used by the callback function as a cookie to identify the field being printed when a single callback function is shared between multiple --- 157,181 ---- .Pp .Va of_cb is the application-specified callback function with the following prototype that provides a string representation of the value to be printed for the field: .Bd -literal -offset indent ! boolean_t (*of_cb)(ofmt_arg_t *ofmt_arg, char *buf, uint_t bufsize) .Ed .Pp + The callback must not write beyond + .Fa bufsize + bytes of the string form into + .Fa buf . + If the function successfully translates the field into its string + representation and places it into + .Fa buf , + then the callback function should return + .Dv B_TRUE . + Otherwise, the callback function should return + .Dv B_FALSE . + .Pp The interpretation of the .Va of_id field is completely private to the caller, and can be optionally used by the callback function as a cookie to identify the field being printed when a single callback function is shared between multiple