rangelock.h revision 225736
12061Sjkh/*-
250479Speter * Copyright (c) 2010 The FreeBSD Foundation
32061Sjkh * All rights reserved.
438666Sjb *
532427Sjb * This software was developed by Pawel Jakub Dawidek under sponsorship from
6111131Sru * the FreeBSD Foundation.
7111131Sru *
838666Sjb * Redistribution and use in source and binary forms, with or without
938666Sjb * modification, are permitted provided that the following conditions
1038666Sjb * are met:
1138666Sjb * 1. Redistributions of source code must retain the above copyright
1264049Salex *    notice, this list of conditions and the following disclaimer.
1364049Salex * 2. Redistributions in binary form must reproduce the above copyright
14116679Ssimokawa *    notice, this list of conditions and the following disclaimer in the
1566071Smarkm *    documentation and/or other materials provided with the distribution.
16116679Ssimokawa *
1773504Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
1838666Sjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1938666Sjb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2038666Sjb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2132427Sjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2238666Sjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23108451Sschweikh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2438666Sjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2538666Sjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2638666Sjb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2738666Sjb * SUCH DAMAGE.
2817308Speter *
2991606Skeramida * $FreeBSD: stable/9/sbin/hastd/rangelock.h 204076 2010-02-18 23:16:19Z pjd $
3019175Sbde */
3196205Sjwd
3296205Sjwd#ifndef	_RANGELOCK_H_
3338042Sbde#define	_RANGELOCK_H_
3496205Sjwd
3596205Sjwd#include <stdbool.h>
3638042Sbde#include <unistd.h>
3796205Sjwd
3896205Sjwdstruct rangelocks;
3917308Speter
4096205Sjwdint rangelock_init(struct rangelocks **rlsp);
4196205Sjwdvoid rangelock_free(struct rangelocks *rls);
4217308Speterint rangelock_add(struct rangelocks *rls, off_t offset, off_t length);
4396205Sjwdvoid rangelock_del(struct rangelocks *rls, off_t offset, off_t length);
4496205Sjwdbool rangelock_islocked(struct rangelocks *rls, off_t offset, off_t length);
4596205Sjwd
4696205Sjwd#endif	/* !_RANGELOCK_H_ */
4796205Sjwd