#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atalk/adouble.h>
#include <atalk/compat.h>
#include <atalk/errchk.h>
#include <atalk/logger.h>
#include <atalk/util.h>
#include "ad_lock.h"
Macros | |
#define | ARRAY_BLOCK_SIZE 10 |
#define | ARRAY_FREE_DELTA 100 |
#define | LTYPE2STRBUFSIZ 128 |
Functions | |
static const char * | shmdstrfromoff (off_t off) |
static int | set_lock (int fd, int cmd, struct flock *lock) |
static int | XLATE_FCNTL_LOCK (int type) |
static int | OVERLAP (off_t a, off_t alen, off_t b, off_t blen) |
static void | adf_freelock (struct ad_fd *ad, const int i) |
static void | adf_unlock (struct adouble *ad _U_, struct ad_fd *adf, const int fork, int unlckbrl) |
static void | adf_relockrange (struct ad_fd *ad, int fd, off_t off, off_t len) |
static int | adf_findlock (struct ad_fd *ad, const int fork, const int type, const off_t off, const off_t len) |
static int | adf_findxlock (struct ad_fd *ad, const int fork, const int type, const off_t off, const off_t len) |
static off_t | rf2off (off_t off) |
static int | testlock (const struct ad_fd *adf, off_t off, off_t len) |
static const char * | locktypetostr (int type) |
int | ad_lock (struct adouble *ad, uint32_t eid, int locktype, off_t off, off_t len, int fork) |
int | ad_tmplock (struct adouble *ad, uint32_t eid, int locktype, off_t off, off_t len, int fork) |
void | ad_unlock (struct adouble *ad, const int fork, int unlckbrl) |
int | ad_testlock (struct adouble *ad, int eid, const off_t off) |
uint16_t | ad_openforks (struct adouble *ad, uint16_t attrbits) |
#define ARRAY_BLOCK_SIZE 10 |
#define ARRAY_FREE_DELTA 100 |
#define LTYPE2STRBUFSIZ 128 |
int ad_lock | ( | struct adouble * | ad, |
uint32_t | eid, | ||
int | locktype, | ||
off_t | off, | ||
off_t | len, | ||
int | fork ) |
uint16_t ad_openforks | ( | struct adouble * | ad, |
uint16_t | attrbits ) |
Return if a file is open by another process.
Optimized for the common case:
ad | (rw) handle |
attrbits | (r) forks opened by us |
int ad_testlock | ( | struct adouble * | ad, |
int | eid, | ||
const off_t | off ) |
Test for a share mode lock
ad | (rw) handle |
eid | (r) datafork or resource fork |
off | (r) sharemode lock to test |
int ad_tmplock | ( | struct adouble * | ad, |
uint32_t | eid, | ||
int | locktype, | ||
off_t | off, | ||
off_t | len, | ||
int | fork ) |
void ad_unlock | ( | struct adouble * | ad, |
const int | fork, | ||
int | unlckbrl ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Test a lock
(1) Test against our own locks array (2) Test fcntl lock, locks from other processes
adf | (r) handle |
off | (r) offset |
len | (r) length |
|
static |