Blame lib/utils_device_locking.h

Packit Service a9384c
/*
Packit Service a9384c
 * Metadata on-disk locking for processes serialization
Packit Service a9384c
 *
Packit Service a9384c
 * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
Packit Service a9384c
 * Copyright (C) 2016-2020 Ondrej Kozina
Packit Service a9384c
 *
Packit Service a9384c
 * This program is free software; you can redistribute it and/or
Packit Service a9384c
 * modify it under the terms of the GNU General Public License
Packit Service a9384c
 * as published by the Free Software Foundation; either version 2
Packit Service a9384c
 * of the License, or (at your option) any later version.
Packit Service a9384c
 *
Packit Service a9384c
 * This program is distributed in the hope that it will be useful,
Packit Service a9384c
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service a9384c
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service a9384c
 * GNU General Public License for more details.
Packit Service a9384c
 *
Packit Service a9384c
 * You should have received a copy of the GNU General Public License
Packit Service a9384c
 * along with this program; if not, write to the Free Software
Packit Service a9384c
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit Service a9384c
 */
Packit Service a9384c
Packit Service a9384c
#ifndef _CRYPTSETUP_UTILS_LOCKING_H
Packit Service a9384c
#define _CRYPTSETUP_UTILS_LOCKING_H
Packit Service a9384c
Packit Service a9384c
struct crypt_device;
Packit Service a9384c
struct crypt_lock_handle;
Packit Service a9384c
struct device;
Packit Service a9384c
Packit Service a9384c
int device_locked_readonly(struct crypt_lock_handle *h);
Packit Service a9384c
int device_locked(struct crypt_lock_handle *h);
Packit Service a9384c
Packit Service a9384c
int device_read_lock_internal(struct crypt_device *cd, struct device *device);
Packit Service a9384c
int device_write_lock_internal(struct crypt_device *cd, struct device *device);
Packit Service a9384c
void device_unlock_internal(struct crypt_device *cd, struct device *device);
Packit Service a9384c
Packit Service a9384c
int device_locked_verify(struct crypt_device *cd, int fd, struct crypt_lock_handle *h);
Packit Service a9384c
Packit Service a9384c
int crypt_read_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
Packit Service a9384c
int crypt_write_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
Packit Service a9384c
void crypt_unlock_internal(struct crypt_device *cd, struct crypt_lock_handle *h);
Packit Service a9384c
Packit Service a9384c
Packit Service a9384c
/* Used only in device internal allocation */
Packit Service a9384c
void device_set_lock_handle(struct device *device, struct crypt_lock_handle *h);
Packit Service a9384c
struct crypt_lock_handle *device_get_lock_handle(struct device *device);
Packit Service a9384c
Packit Service a9384c
#endif