コード例 #1
0
ファイル: ulist.c プロジェクト: AiWinters/linux
/**
 * ulist_alloc - dynamically allocate a ulist
 * @gfp_mask:	allocation flags to for base allocation
 *
 * The allocated ulist will be returned in an initialized state.
 */
struct ulist *ulist_alloc(gfp_t gfp_mask)
{
	struct ulist *ulist = kmalloc(sizeof(*ulist), gfp_mask);

	if (!ulist)
		return NULL;

	ulist_init(ulist);

	return ulist;
}
コード例 #2
0
ファイル: user.c プロジェクト: erukiti/ma
void	user_init()
{
	user.defs=varinit(LN_str,MAX_var);
	user.var=varinit(LN_str,MAX_var);
	user.mptr=varinit(LN_longdig,MAX_var);

	user.member=atoi(getvar("member",sys.var));

	op_system();
	sion_sr("def","signup");
	sion_read(user.defs);
	sion_close();

	ulist_init();
}
コード例 #3
0
ファイル: upipe_m3u_reader.c プロジェクト: digideskio/upipe
/** @internal @This allocates a m3u reader pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_m3u_reader_alloc(struct upipe_mgr *mgr,
                                            struct uprobe *uprobe,
                                            uint32_t signature,
                                            va_list args)
{
    struct upipe *upipe =
        upipe_m3u_reader_alloc_void(mgr, uprobe, signature, args);

    upipe_m3u_reader_init_urefcount(upipe);
    upipe_m3u_reader_init_output(upipe);
    upipe_m3u_reader_init_uref_stream(upipe);

    struct upipe_m3u_reader *upipe_m3u_reader =
        upipe_m3u_reader_from_upipe(upipe);
    ulist_init(&upipe_m3u_reader->items);
    upipe_m3u_reader->current_flow_def = NULL;
    upipe_m3u_reader->flow_def = NULL;
    upipe_m3u_reader->item = NULL;
    upipe_m3u_reader->key = NULL;
    upipe_m3u_reader->restart = false;
    upipe_throw_ready(upipe);

    return upipe;
}
コード例 #4
0
/** @internal @This allocates a ts_pese pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_ts_pese_alloc(struct upipe_mgr *mgr,
                                         struct uprobe *uprobe,
                                         uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_ts_pese_alloc_void(mgr, uprobe, signature,
                                                   args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_ts_pese *upipe_ts_pese = upipe_ts_pese_from_upipe(upipe);
    upipe_ts_pese_init_urefcount(upipe);
    upipe_ts_pese_init_ubuf_mgr(upipe);
    upipe_ts_pese_init_output(upipe);
    upipe_ts_pese_init_input(upipe);
    upipe_ts_pese->input_latency = 0;
    upipe_ts_pese->pes_id = 0;
    upipe_ts_pese->pes_header_size = 0;
    upipe_ts_pese->pes_min_duration = 0;
    ulist_init(&upipe_ts_pese->next_pes);
    upipe_ts_pese->next_pes_size = 0;
    upipe_ts_pese->next_pes_duration = 0;
    upipe_throw_ready(upipe);
    return upipe;
}
コード例 #5
0
ファイル: upipe_burst.c プロジェクト: digideskio/upipe
/** @internal @This allocates a burst pipe.
 *
 * @param mgr management structure for this pipe type
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return an allocated pipe
 */
static struct upipe *upipe_burst_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature,
                                       va_list args)
{
    struct upipe *upipe = upipe_burst_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    upipe_burst_init_urefcount(upipe);
    upipe_burst_init_output(upipe);
    upipe_burst_init_upump_mgr(upipe);
    upipe_burst_init_upump(upipe);

    struct upipe_burst *upipe_burst = upipe_burst_from_upipe(upipe);
    urefcount_init(&upipe_burst->urefcount_real, upipe_burst_free);
    ulist_init(&upipe_burst->urefs);
    ueventfd_init(&upipe_burst->ueventfd, false);
    upipe_burst->empty = true;

    upipe_throw_ready(upipe);

    return upipe;
}
コード例 #6
0
ファイル: ulist.c プロジェクト: AiWinters/linux
/**
 * ulist_reinit - prepare a ulist for reuse
 * @ulist:	ulist to be reused
 *
 * Free up all additional memory allocated for the list elements and reinit
 * the ulist.
 */
void ulist_reinit(struct ulist *ulist)
{
	ulist_fini(ulist);
	ulist_init(ulist);
}