On Wed, 25 Aug 2010, Blue Swirl wrote: > On Wed, Aug 25, 2010 at 4:33 PM, Andreas Niederl > <andreas.nied...@iaik.tugraz.at> wrote: > > This implementation is based on the TPM 1.2 interface for virtualized TPM > > devices from the Xen-4.0.0 ioemu-qemu-xen fork. > > > > A separate thread is used for I/O to the host TPM device because the Linux > > TPM > > driver does not allow for non-blocking I/O. > > > > Signed-off-by: Andreas Niederl <andreas.nied...@iaik.tugraz.at> > > In general, please read CODING_STYLE. > > Ideally, the host and guest devices should be decoupled so that the > guest visible device should still be functional without host TPM > support. > > > ---
[..snip..] > > +static inline uint32_t tpm_get_size_from_buffer(const uint8_t *buffer) > > +{ > > + uint32_t len = (buffer[4] << 8) + buffer[5]; > > + return len; > > +} > > + > > +static inline uint8_t locality_from_addr(target_phys_addr_t addr) > > +{ > > + return (uint8_t)((addr >> 12) & 0x7); > > +} > > + > > + > > +static void die2(int err, const char *what) > > +{ > > + fprintf(stderr, "%s failed: %s\n", what, strerror(err)); > > + abort(); > > +} > > + > > +static void die(const char *what) > > +{ > > + die2(errno, what); > > +} > > There's hw_error() and errx(), no need to reinvent the wheel. Since it looks as if this code was based on mine, i take issues with your analysis. Firstly hw_error is for hardware errors and does not print message corresponding to errno code and lastly there is no errx[1] [..snip..] [1] err(3): CONFORMING TO These functions are non-standard BSD extensions. -- mailto:av1...@comtv.ru