~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/dlm/util.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/dlm/util.c (Version linux-6.11.5) and /fs/dlm/util.c (Version linux-5.15.169)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*********************************************      2 /******************************************************************************
  3 **********************************************      3 *******************************************************************************
  4 **                                                  4 **
  5 **  Copyright (C) 2005-2008 Red Hat, Inc.  All      5 **  Copyright (C) 2005-2008 Red Hat, Inc.  All rights reserved.
  6 **                                                  6 **
  7 **                                                  7 **
  8 **********************************************      8 *******************************************************************************
  9 **********************************************      9 ******************************************************************************/
 10                                                    10 
 11 #include "dlm_internal.h"                          11 #include "dlm_internal.h"
 12 #include "rcom.h"                                  12 #include "rcom.h"
 13 #include "util.h"                                  13 #include "util.h"
 14                                                    14 
 15 #define DLM_ERRNO_EDEADLK               35         15 #define DLM_ERRNO_EDEADLK               35
 16 #define DLM_ERRNO_EBADR                 53         16 #define DLM_ERRNO_EBADR                 53
 17 #define DLM_ERRNO_EBADSLT               57         17 #define DLM_ERRNO_EBADSLT               57
 18 #define DLM_ERRNO_EPROTO                71         18 #define DLM_ERRNO_EPROTO                71
 19 #define DLM_ERRNO_EOPNOTSUPP            95         19 #define DLM_ERRNO_EOPNOTSUPP            95
 20 #define DLM_ERRNO_ETIMEDOUT            110         20 #define DLM_ERRNO_ETIMEDOUT            110
 21 #define DLM_ERRNO_EINPROGRESS          115         21 #define DLM_ERRNO_EINPROGRESS          115
 22                                                    22 
                                                   >>  23 void header_out(struct dlm_header *hd)
                                                   >>  24 {
                                                   >>  25         hd->h_version           = cpu_to_le32(hd->h_version);
                                                   >>  26         /* does it for others u32 in union as well */
                                                   >>  27         hd->u.h_lockspace       = cpu_to_le32(hd->u.h_lockspace);
                                                   >>  28         hd->h_nodeid            = cpu_to_le32(hd->h_nodeid);
                                                   >>  29         hd->h_length            = cpu_to_le16(hd->h_length);
                                                   >>  30 }
                                                   >>  31 
                                                   >>  32 void header_in(struct dlm_header *hd)
                                                   >>  33 {
                                                   >>  34         hd->h_version           = le32_to_cpu(hd->h_version);
                                                   >>  35         /* does it for others u32 in union as well */
                                                   >>  36         hd->u.h_lockspace       = le32_to_cpu(hd->u.h_lockspace);
                                                   >>  37         hd->h_nodeid            = le32_to_cpu(hd->h_nodeid);
                                                   >>  38         hd->h_length            = le16_to_cpu(hd->h_length);
                                                   >>  39 }
                                                   >>  40 
 23 /* higher errno values are inconsistent across     41 /* higher errno values are inconsistent across architectures, so select
 24    one set of values for on the wire */            42    one set of values for on the wire */
 25                                                    43 
 26 int to_dlm_errno(int err)                      !!  44 static int to_dlm_errno(int err)
 27 {                                                  45 {
 28         switch (err) {                             46         switch (err) {
 29         case -EDEADLK:                             47         case -EDEADLK:
 30                 return -DLM_ERRNO_EDEADLK;         48                 return -DLM_ERRNO_EDEADLK;
 31         case -EBADR:                               49         case -EBADR:
 32                 return -DLM_ERRNO_EBADR;           50                 return -DLM_ERRNO_EBADR;
 33         case -EBADSLT:                             51         case -EBADSLT:
 34                 return -DLM_ERRNO_EBADSLT;         52                 return -DLM_ERRNO_EBADSLT;
 35         case -EPROTO:                              53         case -EPROTO:
 36                 return -DLM_ERRNO_EPROTO;          54                 return -DLM_ERRNO_EPROTO;
 37         case -EOPNOTSUPP:                          55         case -EOPNOTSUPP:
 38                 return -DLM_ERRNO_EOPNOTSUPP;      56                 return -DLM_ERRNO_EOPNOTSUPP;
 39         case -ETIMEDOUT:                           57         case -ETIMEDOUT:
 40                 return -DLM_ERRNO_ETIMEDOUT;       58                 return -DLM_ERRNO_ETIMEDOUT;
 41         case -EINPROGRESS:                         59         case -EINPROGRESS:
 42                 return -DLM_ERRNO_EINPROGRESS;     60                 return -DLM_ERRNO_EINPROGRESS;
 43         }                                          61         }
 44         return err;                                62         return err;
 45 }                                                  63 }
 46                                                    64 
 47 int from_dlm_errno(int err)                    !!  65 static int from_dlm_errno(int err)
 48 {                                                  66 {
 49         switch (err) {                             67         switch (err) {
 50         case -DLM_ERRNO_EDEADLK:                   68         case -DLM_ERRNO_EDEADLK:
 51                 return -EDEADLK;                   69                 return -EDEADLK;
 52         case -DLM_ERRNO_EBADR:                     70         case -DLM_ERRNO_EBADR:
 53                 return -EBADR;                     71                 return -EBADR;
 54         case -DLM_ERRNO_EBADSLT:                   72         case -DLM_ERRNO_EBADSLT:
 55                 return -EBADSLT;                   73                 return -EBADSLT;
 56         case -DLM_ERRNO_EPROTO:                    74         case -DLM_ERRNO_EPROTO:
 57                 return -EPROTO;                    75                 return -EPROTO;
 58         case -DLM_ERRNO_EOPNOTSUPP:                76         case -DLM_ERRNO_EOPNOTSUPP:
 59                 return -EOPNOTSUPP;                77                 return -EOPNOTSUPP;
 60         case -DLM_ERRNO_ETIMEDOUT:                 78         case -DLM_ERRNO_ETIMEDOUT:
 61                 return -ETIMEDOUT;                 79                 return -ETIMEDOUT;
 62         case -DLM_ERRNO_EINPROGRESS:               80         case -DLM_ERRNO_EINPROGRESS:
 63                 return -EINPROGRESS;               81                 return -EINPROGRESS;
 64         }                                          82         }
 65         return err;                                83         return err;
                                                   >>  84 }
                                                   >>  85 
                                                   >>  86 void dlm_message_out(struct dlm_message *ms)
                                                   >>  87 {
                                                   >>  88         header_out(&ms->m_header);
                                                   >>  89 
                                                   >>  90         ms->m_type              = cpu_to_le32(ms->m_type);
                                                   >>  91         ms->m_nodeid            = cpu_to_le32(ms->m_nodeid);
                                                   >>  92         ms->m_pid               = cpu_to_le32(ms->m_pid);
                                                   >>  93         ms->m_lkid              = cpu_to_le32(ms->m_lkid);
                                                   >>  94         ms->m_remid             = cpu_to_le32(ms->m_remid);
                                                   >>  95         ms->m_parent_lkid       = cpu_to_le32(ms->m_parent_lkid);
                                                   >>  96         ms->m_parent_remid      = cpu_to_le32(ms->m_parent_remid);
                                                   >>  97         ms->m_exflags           = cpu_to_le32(ms->m_exflags);
                                                   >>  98         ms->m_sbflags           = cpu_to_le32(ms->m_sbflags);
                                                   >>  99         ms->m_flags             = cpu_to_le32(ms->m_flags);
                                                   >> 100         ms->m_lvbseq            = cpu_to_le32(ms->m_lvbseq);
                                                   >> 101         ms->m_hash              = cpu_to_le32(ms->m_hash);
                                                   >> 102         ms->m_status            = cpu_to_le32(ms->m_status);
                                                   >> 103         ms->m_grmode            = cpu_to_le32(ms->m_grmode);
                                                   >> 104         ms->m_rqmode            = cpu_to_le32(ms->m_rqmode);
                                                   >> 105         ms->m_bastmode          = cpu_to_le32(ms->m_bastmode);
                                                   >> 106         ms->m_asts              = cpu_to_le32(ms->m_asts);
                                                   >> 107         ms->m_result            = cpu_to_le32(to_dlm_errno(ms->m_result));
                                                   >> 108 }
                                                   >> 109 
                                                   >> 110 void dlm_message_in(struct dlm_message *ms)
                                                   >> 111 {
                                                   >> 112         header_in(&ms->m_header);
                                                   >> 113 
                                                   >> 114         ms->m_type              = le32_to_cpu(ms->m_type);
                                                   >> 115         ms->m_nodeid            = le32_to_cpu(ms->m_nodeid);
                                                   >> 116         ms->m_pid               = le32_to_cpu(ms->m_pid);
                                                   >> 117         ms->m_lkid              = le32_to_cpu(ms->m_lkid);
                                                   >> 118         ms->m_remid             = le32_to_cpu(ms->m_remid);
                                                   >> 119         ms->m_parent_lkid       = le32_to_cpu(ms->m_parent_lkid);
                                                   >> 120         ms->m_parent_remid      = le32_to_cpu(ms->m_parent_remid);
                                                   >> 121         ms->m_exflags           = le32_to_cpu(ms->m_exflags);
                                                   >> 122         ms->m_sbflags           = le32_to_cpu(ms->m_sbflags);
                                                   >> 123         ms->m_flags             = le32_to_cpu(ms->m_flags);
                                                   >> 124         ms->m_lvbseq            = le32_to_cpu(ms->m_lvbseq);
                                                   >> 125         ms->m_hash              = le32_to_cpu(ms->m_hash);
                                                   >> 126         ms->m_status            = le32_to_cpu(ms->m_status);
                                                   >> 127         ms->m_grmode            = le32_to_cpu(ms->m_grmode);
                                                   >> 128         ms->m_rqmode            = le32_to_cpu(ms->m_rqmode);
                                                   >> 129         ms->m_bastmode          = le32_to_cpu(ms->m_bastmode);
                                                   >> 130         ms->m_asts              = le32_to_cpu(ms->m_asts);
                                                   >> 131         ms->m_result            = from_dlm_errno(le32_to_cpu(ms->m_result));
                                                   >> 132 }
                                                   >> 133 
                                                   >> 134 void dlm_rcom_out(struct dlm_rcom *rc)
                                                   >> 135 {
                                                   >> 136         header_out(&rc->rc_header);
                                                   >> 137 
                                                   >> 138         rc->rc_type             = cpu_to_le32(rc->rc_type);
                                                   >> 139         rc->rc_result           = cpu_to_le32(rc->rc_result);
                                                   >> 140         rc->rc_id               = cpu_to_le64(rc->rc_id);
                                                   >> 141         rc->rc_seq              = cpu_to_le64(rc->rc_seq);
                                                   >> 142         rc->rc_seq_reply        = cpu_to_le64(rc->rc_seq_reply);
                                                   >> 143 }
                                                   >> 144 
                                                   >> 145 void dlm_rcom_in(struct dlm_rcom *rc)
                                                   >> 146 {
                                                   >> 147         header_in(&rc->rc_header);
                                                   >> 148 
                                                   >> 149         rc->rc_type             = le32_to_cpu(rc->rc_type);
                                                   >> 150         rc->rc_result           = le32_to_cpu(rc->rc_result);
                                                   >> 151         rc->rc_id               = le64_to_cpu(rc->rc_id);
                                                   >> 152         rc->rc_seq              = le64_to_cpu(rc->rc_seq);
                                                   >> 153         rc->rc_seq_reply        = le64_to_cpu(rc->rc_seq_reply);
 66 }                                                 154 }
 67                                                   155 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php