cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

userdlm.h (2601B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * userdlm.h
      4 *
      5 * Userspace dlm defines
      6 *
      7 * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
      8 */
      9
     10
     11#ifndef USERDLM_H
     12#define USERDLM_H
     13
     14#include <linux/module.h>
     15#include <linux/fs.h>
     16#include <linux/types.h>
     17#include <linux/workqueue.h>
     18
     19/* user_lock_res->l_flags flags. */
     20#define USER_LOCK_ATTACHED      (0x00000001) /* we have initialized
     21					       * the lvb */
     22#define USER_LOCK_BUSY          (0x00000002) /* we are currently in
     23					       * dlm_lock */
     24#define USER_LOCK_BLOCKED       (0x00000004) /* blocked waiting to
     25					      * downconvert*/
     26#define USER_LOCK_IN_TEARDOWN   (0x00000008) /* we're currently
     27					      * destroying this
     28					      * lock. */
     29#define USER_LOCK_QUEUED        (0x00000010) /* lock is on the
     30					      * workqueue */
     31#define USER_LOCK_IN_CANCEL     (0x00000020)
     32
     33struct user_lock_res {
     34	spinlock_t               l_lock;
     35
     36	int                      l_flags;
     37
     38#define USER_DLM_LOCK_ID_MAX_LEN  32
     39	char                     l_name[USER_DLM_LOCK_ID_MAX_LEN];
     40	int                      l_namelen;
     41	int                      l_level;
     42	unsigned int             l_ro_holders;
     43	unsigned int             l_ex_holders;
     44	struct ocfs2_dlm_lksb    l_lksb;
     45
     46	int                      l_requested;
     47	int                      l_blocking;
     48
     49	wait_queue_head_t        l_event;
     50
     51	struct work_struct       l_work;
     52};
     53
     54extern struct workqueue_struct *user_dlm_worker;
     55
     56void user_dlm_lock_res_init(struct user_lock_res *lockres,
     57			    struct dentry *dentry);
     58int user_dlm_destroy_lock(struct user_lock_res *lockres);
     59int user_dlm_cluster_lock(struct user_lock_res *lockres,
     60			  int level,
     61			  int lkm_flags);
     62void user_dlm_cluster_unlock(struct user_lock_res *lockres,
     63			     int level);
     64void user_dlm_write_lvb(struct inode *inode,
     65			const char *val,
     66			unsigned int len);
     67bool user_dlm_read_lvb(struct inode *inode, char *val);
     68struct ocfs2_cluster_connection *user_dlm_register(const struct qstr *name);
     69void user_dlm_unregister(struct ocfs2_cluster_connection *conn);
     70void user_dlm_set_locking_protocol(void);
     71
     72struct dlmfs_inode_private {
     73	struct ocfs2_cluster_connection	*ip_conn;
     74
     75	struct user_lock_res ip_lockres; /* unused for directories. */
     76	struct inode         *ip_parent;
     77
     78	struct inode         ip_vfs_inode;
     79};
     80
     81static inline struct dlmfs_inode_private *
     82DLMFS_I(struct inode *inode)
     83{
     84        return container_of(inode,
     85			    struct dlmfs_inode_private,
     86			    ip_vfs_inode);
     87}
     88
     89struct dlmfs_filp_private {
     90	int                  fp_lock_level;
     91};
     92
     93#define DLMFS_MAGIC	0x76a9f425
     94
     95#endif /* USERDLM_H */