setinfo(4) setinfo(4)
NAME
setinfo - device description language
SYNOPSIS
/etc/default/diskinfo/setinfo/*
/etc/default/tapeinfo/setinfo/*
/etc/default/raidinfo/setinfo/*
/etc/default/floppyinfo/setinfo/*
/etc/default/jukeboxinfo/setinfo/*
#include <sys/setinfo.h>
ioctl(fd, IOCSETINFO, si);
struct setinfo *si;
ioctl(fd, IOCGETINFO, si);
struct setinfo *si;
DESCRIPTION
The files:
/etc/default/diskinfo/setinfo/*
and
/etc/default/tapeinfo/setinfo/*
are a database containing device description information for
/sbin/setinfo. These files describe devices using a simple
identifier=value representation of the various data structures used by
a kernel device driver. The information is parsed by the /sbin/setinfo
command and passed to the kernel device driver using the IOCSETINFO
ioctl. The information may also be retrieved from the device driver
using the IOCGETINFO ioctl.
The identifiers recognized are device specific and are determined by a
set of tables in the kernel device driver.
The /sbin/setinfo command compiles the device description language
into a self describing data structure. struct setinfo is described in
/usr/include/sys/setinfo.h.
Page 1 Reliant UNIX 5.44 Printed 11/98
setinfo(4) setinfo(4)
EXAMPLES
A device description file for a Seagate 43400N 3.4 GB disk is:
#
# setinfo configuration file for MP88 (Seagate 43400N 3.4 GB)
#
dpflags=1
dpfastmo=20
dpslotmo=4200
dpaskey=12
dpeaskey=0
dpembytes=0
dpemstart=18
dporder=38
dpiname='SEAGATE ST43400N '
dpconfindx=1
dpmaxbusy=4
flag=0
dmspbytes=36
dmsp={0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x1,0xa,\
0xc4, 0x1b,0x0c,0x0,0x0,0x0,0x1,0x0,0xff,0xff,0x8,0xa,0x0,0x0,0x0,0x0,0x0,\
0x0,0x1, 0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,\
0x0, 0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
dktcylinders=2735
dktreserved=4
dktusercyl=2733
dktheads=21
dktsectors=99
dktbsize=512
dktgap1=0
dktgap2=0
dktrpm=5400
dktformat=0x90000
dktname='MP88'
dktclass='disk'
dktwidth=1
Here is an example of code that allocates a setinfo structure and
retrieves the data from the kernel:
#include <sys/stdio.h>
#include <sys/stddef.h>
#include <sys/setinfo.h>
/*
* Create a new setinfo or enlarge an already existing setinfo
* to match its cnt.
*/
Page 2 Reliant UNIX 5.44 Printed 11/98
setinfo(4) setinfo(4)
struct setinfo *
allocinfo(struct setinfo *si)
{
if (si)
{
si = (struct setinfo *)realloc(si,
sizeof(struct setinfo) +
si->sicnt * sizeof(struct setpair));
/*
* If we have allocated any pairs, they begin right
* after the setinfo.
*/
si->sip = (struct setpair *)(si + 1);
}
else
{
si = (struct setinfo *)malloc(sizeof(struct setinfo));
si->sip = NULL;
si->sicnt = 0;
}
if (si == NULL)
{
fprintf(stderr, "Couldn't allocate setinfo structure");
exit(1);
}
return(si);
}
/*
* Read the info currently in use for a disk.
*/
readinfo(int fd, struct setinfo **info)
{
int error = 0;
*info = allocinfo(NULL);
if (ioctl(fd, IOCGETINFO, *info))
{
fprintf(stderr, "couldn't read info header");
error = 1;
}
else
{
*info = allocinfo(*info);
memset((*info)->sip, 0,
(*info)->sicnt * sizeof(struct setpair));
if (ioctl(fd, IOCGETINFO, *info))
{
fprintf(stderr, "couldn't read info");
error = 1;
}
Page 3 Reliant UNIX 5.44 Printed 11/98
setinfo(4) setinfo(4)
}
return(error);
}
FILES
/etc/default/diskinfo/setinfo/*
/etc/default/tapeinfo/setinfo/*
/etc/default/raidinfo/setinfo/*
/etc/default/floppyinfo/setinfo/*
/etc/default/jukeboxinfo/setinfo/*
SEE ALSO
setinfo(8).
Page 4 Reliant UNIX 5.44 Printed 11/98