#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>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) |
| void | adf_lock_init (struct ad_fd *adf) |
| Initialize lock tracking for an ad_fd structure. | |
| void | adf_lock_free (struct ad_fd *adf) |
| Free all locks in an ad_fd structure. | |
| 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
| void adf_lock_free | ( | struct ad_fd * | adf | ) |
Free all locks in an ad_fd structure.
Iterates through all locks in the ad_fd lock array, releasing fcntl locks and freeing memory. Manages refcounted locks properly by only freeing refcount memory when the last reference is released.
This function is called when closing file descriptors to ensure all locks are properly released and memory is freed.
| [in,out] | adf | File descriptor structure containing locks to free |
| void adf_lock_init | ( | struct ad_fd * | adf | ) |
|
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 |