func: static sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) void __user * p = ( void __user * ) arg ; int result , val , read_only ; Sg_device * sdp ; Sg_fd * sfp ; if ( ( ! ( sfp = ( Sg_fd * ) filp -> private_data ) ) || ( ! ( sdp = sfp -> parentdp ) ) )  read_only = ( O_RDWR != ( filp -> f_flags & O_ACCMODE ) ); switch ( cmd_in )  if ( atomic_read ( & sdp -> detaching ) )  if ( ! scsi_block_when_processing_errors ( sdp -> device ) )  if ( ! access_ok ( VERIFY_WRITE , p , SZ_SG_IO_HDR ) )  result = sg_new_write ( sfp , filp , p , SZ_SG_IO_HDR , 1 , read_only , 1 , & srp ); static sg_new_write(Sg_fd *sfp, struct file *file, const char __user size_t count, int blocking, int read_only, int Sg_request **o_srp) Sg_request * srp ; if ( count < SZ_SG_IO_HDR )  if ( ! access_ok ( VERIFY_READ , buf , count ) )  sfp -> cmd_q = 1; if ( ! ( srp = sg_add_request ( sfp ) ) )  static Sg_request sg_add_request(Sg_fd * sfp) int k ; Sg_request * resp ; Sg_request * rp = sfp -> req_arr ; resp = sfp -> headrp; if ( ! resp )  if ( 0 == sfp -> cmd_q )  if ( k < SG_MAX_QUEUE )  memset ( rp , 0 , sizeof ( Sg_request ) ); rp -> parentfp = sfp; resp -> nextrp = rp; resp = rp; if ( resp )  resp -> nextrp = NULL; resp -> header . duration = jiffies_to_msecs ( jiffies ); return resp ; 