FreeBSD/sys/ofed/drivers/infiniband/core/uverbs_main.c
/*
 * Look up a completion event file by FD.  If lookup is successful,
 * takes a ref to the event file struct that it returns; if
 * unsuccessful, returns NULL.
 */
Look up a completion event file by FD.  If lookup is successful,
takes a ref to the event file struct that it returns; if
unsuccessful, returns NULL.
Look up a completion event file by FD . If lookup is successful takes a ref to the event file struct that it returns ; if unsuccessful returns NULL .
struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd)
{
	struct ib_uverbs_event_file *ev_file = NULL;
	struct fd f = fdget(fd);
	if (!f.file)
		return NULL;
	if (f.file->f_op != &uverbs_event_fops)
		goto out;
	ev_file = f.file->private_data;
	if (ev_file->is_async) {
		ev_file = NULL;
		goto out;
	}
	kref_get(&ev_file->ref);
out:
	fdput(f);
	return ev_file;
}
struct ib_uverbs_event_file * ib_uverbs_lookup_comp_file ( int fd ) { struct ib_uverbs_event_file * ev_file = NULL ; struct fd f = fdget ( fd ) ; if ( ! f . file ) return NULL ; if ( f . file -> f_op != & uverbs_event_fops ) goto out ; ev_file = f . file -> private_data ; if ( ev_file -> is_async ) { ev_file = NULL ; goto out ; } kref_get ( & ev_file -> ref ) ; out : fdput ( f ) ; return ev_file ; }
Look up a completion event file by FD.
Look up a completion event file by FD .