-/**
- * canque_get_inslot4id_wait_kern - find or wait for best outgoing edge and slot for given ID
- * @qends: ends structure belonging to calling communication object
- * @qedgep: place to store pointer to found edge
- * @slotp: place to store pointer to allocated slot
- * @cmd: command type for slot
- * @id: communication ID of message to send into edge
- * @prio: optional priority of message
- *
- * Same as canque_get_inslot4id(), except, that it waits for free slot
- * in case, that queue is full. Function is specific for Linux userspace clients.
- * Return Value: If there is no usable edge negative value is returned.
- */
-int canque_get_inslot4id_wait_kern(struct canque_ends_t *qends,
- struct canque_edge_t **qedgep, struct canque_slot_t **slotp,
- int cmd, unsigned long id, int prio)
-{
- int ret=-1;
- DEBUGQUE("canque_get_inslot4id_wait_kern for cmd %d, id %ld, prio %d\n",cmd,id,prio);
- wait_event_interruptible((qends->endinfo.fileinfo.writeq),
- (ret=canque_get_inslot4id(qends,qedgep,slotp,cmd,id,prio))!=-1);
- return ret;
-}
-
-/**
- * canque_get_outslot_wait_kern - receive or wait for ready slot for given ends
- * @qends: ends structure belonging to calling communication object
- * @qedgep: place to store pointer to found edge
- * @slotp: place to store pointer to received slot
- *
- * The same as canque_test_outslot(), except it waits in the case, that there is
- * no ready slot for given ends. Function is specific for Linux userspace clients.
- * Return Value: Negative value informs, that there is no ready output
- * slot for given ends. Positive value is equal to the command
- * slot has been allocated by the input side.
- */
-int canque_get_outslot_wait_kern(struct canque_ends_t *qends,
- struct canque_edge_t **qedgep, struct canque_slot_t **slotp)
-{
- int ret=-1;
- DEBUGQUE("canque_get_outslot_wait_kern\n");
- wait_event_interruptible((qends->endinfo.fileinfo.readq),
- (ret=canque_test_outslot(qends,qedgep,slotp))!=-1);
- return ret;
-}
-
-/**
- * canque_sync_wait_kern - wait for all slots processing
- * @qends: ends structure belonging to calling communication object
- * @qedge: pointer to edge
- *
- * Functions waits for ends transition into empty state.
- * Return Value: Positive value indicates, that edge empty state has been reached.
- * Negative or zero value informs about interrupted wait or other problem.
- */
-int canque_sync_wait_kern(struct canque_ends_t *qends, struct canque_edge_t *qedge)
-{
- int ret=-1;
- DEBUGQUE("canque_sync_wait_kern\n");
- wait_event_interruptible((qends->endinfo.fileinfo.emptyq),
- (ret=canque_fifo_test_fl(&qedge->fifo,EMPTY)?1:0));
- return ret;
-}
-
-
-/**
- * canque_new_edge_kern - allocate new edge structure in the Linux kernel context
- * @slotsnr: required number of slots in the newly allocated edge structure
- *
- * Return Value: Returns pointer to allocated slot structure or %NULL if
- * there is not enough memory to process operation.
- */
-struct canque_edge_t *canque_new_edge_kern(int slotsnr)
-{
- struct canque_edge_t *qedge;
- qedge = (struct canque_edge_t *)kmalloc(sizeof(struct canque_edge_t), GFP_KERNEL);
- if(qedge == NULL) return NULL;
-
- memset(qedge,0,sizeof(struct canque_edge_t));
- spin_lock_init(&qedge->fifo.fifo_lock);
- if(canque_fifo_init_slots(&qedge->fifo, slotsnr)<0){
- kfree(qedge);
- DEBUGQUE("canque_new_edge_kern failed\n");
- return NULL;
- }
- atomic_set(&qedge->edge_used,0);
- qedge->filtid = 0;
- qedge->filtmask = canque_filtid2internal(0l, (processlocal<2)? MSG_LOCAL:0);
- qedge->edge_prio = 0;
- #ifdef CAN_DEBUG
- /* not exactly clean, but enough for debugging */
- atomic_inc(&edge_num_cnt);
- qedge->edge_num=atomic_read(&edge_num_cnt);
- #endif /* CAN_DEBUG */
- DEBUGQUE("canque_new_edge_kern %d\n",qedge->edge_num);
- return qedge;
-}
-