This file is indexed.

/usr/include/sanlock_resource.h is in libsanlock-dev 3.6.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*
 * Copyright 2010-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */

#ifndef __SANLOCK_RESOURCE_H__
#define __SANLOCK_RESOURCE_H__

/*
 * sock > -1, pid is ignored:
 * process creates registered connection and acquires/releases leases on
 * that connection for itself
 *
 * sock == -1, pid is used:
 * process asks daemon to acquire/release leases for another separately
 * registered pid
 */

/* restrict flags */
#define SANLK_RESTRICT_ALL		0x00000001
#define SANLK_RESTRICT_SIGKILL		0x00000002
#define SANLK_RESTRICT_SIGTERM		0x00000004

/* killpath flags */
#define SANLK_KILLPATH_PID		0x00000001

/*
 * acquire flags
 *
 * SANLK_ACQUIRE_LVB
 * Enable the use of an LVB with the lock.
 *
 * SANLK_ACQUIRE_ORPHAN
 * If the lock already exists as an orphan,
 * then acquire it.  Otherwise, acquire a
 * new lock as usual.
 *
 * SANLK_ACQUIRE_ORPHAN_ONLY
 * If the lock already exists as an orphan,
 * then acquire it.  Otherwise, do not acquire
 * a lock at all and return -ENOENT.
 *
 * SANLK_ACQUIRE_OWNER_NOWAIT
 * If the lock cannot be granted immediately
 * because the owner's lease needs to time out, do
 * not wait, but return -SANLK_ACQUIRE_OWNED_RETRY.
 */

#define SANLK_ACQUIRE_LVB		0x00000001
#define SANLK_ACQUIRE_ORPHAN		0x00000002
#define SANLK_ACQUIRE_ORPHAN_ONLY	0x00000004
#define SANLK_ACQUIRE_OWNER_NOWAIT	0x00000008

/*
 * release flags
 *
 * SANLK_REL_ALL
 * Release all resources held by the client.
 * The res args are ignored.
 *
 * SANLK_REL_RENAME
 * Rename the resource lease on disk when it
 * is released.  The resource is freed and
 * renamed in a single disk operation (write
 * to the leader record.)  The first res
 * arg is the resource to release, and the
 * second resource arg contains the new name
 * for the first resource.
 *
 * SANLK_REL_ORPHAN
 * Release orphan resources asynchronously.
 * Takes a single resource struct.  If the
 * resource name is empty, then all orphans
 * for the specified lockspace are released.
 * If the resource name is set, then an
 * orphan with the matching resource name is
 * released.
 */

#define SANLK_REL_ALL		0x00000001
#define SANLK_REL_RENAME	0x00000002
#define SANLK_REL_ORPHAN	0x00000004

/*
 * convert flags
 *
 * SANLK_CONVERT_OWNER_NOWAIT
 * Same as SANLK_ACQUIRE_OWNER_NOWAIT.
 */

#define SANLK_CONVERT_OWNER_NOWAIT	0x00000008 /* NB: value must match SANLK_ACQUIRE_OWNER_NOWAIT */

/*
 * request flags
 *
 * SANLK_REQUEST_NEXT_LVER
 * The caller specifies 0 lver in res, and the daemon
 * automatically requests the current lver + 1.  When
 * multiple hosts are making requests, this flag can
 * produce unexpected results, and it would be safer
 * to read the resource, check that the current owner
 * is the one being targetted, and use that owner's
 * lver + 1 as the specifically requested lver.
 */

#define SANLK_REQUEST_NEXT_LVER	0x00000001

/*
 * request force_mode
 *
 * SANLK_REQ_FORCE (SANLK_REQ_KILL_PID deprecated)
 * Send SIGKILL to the pid holding the resource
 * (or SIGTERM if SIGKILL is restricted.)
 *
 * SANLK_REQ_GRACEFUL
 * Run killpath against the pid if it is defined, otherwise
 * send SIGTERM to the pid (or SIGKILL if SIGTERM is restricted).
 */

#define SANLK_REQ_FORCE			0x00000001
#define SANLK_REQ_GRACEFUL		0x00000002

/* old name deprecated */
#define SANLK_REQ_KILL_PID		SANLK_REQ_FORCE

int sanlock_register(void);

int sanlock_restrict(int sock, uint32_t flags);

int sanlock_killpath(int sock, uint32_t flags, const char *path, char *args);

int sanlock_acquire(int sock, int pid, uint32_t flags, int res_count,
		    struct sanlk_resource *res_args[],
		    struct sanlk_options *opt_in);

int sanlock_release(int sock, int pid, uint32_t flags, int res_count,
		    struct sanlk_resource *res_args[]);

int sanlock_inquire(int sock, int pid, uint32_t flags, int *res_count,
		    char **res_state);

int sanlock_convert(int sock, int pid, uint32_t flags,
		    struct sanlk_resource *res);

int sanlock_request(uint32_t flags, uint32_t force_mode,
		    struct sanlk_resource *res);

int sanlock_examine(uint32_t flags, struct sanlk_lockspace *ls,
		    struct sanlk_resource *res);

int sanlock_set_lvb(uint32_t flags, struct sanlk_resource *res,
		    char *lvb, int lvblen);

int sanlock_get_lvb(uint32_t flags, struct sanlk_resource *res,
		    char *lvb, int lvblen);

/*
 * Functions to convert between string and struct resource formats.
 * All allocate space for returned data that the caller must free.
 */

/*
 * convert from struct sanlk_resource to string with format:
 * <lockspace_name>:<resource_name>:<path>:<offset>[:<path>:<offset>...]:<lver>
 */

int sanlock_res_to_str(struct sanlk_resource *res, char **str_ret);

/*
 * convert to struct sanlk_resource from string with format:
 * <lockspace_name>:<resource_name>:<path>:<offset>[:<path>:<offset>...][:<lver>]
 */

int sanlock_str_to_res(char *str, struct sanlk_resource **res_ret);

/*
 * convert from array of struct sanlk_resource * to state string with format:
 * "RESOURCE1 RESOURCE2 RESOURCE3 ..."
 * RESOURCE format in sanlock_res_to_str() comment
 */

int sanlock_args_to_state(int res_count,
			  struct sanlk_resource *res_args[],
			  char **res_state);

/*
 * convert to array of struct sanlk_resource * from state string with format:
 * "RESOURCE1 RESOURCE2 RESOURCE3 ..."
 * RESOURCE format in sanlock_str_to_res() comment
 */

int sanlock_state_to_args(char *res_state,
			  int *res_count,
			  struct sanlk_resource ***res_args);

/*
 * convert to struct sanlk_lockspace from string with format:
 * <lockspace_name>:<host_id>:<path>:<offset>
 */

int sanlock_str_to_lockspace(char *str, struct sanlk_lockspace *ls);

#endif