2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include "mf-request.h"
27 pthread_mutex_t gLockMsg;
28 pthread_cond_t gCondMsg;
36 mf_request_type request;
39 mf_fo_request *mf_request_new(void)
41 mf_fo_request *result = NULL;
43 result = malloc(sizeof(mf_fo_request));
47 result->new_name = NULL;
49 result->request = MF_REQ_MERGE;
54 void mf_request_free(mf_fo_request *req)
65 void mf_request_set_result(mf_fo_request *req, mf_request_type result)
68 req->request = result;
71 if (req->flagCond == 1) {
73 g_cond_broadcast(req->cond);
81 void mf_request_set_result_rename(mf_fo_request *req, const char *new_name)
84 req->request = MF_REQ_RENAME;
86 req->new_name = strdup(new_name);
90 g_cond_broadcast(req->cond);
97 void mf_request_set_cond(mf_fo_request *req, GCond * cond)
105 void mf_request_set_path(mf_fo_request *req, const char *path)
113 char *mf_request_get_new_name(mf_fo_request *req)
115 char *new_name = NULL;
117 new_name = req->new_name;
118 req->new_name = NULL;
123 const char *mf_request_get_path(mf_fo_request *req)
131 mf_request_type mf_request_get_result(mf_fo_request *req)
133 mf_request_type request = MF_REQ_NONE;
135 request = req->request;
141 void mf_msg_request_handled_send()
143 pthread_mutex_lock(&gLockMsg);
146 pthread_cond_signal(&gCondMsg);
148 pthread_mutex_unlock(&gLockMsg);
151 int mf_request_flag_get(mf_fo_request *req)
154 return req->flagCond;
159 void mf_request_flag_set(mf_fo_request *req, int value)
162 req->flagCond = value;