drivers/s390/scsi/zfcp_reqlist.h
Source file repositories/reference/linux-study-clean/drivers/s390/scsi/zfcp_reqlist.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/scsi/zfcp_reqlist.h- Extension
.h- Size
- 5490 bytes
- Lines
- 215
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct zfcp_reqlistfunction zfcp_reqlist_hashfunction zfcp_reqlist_isemptyfunction zfcp_reqlist_freefunction _zfcp_reqlist_findfunction zfcp_reqlist_findfunction zfcp_reqlist_find_rmfunction zfcp_reqlist_addfunction zfcp_reqlist_movefunction table
Annotated Snippet
struct zfcp_reqlist {
spinlock_t lock;
struct list_head buckets[ZFCP_REQ_LIST_BUCKETS];
};
static inline size_t zfcp_reqlist_hash(u64 req_id)
{
return req_id % ZFCP_REQ_LIST_BUCKETS;
}
/**
* zfcp_reqlist_alloc - Allocate and initialize reqlist
*
* Returns pointer to allocated reqlist on success, or NULL on
* allocation failure.
*/
static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
{
size_t i;
struct zfcp_reqlist *rl;
rl = kzalloc_obj(struct zfcp_reqlist);
if (!rl)
return NULL;
spin_lock_init(&rl->lock);
for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
INIT_LIST_HEAD(&rl->buckets[i]);
return rl;
}
/**
* zfcp_reqlist_isempty - Check whether the request list empty
* @rl: pointer to reqlist
*
* Returns: 1 if list is empty, 0 if not
*/
static inline int zfcp_reqlist_isempty(struct zfcp_reqlist *rl)
{
size_t i;
for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
if (!list_empty(&rl->buckets[i]))
return 0;
return 1;
}
/**
* zfcp_reqlist_free - Free allocated memory for reqlist
* @rl: The reqlist where to free memory
*/
static inline void zfcp_reqlist_free(struct zfcp_reqlist *rl)
{
/* sanity check */
BUG_ON(!zfcp_reqlist_isempty(rl));
kfree(rl);
}
static inline struct zfcp_fsf_req *
_zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
{
struct zfcp_fsf_req *req;
size_t i;
i = zfcp_reqlist_hash(req_id);
list_for_each_entry(req, &rl->buckets[i], list)
if (req->req_id == req_id)
return req;
return NULL;
}
/**
* zfcp_reqlist_find - Lookup FSF request by its request id
* @rl: The reqlist where to lookup the FSF request
* @req_id: The request id to look for
*
* Returns a pointer to the FSF request with the specified request id
* or NULL if there is no known FSF request with this id.
*/
static inline struct zfcp_fsf_req *
zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
{
unsigned long flags;
struct zfcp_fsf_req *req;
spin_lock_irqsave(&rl->lock, flags);
req = _zfcp_reqlist_find(rl, req_id);
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct zfcp_reqlist`, `function zfcp_reqlist_hash`, `function zfcp_reqlist_isempty`, `function zfcp_reqlist_free`, `function _zfcp_reqlist_find`, `function zfcp_reqlist_find`, `function zfcp_reqlist_find_rm`, `function zfcp_reqlist_add`, `function zfcp_reqlist_move`, `function table`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.