"Fossies" - the Fresh Open Source Software Archive

Member "cryptsetup-2.4.3/lib/utils_device_locking.h" (13 Jan 2022, 1997 Bytes) of package /linux/misc/cryptsetup-2.4.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "utils_device_locking.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Metadata on-disk locking for processes serialization
    3  *
    4  * Copyright (C) 2016-2021 Red Hat, Inc. All rights reserved.
    5  * Copyright (C) 2016-2021 Ondrej Kozina
    6  *
    7  * This program is free software; you can redistribute it and/or
    8  * modify it under the terms of the GNU General Public License
    9  * as published by the Free Software Foundation; either version 2
   10  * of the License, or (at your option) any later version.
   11  *
   12  * This program is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15  * GNU General Public License for more details.
   16  *
   17  * You should have received a copy of the GNU General Public License
   18  * along with this program; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   20  */
   21 
   22 #ifndef _CRYPTSETUP_UTILS_LOCKING_H
   23 #define _CRYPTSETUP_UTILS_LOCKING_H
   24 
   25 #include <stdbool.h>
   26 
   27 struct crypt_device;
   28 struct crypt_lock_handle;
   29 struct device;
   30 
   31 int device_locked_readonly(struct crypt_lock_handle *h);
   32 int device_locked(struct crypt_lock_handle *h);
   33 
   34 int device_read_lock_internal(struct crypt_device *cd, struct device *device);
   35 int device_write_lock_internal(struct crypt_device *cd, struct device *device);
   36 void device_unlock_internal(struct crypt_device *cd, struct device *device);
   37 
   38 int device_locked_verify(struct crypt_device *cd, int fd, struct crypt_lock_handle *h);
   39 
   40 int crypt_read_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
   41 int crypt_write_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
   42 void crypt_unlock_internal(struct crypt_device *cd, struct crypt_lock_handle *h);
   43 
   44 
   45 /* Used only in device internal allocation */
   46 void device_set_lock_handle(struct device *device, struct crypt_lock_handle *h);
   47 struct crypt_lock_handle *device_get_lock_handle(struct device *device);
   48 
   49 #endif