Blame view

include/linux/bsg-lib.h 1.7 KB
a497ee34a   Christoph Hellwig   block: switch all...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
aa387cc89   Mike Christie   block: add bsg he...
2
3
4
5
6
7
  /*
   *  BSG helper library
   *
   *  Copyright (C) 2008   James Smart, Emulex Corporation
   *  Copyright (C) 2011   Red Hat, Inc.  All rights reserved.
   *  Copyright (C) 2011   Mike Christie
aa387cc89   Mike Christie   block: add bsg he...
8
9
10
11
12
   */
  #ifndef _BLK_BSG_
  #define _BLK_BSG_
  
  #include <linux/blkdev.h>
50b4d4855   Benjamin Block   bsg-lib: fix kern...
13
  #include <scsi/scsi_request.h>
aa387cc89   Mike Christie   block: add bsg he...
14
15
16
17
18
  
  struct request;
  struct device;
  struct scatterlist;
  struct request_queue;
1028e4b33   Jens Axboe   bsg: move bsg-lib...
19
20
  typedef int (bsg_job_fn) (struct bsg_job *);
  typedef enum blk_eh_timer_return (bsg_timeout_fn)(struct request *);
aa387cc89   Mike Christie   block: add bsg he...
21
22
23
24
25
26
27
28
  struct bsg_buffer {
  	unsigned int payload_len;
  	int sg_cnt;
  	struct scatterlist *sg_list;
  };
  
  struct bsg_job {
  	struct device *dev;
aa387cc89   Mike Christie   block: add bsg he...
29

bf0f2d380   Johannes Thumshirn   block: add refere...
30
  	struct kref kref;
31156ec37   Christoph Hellwig   bsg-lib: introduc...
31
  	unsigned int timeout;
aa387cc89   Mike Christie   block: add bsg he...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  	/* Transport/driver specific request/reply structs */
  	void *request;
  	void *reply;
  
  	unsigned int request_len;
  	unsigned int reply_len;
  	/*
  	 * On entry : reply_len indicates the buffer size allocated for
  	 * the reply.
  	 *
  	 * Upon completion : the message handler must set reply_len
  	 *  to indicates the size of the reply to be returned to the
  	 *  caller.
  	 */
  
  	/* DMA payloads for the request/response */
  	struct bsg_buffer request_payload;
  	struct bsg_buffer reply_payload;
17cb960f2   Christoph Hellwig   bsg: split handli...
50
51
  	int result;
  	unsigned int reply_payload_rcv_len;
972248e91   Christoph Hellwig   scsi: bsg-lib: ha...
52
53
54
  	/* BIDI support */
  	struct request *bidi_rq;
  	struct bio *bidi_bio;
aa387cc89   Mike Christie   block: add bsg he...
55
56
57
58
59
  	void *dd_data;		/* Used for driver-specific storage */
  };
  
  void bsg_job_done(struct bsg_job *job, int result,
  		  unsigned int reply_payload_rcv_len);
c1225f01a   Christoph Hellwig   scsi: bsg-lib: pa...
60
  struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
1028e4b33   Jens Axboe   bsg: move bsg-lib...
61
  		bsg_job_fn *job_fn, bsg_timeout_fn *timeout, int dd_job_size);
5e28b8d8a   Jens Axboe   bsg: provide bsg_...
62
  void bsg_remove_queue(struct request_queue *q);
fb6f7c8d8   Johannes Thumshirn   block: add bsg_jo...
63
64
  void bsg_job_put(struct bsg_job *job);
  int __must_check bsg_job_get(struct bsg_job *job);
aa387cc89   Mike Christie   block: add bsg he...
65
66
  
  #endif