1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre/libiam.h
38 * iam user level library
40 * Author: Wang Di <wangdi@clusterfs.com>
41 * Author: Nikita Danilov <nikita@clusterfs.com>
42 * Author: Fan Yong <fanyong@clusterfs.com>
49 #ifndef __IAM_ULIB_H__
50 #define __IAM_ULIB_H__
52 /** \defgroup libiam libiam
58 #define DX_FMT_NAME_LEN 16
65 struct iam_uapi_info {
70 char iui_fmt_name[DX_FMT_NAME_LEN];
74 * Creat an iam file, but do NOT open it.
75 * Return 0 if success, else -1.
77 int iam_creat(char *filename, enum iam_fmt_t fmt,
78 int blocksize, int keysize, int recsize, int ptrsize);
81 * Open an iam file, but do NOT creat it if the file doesn't exist.
82 * Please use iam_creat for creating the file before use iam_open.
83 * Return file id (fd) if success, else -1.
85 int iam_open(char *filename, struct iam_uapi_info *ua);
88 * Close file opened by iam_open.
90 int iam_close(int fd);
93 * Please use iam_open before use this function.
95 int iam_insert(int fd, struct iam_uapi_info *ua,
96 int key_need_convert, char *keybuf,
97 int rec_need_convert, char *recbuf);
100 * Please use iam_open before use this function.
102 int iam_lookup(int fd, struct iam_uapi_info *ua,
103 int key_need_convert, char *key_buf,
104 int *keysize, char *save_key,
105 int rec_need_convert, char *rec_buf,
106 int *recsize, char *save_rec);
109 * Please use iam_open before use this function.
111 int iam_delete(int fd, struct iam_uapi_info *ua,
112 int key_need_convert, char *keybuf,
113 int rec_need_convert, char *recbuf);
116 * Please use iam_open before use this function.
118 int iam_it_start(int fd, struct iam_uapi_info *ua,
119 int key_need_convert, char *key_buf,
120 int *keysize, char *save_key,
121 int rec_need_convert, char *rec_buf,
122 int *recsize, char *save_rec);
125 * Please use iam_open before use this function.
127 int iam_it_next(int fd, struct iam_uapi_info *ua,
128 int key_need_convert, char *key_buf,
129 int *keysize, char *save_key,
130 int rec_need_convert, char *rec_buf,
131 int *recsize, char *save_rec);
134 * Please use iam_open before use this function.
136 int iam_it_stop(int fd, struct iam_uapi_info *ua,
137 int key_need_convert, char *keybuf,
138 int rec_need_convert, char *recbuf);
141 * Change iam file mode.
143 int iam_polymorph(char *filename, unsigned long mode);