Home | History | Annotate | Download | only in ext2fs

Lines Matching defs:off

209 	u32 off;
264 static int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off);
265 static int tdb_write_unlock_record(struct tdb_context *tdb, tdb_off_t off);
273 static int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off);
274 static int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off);
288 static int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off,
788 int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off)
790 return off ? tdb->methods->tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0, 1) : 0;
798 int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off)
802 if (i->off == off)
804 return tdb->methods->tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 1, 1);
811 int tdb_write_unlock_record(struct tdb_context *tdb, tdb_off_t off)
813 return tdb->methods->tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0, 1);
817 int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off)
822 if (off == 0)
825 if (i->off == off)
827 return (count == 1 ? tdb->methods->tdb_brlock(tdb, off, F_UNLCK, F_SETLKW, 0, 1) : 0);
875 static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
887 if (tdb->methods->tdb_oob(tdb, off + len, 0) != 0)
891 memcpy(off + (char *)tdb->map_ptr, buf, len);
892 } else if (pwrite(tdb->fd, buf, len, off) != (ssize_t)len) {
896 off, len, strerror(errno)));
913 static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
916 if (tdb->methods->tdb_oob(tdb, off + len, 0) != 0) {
921 memcpy(buf, off + (char *)tdb->map_ptr, len);
923 ssize_t ret = pread(tdb->fd, buf, len, off);
929 (int)off, (int)len, (int)ret, strerror(errno),
956 u32 off=0;
958 if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), &off) != 0 || off != 0) {
1129 tdb_off_t off = *d;
1130 return tdb->methods->tdb_write(tdb, offset, CONVERT(off), sizeof(*d));
1337 static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
1346 if (off+len <= el->offset) {
1349 if (off >= el->offset + el->length) {
1355 if (off < el->offset) {
1356 partial = el->offset - off;
1357 if (transaction_read(tdb, off, buf, partial, cv) != 0) {
1361 off += partial;
1364 if (off + len <= el->offset + el->length) {
1367 partial = el->offset + el->length - off;
1369 memcpy(buf, el->data + (off - el->offset), partial);
1374 off += partial;
1377 if (len != 0 && transaction_read(tdb, off, buf, len, cv) != 0) {
1385 return tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv);
1388 TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: failed at off=%d len=%d\n", off, len));
1398 static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
1409 if (len == sizeof(tdb_off_t) && off >= FREELIST_TOP &&
1410 off < FREELIST_TOP+TDB_HASHTABLE_SIZE(tdb)) {
1411 u32 chain = (off-FREELIST_TOP) / sizeof(tdb_off_t);
1419 if (best_el == NULL && off == el->offset+el->length) {
1423 if (off+len <= el->offset) {
1426 if (off >= el->offset + el->length) {
1432 if (off < el->offset) {
1433 partial = el->offset - off;
1434 if (transaction_write(tdb, off, buf, partial) != 0) {
1438 off += partial;
1441 if (off + len <= el->offset + el->length) {
1444 partial = el->offset + el->length - off;
1446 memcpy(el->data + (off - el->offset), buf, partial);
1448 off += partial;
1451 if (len != 0 && transaction_write(tdb, off, buf, len) != 0) {
1459 if (best_el && best_el->offset + best_el->length == off &&
1460 (off+len < tdb->transaction->old_map_size ||
1461 off > tdb->transaction->old_map_size)) {
1490 el->offset = off;
1513 TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", off, len));
2259 static int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct *rec)
2261 if (tdb->methods->tdb_read(tdb, off, rec, sizeof(*rec),DOCONV()) == -1)
2268 rec->magic, off));
2270 if (tdb->methods->tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
2278 rec->magic, off));
2289 static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_t next)
2296 if (i == off) {
2303 TDB_LOG((tdb, TDB_DEBUG_FATAL,"remove_from_freelist: not on list at off=%d\n", off));
2648 int want_next = (tlock->off != 0);
2652 if (!tlock->off && tlock->hash != 0) {
2691 if (!tlock->off) {
2693 &tlock->off) == -1)
2697 if (tdb_unlock_record(tdb, tlock->off) != 0)
2703 if (tdb_rec_read(tdb, tlock->off, rec) == -1)
2705 tlock->off = rec->next;
2709 while( tlock->off) {
2711 if (tdb_rec_read(tdb, tlock->off, rec) == -1)
2715 if (tlock->off == rec->next) {
2722 if (tdb_lock_record(tdb, tlock->off) != 0)
2724 return tlock->off;
2728 current = tlock->off;
2729 tlock->off = rec->next;
2741 tlock->off = 0;
2772 key.dptr = tdb_alloc_read(tdb, tl->off + sizeof(rec),
2778 if (tdb_unlock_record(tdb, tl->off) != 0)
2795 if (tdb_unlock_record(tdb, tl->off) != 0) {
2870 if (tdb_unlock_record(tdb, tdb->travlocks.off) != 0)
2872 tdb->travlocks.off = tdb->travlocks.hash = 0;
2880 key.dptr =tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),key.dsize);
2897 if (tdb->travlocks.off) {
2900 if (tdb_rec_read(tdb, tdb->travlocks.off, &rec) == -1
2901 || !(k = tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),
2905 if (tdb_unlock_record(tdb, tdb->travlocks.off) != 0) {
2913 tdb->travlocks.off = 0;
2919 if (!tdb->travlocks.off) {
2921 tdb->travlocks.off = tdb_find_lock_hash(tdb, oldkey, tdb->hash_fn(&oldkey), tdb->travlocks.lock_rw, &rec);
2922 if (!tdb->travlocks.off)
2925 off) != 0) {
2936 key.dptr = tdb_alloc_read(tdb, tdb->travlocks.off+sizeof(rec),
3862 /* internal databases don't mmap or lock, and start off cleared */