Exemplo n.º 1
0
void file_serializerClose(file_serializer_t* serializer) {
	if((serializer == NULL) ||
			(serializer->fd < 0)) {
		return;
	}
	F_CLOSE(serializer->fd);
}
Exemplo n.º 2
0
static int desr_close(const cdsl_deserializer_t* self) {
	if(!self) {
		return ERR_INV_PARAM;
	}
	file_deserializer_t* desr = container_of(self,file_deserializer_t, handle);
	if(desr->fd <= 0) {
		return ERR_INV_PARAM;
	}
	F_CLOSE(desr->fd);
	return OK;
}
Exemplo n.º 3
0
static int ser_close(const cdsl_serializer_t* self) {
	if(self == NULL) {
		return ERR_INV_PARAM;
	}

	const file_serializer_t* serializer = container_of(self, file_serializer_t, handle);
	if(serializer->fd <= 0) {
		return ERR_INV_PARAM;
	}
	F_CLOSE(serializer->fd);
	return OK;
}
Exemplo n.º 4
0
uint4 jnl_file_open_switch(gd_region *reg, uint4 sts)
{
	sgmnt_addrs		*csa;
	jnl_private_control	*jpc;
	jnl_create_info		create;
	char			prev_jnl_fn[JNL_NAME_SIZE];

	csa = &FILE_INFO(reg)->s_addrs;
	jpc = csa->jnl;

	assert((ERR_JNLFILOPN != sts) && (NOJNL != jpc->channel) || (ERR_JNLFILOPN == sts) && (NOJNL == jpc->channel));
	if ((ERR_JNLFILOPN != sts) && (NOJNL != jpc->channel))
		F_CLOSE(jpc->channel);
	jpc->channel = NOJNL;
	jnl_send_oper(jpc, sts);
	/* attempt to create a new journal file */
	memset(&create, 0, sizeof(create));
	create.status = create.status2 = SS_NORMAL;
	create.prev_jnl = &prev_jnl_fn[0];
	set_jnl_info(reg, &create);
	create.no_prev_link = TRUE;
	create.no_rename = FALSE;
	if (!jgbl.forw_phase_recovery)
		JNL_SHORT_TIME(jgbl.gbl_jrec_time);	/* needed for cre_jnl_file() */
	/* else mur_output_record() would have already set jgbl.gbl_jrec_time */
	assert(jgbl.gbl_jrec_time);
	if (EXIT_NRM != cre_jnl_file(&create))
	{
		jpc->status = create.status;
		jpc->status2 = create.status2;
		return ERR_JNLINVALID;
	} else
	{
		jpc->status = SS_NORMAL;
		sts = 0;
	}
	send_msg(VARLSTCNT(6) ERR_PREVJNLLINKCUT, 4, JNL_LEN_STR(csa->hdr), DB_LEN_STR(reg));
	assert(csa->hdr->jnl_file_len == create.jnl_len);
	assert(0 == memcmp(csa->hdr->jnl_file_name, create.jnl, create.jnl_len));
	return sts;
}
Exemplo n.º 5
0
void file_deserializerClose(file_deserializer_t* deserializer) {
	if((deserializer == NULL) || (deserializer->fd < 0) ) {
		return;
	}
	F_CLOSE(deserializer->fd);
}