Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
git-mirror
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
master
Documentation
arch
block
certs
crypto
drivers
firmware
fs
9p
adfs
affs
afs
autofs4
befs
bfs
btrfs
cachefiles
ceph
cifs
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
Kconfig
Makefile
ast.c
ast.h
config.c
config.h
debug_fs.c
dir.c
dir.h
dlm_internal.h
lock.c
lock.h
lockspace.c
lockspace.h
lowcomms.c
lowcomms.h
lvb_table.h
main.c
member.c
member.h
memory.c
memory.h
midcomms.c
midcomms.h
netlink.c
plock.c
rcom.c
rcom.h
recover.c
recover.h
recoverd.c
recoverd.h
requestqueue.c
requestqueue.h
user.c
user.h
util.c
util.h
ecryptfs
efivarfs
efs
exofs
exportfs
ext2
ext4
f2fs
fat
freevxfs
fscache
fuse
gfs2
hfs
hfsplus
hostfs
hpfs
hugetlbfs
isofs
jbd2
jffs2
jfs
kernfs
lockd
logfs
minix
ncpfs
nfs
nfs_common
nfsd
nilfs2
nls
notify
ntfs
ocfs2
omfs
openpromfs
orangefs
overlayfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
xfs
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c
buffer.c
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c
dax.c
dcache.c
dcookies.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c
fcntl.c
fhandle.c
file.c
file_table.c
filesystems.c
fs-writeback.c
fs_pin.c
fs_struct.c
inode.c
internal.h
ioctl.c
libfs.c
locks.c
mbcache.c
mount.h
mpage.c
namei.c
namespace.c
no-block.c
nsfs.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.get_maintainer.ignore
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
fs
/
dlm
/
util.c
Blame
Blame
Latest commit
History
History
154 lines (139 loc) · 4.5 KB
Breadcrumbs
linux
/
fs
/
dlm
/
util.c
Top
File metadata and controls
Code
Blame
154 lines (139 loc) · 4.5 KB
Raw
/****************************************************************************** ******************************************************************************* ** ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions ** of the GNU General Public License v.2. ** ******************************************************************************* ******************************************************************************/ #include "dlm_internal.h" #include "rcom.h" #include "util.h" #define DLM_ERRNO_EDEADLK 35 #define DLM_ERRNO_EBADR 53 #define DLM_ERRNO_EBADSLT 57 #define DLM_ERRNO_EPROTO 71 #define DLM_ERRNO_EOPNOTSUPP 95 #define DLM_ERRNO_ETIMEDOUT 110 #define DLM_ERRNO_EINPROGRESS 115 static void header_out(struct dlm_header *hd) { hd->h_version = cpu_to_le32(hd->h_version); hd->h_lockspace = cpu_to_le32(hd->h_lockspace); hd->h_nodeid = cpu_to_le32(hd->h_nodeid); hd->h_length = cpu_to_le16(hd->h_length); } static void header_in(struct dlm_header *hd) { hd->h_version = le32_to_cpu(hd->h_version); hd->h_lockspace = le32_to_cpu(hd->h_lockspace); hd->h_nodeid = le32_to_cpu(hd->h_nodeid); hd->h_length = le16_to_cpu(hd->h_length); } /* higher errno values are inconsistent across architectures, so select one set of values for on the wire */ static int to_dlm_errno(int err) { switch (err) { case -EDEADLK: return -DLM_ERRNO_EDEADLK; case -EBADR: return -DLM_ERRNO_EBADR; case -EBADSLT: return -DLM_ERRNO_EBADSLT; case -EPROTO: return -DLM_ERRNO_EPROTO; case -EOPNOTSUPP: return -DLM_ERRNO_EOPNOTSUPP; case -ETIMEDOUT: return -DLM_ERRNO_ETIMEDOUT; case -EINPROGRESS: return -DLM_ERRNO_EINPROGRESS; } return err; } static int from_dlm_errno(int err) { switch (err) { case -DLM_ERRNO_EDEADLK: return -EDEADLK; case -DLM_ERRNO_EBADR: return -EBADR; case -DLM_ERRNO_EBADSLT: return -EBADSLT; case -DLM_ERRNO_EPROTO: return -EPROTO; case -DLM_ERRNO_EOPNOTSUPP: return -EOPNOTSUPP; case -DLM_ERRNO_ETIMEDOUT: return -ETIMEDOUT; case -DLM_ERRNO_EINPROGRESS: return -EINPROGRESS; } return err; } void dlm_message_out(struct dlm_message *ms) { header_out(&ms->m_header); ms->m_type = cpu_to_le32(ms->m_type); ms->m_nodeid = cpu_to_le32(ms->m_nodeid); ms->m_pid = cpu_to_le32(ms->m_pid); ms->m_lkid = cpu_to_le32(ms->m_lkid); ms->m_remid = cpu_to_le32(ms->m_remid); ms->m_parent_lkid = cpu_to_le32(ms->m_parent_lkid); ms->m_parent_remid = cpu_to_le32(ms->m_parent_remid); ms->m_exflags = cpu_to_le32(ms->m_exflags); ms->m_sbflags = cpu_to_le32(ms->m_sbflags); ms->m_flags = cpu_to_le32(ms->m_flags); ms->m_lvbseq = cpu_to_le32(ms->m_lvbseq); ms->m_hash = cpu_to_le32(ms->m_hash); ms->m_status = cpu_to_le32(ms->m_status); ms->m_grmode = cpu_to_le32(ms->m_grmode); ms->m_rqmode = cpu_to_le32(ms->m_rqmode); ms->m_bastmode = cpu_to_le32(ms->m_bastmode); ms->m_asts = cpu_to_le32(ms->m_asts); ms->m_result = cpu_to_le32(to_dlm_errno(ms->m_result)); } void dlm_message_in(struct dlm_message *ms) { header_in(&ms->m_header); ms->m_type = le32_to_cpu(ms->m_type); ms->m_nodeid = le32_to_cpu(ms->m_nodeid); ms->m_pid = le32_to_cpu(ms->m_pid); ms->m_lkid = le32_to_cpu(ms->m_lkid); ms->m_remid = le32_to_cpu(ms->m_remid); ms->m_parent_lkid = le32_to_cpu(ms->m_parent_lkid); ms->m_parent_remid = le32_to_cpu(ms->m_parent_remid); ms->m_exflags = le32_to_cpu(ms->m_exflags); ms->m_sbflags = le32_to_cpu(ms->m_sbflags); ms->m_flags = le32_to_cpu(ms->m_flags); ms->m_lvbseq = le32_to_cpu(ms->m_lvbseq); ms->m_hash = le32_to_cpu(ms->m_hash); ms->m_status = le32_to_cpu(ms->m_status); ms->m_grmode = le32_to_cpu(ms->m_grmode); ms->m_rqmode = le32_to_cpu(ms->m_rqmode); ms->m_bastmode = le32_to_cpu(ms->m_bastmode); ms->m_asts = le32_to_cpu(ms->m_asts); ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result)); } void dlm_rcom_out(struct dlm_rcom *rc) { header_out(&rc->rc_header); rc->rc_type = cpu_to_le32(rc->rc_type); rc->rc_result = cpu_to_le32(rc->rc_result); rc->rc_id = cpu_to_le64(rc->rc_id); rc->rc_seq = cpu_to_le64(rc->rc_seq); rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply); } void dlm_rcom_in(struct dlm_rcom *rc) { header_in(&rc->rc_header); rc->rc_type = le32_to_cpu(rc->rc_type); rc->rc_result = le32_to_cpu(rc->rc_result); rc->rc_id = le64_to_cpu(rc->rc_id); rc->rc_seq = le64_to_cpu(rc->rc_seq); rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
You can’t perform that action at this time.