4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * (C) Copyright 2012 Commissariat a l'energie atomique et aux energies
9 * All rights reserved. This program and the accompanying materials
10 * are made available under the terms of the GNU Lesser General Public License
11 * (LGPL) version 2.1 or (at your discretion) any later version.
12 * (LGPL) version 2.1 accompanies this distribution, and is available at
13 * http://www.gnu.org/licenses/lgpl-2.1.html
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
25 * lustre/utils/lustreapi_internal.h
30 * Author: Aurelien Degremont <aurelien.degremont@cea.fr>
31 * Author: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
32 * Author: Thomas Leibovici <thomas.leibovici@cea.fr>
35 #ifndef _LUSTREAPI_INTERNAL_H_
36 #define _LUSTREAPI_INTERNAL_H_
38 #include <uapi_kernelcomm.h>
41 #define WANT_FSNAME 0x2
43 #define WANT_INDEX 0x8
44 #define WANT_ERROR 0x10
45 int get_root_path(int want, char *fsname, int *outfd, char *path, int index);
46 int root_ioctl(const char *mdtname, int opc, void *data, int *mdtidxp,
48 int get_param(const char *param_path, char *result,
49 unsigned int result_size);
51 #define LLAPI_LAYOUT_MAGIC 0x11AD1107 /* LLAPILOT */
53 /* Helper functions for testing validity of stripe attributes. */
55 static inline bool llapi_stripe_size_is_aligned(uint64_t size)
57 return (size & (LOV_MIN_STRIPE_SIZE - 1)) == 0;
60 static inline bool llapi_stripe_size_is_too_big(uint64_t size)
62 return size >= (1ULL << 32);
65 static inline bool llapi_stripe_count_is_valid(int64_t count)
67 return count >= -1 && count <= LOV_MAX_STRIPE_COUNT;
70 static inline bool llapi_stripe_index_is_valid(int64_t index)
72 return index >= -1 && index <= LOV_V1_INSANE_STRIPE_COUNT;
75 /* Compatibility macro for legacy llapi functions that use "offset"
76 * terminology instead of the preferred "index". */
77 #define llapi_stripe_offset_is_valid(os) llapi_stripe_index_is_valid(os)
80 * Kernel communication for Changelogs and HSM requests.
82 int libcfs_ukuc_start(struct lustre_kernelcomm *l, int groups, int rfd_flags);
83 int libcfs_ukuc_stop(struct lustre_kernelcomm *l);
84 int libcfs_ukuc_get_rfd(struct lustre_kernelcomm *link);
85 int libcfs_ukuc_msg_get(struct lustre_kernelcomm *l, char *buf, int maxsize,
88 #endif /* _LUSTREAPI_INTERNAL_H_ */