4 * Copyright (c) 2010 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #ifndef __DD_DEVICED_MANAGED__
22 #define __DD_DEVICED_MANAGED__
27 * @file dd-deviced-managed.h
28 * @ingroup libdeviced Device Daemon library
29 * @brief This library provides APIs related with memory, performance, processes, and so on.
40 * @fn int deviced_get_pid(const char *execpath)
41 * @brief This API is used to get the pid of the process which has the specified execpath.\n
42 * Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. \n
43 * If there is no process that has same execpath in /proc/{pid}/cmdline, it will return -1.
44 * @param[in] execpath program path which you want to know whether it is run or not
45 * @return pid when the program is running, -1 if it is not.
47 int deviced_get_pid(const char *execpath);
50 * @fn int deviced_set_datetime(time_t timet)
51 * @brief This API is used to set date time.\n
52 * Internally, this API call predefined action API. That is send a notify message. \n
53 * @param[in] time_t type of time which you want to set.
54 * @return pid when the program is running, -1 if param is less than 0 or when failed set datetime.
56 int deviced_set_datetime(time_t timet);
59 * @brief This structure defines the data for receive result of mmc operations(mount/unmount/format)
62 void (*mmc_cb) (int result, void* data);/**< user callback function for receive result of mmc operations */
63 void* user_data;/**< input data for callback function's second-param(data) */
67 * @fn int deviced_request_mount_mmc(struct deviced_mmc_contents *mmc_data)
68 * @brief This API is used to mount mmc.\n
69 * Internally, this API call predefined action API. That is send a notify message. \n
70 * and when mount operation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
71 * means of param1 - 0(mount success) , -2(already mounted), non-zero except (-2) (mount fail) \n
72 * [mount fail value] \n
73 * 1 : operation not permmitted \n
74 * 2 : no such file or directory \n
75 * 6 : no such device or address \n
76 * 12 : out of memory \n
77 * 13 : A component of a path was not searchable \n
79 * 15 : block device is requested \n
80 * 16 : device or resource busy \n
81 * 19 : filesystemtype not configured in the kernel \n
82 * 20 : target, or a prefix of source, is not a directory \n
83 * 22 : point does not exist \n
84 * 24 : table of dummy devices is full \n
85 * 36 : requested name is too long \n
86 * 40 : Too many links encountered during pathname resolution. \n
87 * Or, a move was attempted, while target is a descendant of source \n
88 * @param[in] mmc_data for receive result of mount operation
89 * @return non-zero on success message sending, -1 if message sending is failed.
91 int deviced_request_mount_mmc(struct mmc_contents *mmc_data);
94 * @fn int deviced_request_unmount_mmc(struct deviced_mmc_contents *mmc_data,int option)
95 * @brief This API is used to unmount mmc.\n
96 * Internally, this API call predefined action API. That is send a notify message. \n
97 * and when unmount opeation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
98 * means of param1 - 0(unmount success) , non-zero(unmount fail) \n
99 * [unmount fail value] \n
100 * 1 : operation not permmitted \n
101 * 2 : no such file or directory \n
103 * 12 : out of memory \n
104 * 14 : bad address \n
105 * 16 : device or resource busy \n
106 * 22 : point does not exist \n
107 * 36 : requested name is too long \n
108 * @param[in] mmc_data for receive result of unmount operation
109 * @param[in] option is must be 1(just only support for force unmount)
110 * @return non-zero on success message sending, -1 if message sending is failed.
112 int deviced_request_unmount_mmc(struct mmc_contents *mmc_data, int option);
114 * @fn int deviced_request_format_mmc(struct deviced_mmc_contents *mmc_data)
115 * @brief This API is used to format mmc.\n
116 * Internally, this API call predefined action API. That is send a notify message. \n
117 * and when format opeation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
118 * means of param1 - 0(format success) , -1(format fail)
119 * @param[in] mmc_data for receive result of format operation
120 * @return non-zero on success message sending, -1 if message sending is failed.
122 int deviced_request_format_mmc(struct mmc_contents *mmc_data);
127 #endif /* __DD_DEVICED_MANAGED__ */