brintos

brintos / linux-shallow public Read only

0
0
Text · 3.4 KiB · cb51379 Raw
105 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 *  linux/drivers/acorn/scsi/queue.h: queue handling4 *5 *  Copyright (C) 1997 Russell King6 */7#ifndef QUEUE_H8#define QUEUE_H9 10typedef struct {11	struct list_head head;12	struct list_head free;13	spinlock_t queue_lock;14	void *alloc;			/* start of allocated mem */15} Queue_t;16 17/*18 * Function: void queue_initialise (Queue_t *queue)19 * Purpose : initialise a queue20 * Params  : queue - queue to initialise21 */22extern int queue_initialise (Queue_t *queue);23 24/*25 * Function: void queue_free (Queue_t *queue)26 * Purpose : free a queue27 * Params  : queue - queue to free28 */29extern void queue_free (Queue_t *queue);30 31/*32 * Function: struct scsi_cmnd *queue_remove (queue)33 * Purpose : removes first SCSI command from a queue34 * Params  : queue   - queue to remove command from35 * Returns : struct scsi_cmnd if successful (and a reference), or NULL if no command available36 */37extern struct scsi_cmnd *queue_remove (Queue_t *queue);38 39/*40 * Function: struct scsi_cmnd *queue_remove_exclude_ref (queue, exclude)41 * Purpose : remove a SCSI command from a queue42 * Params  : queue   - queue to remove command from43 *	     exclude - array of busy LUNs44 * Returns : struct scsi_cmnd if successful (and a reference), or NULL if no command available45 */46extern struct scsi_cmnd *queue_remove_exclude(Queue_t *queue,47					      unsigned long *exclude);48 49#define queue_add_cmd_ordered(queue,SCpnt) \50	__queue_add(queue,SCpnt,(SCpnt)->cmnd[0] == REQUEST_SENSE)51#define queue_add_cmd_tail(queue,SCpnt) \52	__queue_add(queue,SCpnt,0)53/*54 * Function: int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head)55 * Purpose : Add a new command onto a queue56 * Params  : queue - destination queue57 *	     SCpnt - command to add58 *	     head  - add command to head of queue59 * Returns : 0 on error, !0 on success60 */61extern int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head);62 63/*64 * Function: struct scsi_cmnd *queue_remove_tgtluntag (queue, target, lun, tag)65 * Purpose : remove a SCSI command from the queue for a specified target/lun/tag66 * Params  : queue  - queue to remove command from67 *	     target - target that we want68 *	     lun    - lun on device69 *	     tag    - tag on device70 * Returns : struct scsi_cmnd if successful, or NULL if no command satisfies requirements71 */72extern struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target,73						int lun, int tag);74 75/*76 * Function: queue_remove_all_target(queue, target)77 * Purpose : remove all SCSI commands from the queue for a specified target78 * Params  : queue  - queue to remove command from79 *           target - target device id80 * Returns : nothing81 */82extern void queue_remove_all_target(Queue_t *queue, int target);83 84/*85 * Function: int queue_probetgtlun (queue, target, lun)86 * Purpose : check to see if we have a command in the queue for the specified87 *	     target/lun.88 * Params  : queue  - queue to look in89 *	     target - target we want to probe90 *	     lun    - lun on target91 * Returns : 0 if not found, != 0 if found92 */93extern int queue_probetgtlun (Queue_t *queue, int target, int lun);94 95/*96 * Function: int queue_remove_cmd (Queue_t *queue, struct scsi_cmnd *SCpnt)97 * Purpose : remove a specific command from the queues98 * Params  : queue - queue to look in99 *	     SCpnt - command to find100 * Returns : 0 if not found101 */102int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt);103 104#endif /* QUEUE_H */105