Exemple #1
0
void handle_tar_export(){
    struct ParsedRecord* current;
    int i;
    for ( i=0; i < s_export_tarrecords.count; i++ ){
	current = &s_export_tarrecords.records[i];
	/*get param*/
	char* channel_alias = NULL;
	ALLOCA_PARAM_VALUE(current->parsed_params_array[FSTAB_PARAM_CHANNEL_KEY_INDEX], 
			   &channel_alias);
	/*get param*/
	char* mount_path = NULL;
	ALLOCA_PARAM_VALUE(current->parsed_params_array[FSTAB_PARAM_MOUNTPOINT_KEY_INDEX], 
			   &mount_path);
	int res = save_as_tar(mount_path, channel_alias);
	ZRT_LOG(L_SHORT, "save_as_tar res=%d, dirpath=%s, tar_path=%s", 
		res, mount_path, channel_alias);
    }
}
void handle_mount_export(struct FstabObserver* observer){
    struct FstabRecordContainer* record;
    int i;
    for ( i=0; i < observer->postpone_mounts_count; i++ ){
	record = &observer->postpone_mounts_array[i];

	/*get all params*/
	char* channel_alias = NULL;
	char* mount_path = NULL;
	char* access = NULL;
	char* removable = NULL;
	char* fsname = NULL;
	GET_FSTAB_PARAMS(&record->mount, &channel_alias, &mount_path, &access, &removable, &fsname);

	/*save files located at mount_path into tar archive*/
	if ( !strcmp(access, FSTAB_VAL_ACCESS_WRITE) ){
	    int res = save_as_tar(mount_path, channel_alias);
	    ZRT_LOG(L_SHORT, "save_as_tar res=%d, dirpath=%s, tar_path=%s", 
		    res, mount_path, channel_alias);
	}
    }
}