diff options
author | grembo <grembo@FreeBSD.org> | 2015-04-25 16:15:01 +0000 |
---|---|---|
committer | grembo <grembo@FreeBSD.org> | 2015-04-25 16:15:01 +0000 |
commit | 9da00f2a97fc238a88291c3bb9b68c9d911c202f (patch) | |
tree | ba84fdf08fc09b66a10a6a8cbe9cb4d12560861d /usr.sbin | |
parent | c60c12803ebf064604c76f5070edeef1202a507a (diff) | |
download | FreeBSD-src-9da00f2a97fc238a88291c3bb9b68c9d911c202f.zip FreeBSD-src-9da00f2a97fc238a88291c3bb9b68c9d911c202f.tar.gz |
Expand SMBUS API to add smbus_trans() function.
Differential Revision: https://reviews.freebsd.org/D1955
Reviewed by: adrian, jhb, wblock
Approved by: adrian, jhb
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smbmsg/smbmsg.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.sbin/smbmsg/smbmsg.c b/usr.sbin/smbmsg/smbmsg.c index 425b782..4e7e609 100644 --- a/usr.sbin/smbmsg/smbmsg.c +++ b/usr.sbin/smbmsg/smbmsg.c @@ -163,7 +163,8 @@ do_io(void) } if (iflag == 1 && oflag == -1) { /* command + 1 byte input: read byte op. */ - c.data.byte_ptr = ibuf; + c.rbuf = ibuf; + c.rcount = iflag; if (ioctl(fd, SMB_READB, &c) == -1) return (-1); printf(fmt, (int)(unsigned char)ibuf[0]); @@ -171,11 +172,12 @@ do_io(void) return (0); } else if (iflag == -1 && oflag == 1) { /* command + 1 byte output: write byte op. */ - c.data.byte = obuf[0]; + c.wdata.byte = obuf[0]; return (ioctl(fd, SMB_WRITEB, &c)); } else if (wflag && iflag == 2 && oflag == -1) { /* command + 2 bytes input: read word op. */ - c.data.word_ptr = &iword; + c.rbuf = (char*) &iword; + c.rcount = iflag; if (ioctl(fd, SMB_READW, &c) == -1) return (-1); printf(fmt, (int)(unsigned short)iword); @@ -183,15 +185,16 @@ do_io(void) return (0); } else if (wflag && iflag == -1 && oflag == 2) { /* command + 2 bytes output: write word op. */ - c.data.word = oword; + c.wdata.word = oword; return (ioctl(fd, SMB_WRITEW, &c)); } else if (wflag && iflag == 2 && oflag == 2) { /* * command + 2 bytes output + 2 bytes input: * "process call" op. */ - c.data.process.sdata = oword; - c.data.process.rdata = &iword; + c.wdata.word = oword; + c.rbuf = (char*) &iword; + c.rcount = iflag; if (ioctl(fd, SMB_PCALL, &c) == -1) return (-1); printf(fmt, (int)(unsigned short)iword); @@ -199,8 +202,8 @@ do_io(void) return (0); } else if (iflag > 1 && oflag == -1) { /* command + > 1 bytes of input: block read */ - c.data.byte_ptr = ibuf; - c.count = iflag; + c.rbuf = ibuf; + c.rcount = iflag; if (ioctl(fd, SMB_BREAD, &c) == -1) return (-1); for (i = 0; i < iflag; i++) { @@ -212,8 +215,8 @@ do_io(void) return (0); } else if (iflag == -1 && oflag > 1) { /* command + > 1 bytes of output: block write */ - c.data.byte_ptr = obuf; - c.count = oflag; + c.wbuf = obuf; + c.wcount = oflag; return (ioctl(fd, SMB_BWRITE, &c)); } |