You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During ALPSS Christoph Hellwig, @keithbusch and I had a discussion on the API. As we already experienced the 'struct args' idea to make it future proof is a bit of a hassle. First, we need to versioning the structs and figure out on execution time which version the struct args have. Second, not all function are using struct args.
Christoph suggested we should look at how the SCSI API (kernel?) is handling this. The main trick is to pass around a fixed sized buffer (as defined by the standard) and have a bunch of setters/getters, operating on the buffer. This avoids all the nasty versioning problems and is really future proof (unless the buffer needs to be made bigger but that's also an update of the spec).
/* * FC Remote Port Attributes * * This structure exists for each remote FC port that a LLDD notifies * the subsystem of. A remote FC port may or may not be a SCSI Target, * also be a SCSI initiator, IP endpoint, etc. As such, the remote * port is considered a separate entity, independent of "role" (such * as scsi target). * * -- * * Attributes are based on HBAAPI V2.0 definitions. Only those * attributes that are determinable by the local port (aka Host) * are contained. * * Fixed attributes are not expected to change. The driver is * expected to set these values after successfully calling * fc_remote_port_add(). The transport fully manages all get functions * w/o driver interaction. * * Dynamic attributes are expected to change. The driver participates * in all get/set operations via functions provided by the driver. * * Private attributes are transport-managed values. They are fully * managed by the transport w/o driver interaction. */structfc_rport { /* aka fc_starget_attrs *//* Fixed Attributes */u32maxframe_size;
u32supported_classes;
/* Dynamic Attributes */u32dev_loss_tmo; /* Remote Port loss timeout in seconds. */structfc_fpin_statsfpin_stats;
/* Private (Transport-managed) Attributes */u64node_name;
u64port_name;
...
/* exported data */void*dd_data; /* Used for driver-specific storage *//* internal data */unsigned intchannel;
u32number;
...
} __attribute__((aligned(sizeof(unsigned long))));
...
/* The functions by which the transport class and the driver communicate */structfc_function_template {
void (*get_rport_dev_loss_tmo)(structfc_rport*);
void (*set_rport_dev_loss_tmo)(structfc_rport*, u32);
void (*get_starget_node_name)(structscsi_target*);
void (*get_starget_port_name)(structscsi_target*);
...
unsigned longshow_host_system_hostname:1;
unsigned longdisable_target_scan:1;
};
During ALPSS Christoph Hellwig, @keithbusch and I had a discussion on the API. As we already experienced the 'struct args' idea to make it future proof is a bit of a hassle. First, we need to versioning the structs and figure out on execution time which version the
struct args
have. Second, not all function are usingstruct args
.Christoph suggested we should look at how the SCSI API (kernel?) is handling this. The main trick is to pass around a fixed sized buffer (as defined by the standard) and have a bunch of setters/getters, operating on the buffer. This avoids all the nasty versioning problems and is really future proof (unless the buffer needs to be made bigger but that's also an update of the spec).
Furthermore, we might be able to generate those setters/getters using https://github.com/OpenMPDK/nvme-lint
The text was updated successfully, but these errors were encountered: