#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, 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) |
| Test a lock. | |
| 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) |
| Test for a share mode lock. | |
| uint16_t | ad_openforks (struct adouble *ad, uint16_t attrbits) |
| Return if a file is open by another process. | |
| #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:
| [in,out] | ad | handle |
| [in] | attrbits | forks opened by us |
| int ad_testlock | ( | struct adouble * | ad, |
| int | eid, | ||
| const off_t | off ) |
Test for a share mode lock.
| [in,out] | ad | handle |
| [in] | eid | datafork or resource fork |
| [in] | off | 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 |
find a byte lock that overlaps off/len for a particular open fork
|
static |
search other fork lock lists
|
static |
remove a lock and compact space if necessary
|
static |
relock any byte lock that overlaps off/len. unlock everything else.
|
static |
|
static |
|
static |
translate a resource fork lock to an offset
|
static |
|
static |
|
static |
Test a lock.
| [in] | adf | handle |
| [in] | off | offset |
| [in] | len | length |
|
static |