On Fri, Sep 1, 2017 at 6:17 AM, Yasunori Goto <[email protected]> wrote: > > To check what feature can be called via ND_CMD_CALL, ndctl need to read > device/nfit/dsm_mask. > Since direct pointer access is not permitted, > ndctl_bus_get_nfit_dsm_mask() is created to access nfit_dsm_mask. > It is used later patch. > > Signed-off-by: Yasunori Goto <[email protected]> > --- > ndctl/lib/libndctl.c | 16 ++++++++++++++++ > ndctl/lib/libndctl.sym | 1 + > ndctl/libndctl.h.in | 1 + > 3 files changed, 18 insertions(+) > > diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c > index f52ecfe..ea37ca4 100644 > --- a/ndctl/lib/libndctl.c > +++ b/ndctl/lib/libndctl.c > @@ -104,6 +104,7 @@ struct ndctl_bus { > size_t buf_len; > char *wait_probe_path; > unsigned long dsm_mask; > + unsigned long nfit_dsm_mask; > }; > > /** > @@ -793,6 +794,12 @@ static void *add_bus(void *parent, int id, const char > *ctl_base) > bus->revision = strtoul(buf, NULL, 0); > } > > + sprintf(path, "%s/device/nfit/dsm_mask", ctl_base); > + if (sysfs_read_attr(ctx, path, buf) < 0) > + bus->nfit_dsm_mask = 0; > + else > + bus->nfit_dsm_mask = strtoul(buf, NULL, 0); > + > sprintf(path, "%s/device/provider", ctl_base); > if (sysfs_read_attr(ctx, path, buf) < 0) > goto err_read; > @@ -1048,6 +1055,15 @@ NDCTL_EXPORT int ndctl_bus_is_cmd_supported(struct > ndctl_bus *bus, > return !!(bus->dsm_mask & (1ULL << cmd)); > } > > +/* > + * This function is exported for only nfit.c. > + * Please use ndctl_bus_is_nfit_cmd_supported() in nfit.c instead. > + */ > +NDCTL_EXPORT unsigned long ndctl_bus_get_nfit_dsm_mask(struct ndctl_bus *bus) > +{ > + return bus->nfit_dsm_mask; > +}
I don't want to export the mask directly from library since we'll also have ndctl_bus_is_nfit_cmd_supported(). Let's just move struct ndctl_bus into private.h. _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
