client/src/unifycr.c
static int ins_file_meta(unifycr_fattr_buf_t *ptr_f_meta_log,\
		unifycr_fattr_t *ins_fattr) {
	int meta_cnt = *(ptr_f_meta_log->ptr_num_entries), i;
	unifycr_fattr_t *meta_entry = ptr_f_meta_log->meta_entry;

	for (i = 0; i < meta_cnt - 1; i++) {
		if (meta_entry[i].fid > ins_fattr->fid) {
			break;
		}
	}

	if (i == meta_cnt) {
		meta_entry[meta_cnt] = *ins_fattr;
		(*ptr_f_meta_log->ptr_num_entries)++;
		return 0;
	}

	int ins_pos = i;
	for (i = meta_cnt - 1; i >= ins_pos; i--) {
		meta_entry[i + 1] = meta_entry[i];
	}
	(*ptr_f_meta_log->ptr_num_entries)++;
	meta_entry[ins_pos] = *ins_fattr;
	return 0;

}
/*
 * insert file attribute to attributed share memory buffer
 * */
insert file attribute to attributed share memory buffer
insert file attribute to attributed share memory buffer
static int ins_file_meta(unifycr_fattr_buf_t *ptr_f_meta_log,\
		unifycr_fattr_t *ins_fattr) {
	int meta_cnt = *(ptr_f_meta_log->ptr_num_entries), i;
	unifycr_fattr_t *meta_entry = ptr_f_meta_log->meta_entry;
	for (i = 0; i < meta_cnt - 1; i++) {
		if (meta_entry[i].fid > ins_fattr->fid) {
			break;
		}
	}
	if (i == meta_cnt) {
		meta_entry[meta_cnt] = *ins_fattr;
		(*ptr_f_meta_log->ptr_num_entries)++;
		return 0;
	}
	int ins_pos = i;
	for (i = meta_cnt - 1; i >= ins_pos; i--) {
		meta_entry[i + 1] = meta_entry[i];
	}
	(*ptr_f_meta_log->ptr_num_entries)++;
	meta_entry[ins_pos] = *ins_fattr;
	return 0;
}
static int ins_file_meta ( unifycr_fattr_buf_t * ptr_f_meta_log , unifycr_fattr_t * ins_fattr ) { int meta_cnt = * ( ptr_f_meta_log -> ptr_num_entries ) , i ; unifycr_fattr_t * meta_entry = ptr_f_meta_log -> meta_entry ; for ( i = 0 ; i < meta_cnt - 1 ; i ++ ) { if ( meta_entry [ i ] . fid > ins_fattr -> fid ) { break ; } } if ( i == meta_cnt ) { meta_entry [ meta_cnt ] = * ins_fattr ; ( * ptr_f_meta_log -> ptr_num_entries ) ++ ; return 0 ; } int ins_pos = i ; for ( i = meta_cnt - 1 ; i >= ins_pos ; i -- ) { meta_entry [ i + 1 ] = meta_entry [ i ] ; } ( * ptr_f_meta_log -> ptr_num_entries ) ++ ; meta_entry [ ins_pos ] = * ins_fattr ; return 0 ; }
insert file attribute to attributed share memory buffer
insert file attribute to attributed share memory buffer