1 /* Copyright 2020-2021 IGEL Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
29 * @brief Enable debug logging
31 * @param[in] enable enable/disable debug logging
33 void dlm_enable_debug_log(bool enable);
41 * @brief Get a DRM lease from the lease manager
43 * @param[in] name requested lease
44 * @return A pointer to a lease handle on success.
45 * On error this function returns NULL and errno is set accordingly.
50 * -------------|-------------------------------------------------------------
51 * EACCESS | Cannot access lease manager socket directory
52 * EACCESS | Lease request denied by lease manager
53 * ENAMETOOLONG | The path to the lease manager socket directory is too long
54 * ENOENT | Lease manager or requested lease not available
55 * ENOMEM | Out of memory during operation
56 * EPROTO | Protocol error in communication with lease manager
58 * This list is not exhaustive, and errno may be set to other error codes,
59 * especially those related to socket communication.
61 struct dlm_lease *dlm_get_lease(const char *name);
64 * @brief Release a lease handle
66 * @details Release a lease handle. The lease handle will be invalidated and
67 * the associated DRM lease wil be revoked. Any fd's retrieved from
68 * dlm_lease_fd() will be closed.
69 * @param[in] lease pointer to lease handle
71 void dlm_release_lease(struct dlm_lease *lease);
74 * @brief Get a DRM Master fd from a valid lease handle
76 * @param[in] lease pointer to a lease handle
77 * @return A DRM Master file descriptor for the lease on success.
78 * -1 is returned when called with a NULL lease handle.
80 int dlm_lease_fd(struct dlm_lease *lease);