Re: [tpmdd-devel] Re: [PATCH 1/1] tpm: update tpm sysfs file ownership - updated version

Kylene Hall
2005-02-10T15:40:42Z

On Wed, 2005-02-09 at 16:04, Chris Wright wrote:
> > +#define TPM_DEVICE_ATTRS { \
> > + __ATTR(pubek, S_IRUGO, show_pubek, NULL), \
> > + __ATTR(pcrs, S_IRUGO, show_pcrs, NULL), \
> > + __ATTR(caps, S_IRUGO, show_caps, NULL), \
> > + __ATTR(cancel, S_IWUSR | S_IWGRP, NULL, store_cancel) }
>
> This doesn't look like the right way to go.
>
> > +
> > struct tpm_chip;
> >
> > struct tpm_vendor_specific {
> > @@ -42,6 +54,7 @@ struct tpm_vendor_specific {
> > void (*cancel) (struct tpm_chip *);
> > u8 (*status) (struct tpm_chip *);
> > struct miscdevice miscdev;
> > + struct device_attribute attr[TPM_NUM_ATTR];
>
> So every device will have the same attrs? If so, make that whole struct
> exported (not the individual show/store methods) and reference that in
> each driver.
>
They are all the same except they have a different owner. What I was
trying to do was have them initialized in the tpm specific drivers so
that the attribute ownership would be correct but then create them in
the generic driver since that was common to all the specific drivers. I
could have one copy of the attributes like the one in the mm tree now
and change the owner when ever I want to add or remove the attribute.
Would that be correct?

Thanks,
Kylie

> thanks,
> -chris