X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flustreapi_internal.h;h=4d636f454e77e1ca3225191b24d6b50d1c106d6d;hb=5b468e20ecc0b77460444393d1bb41867d99899d;hp=00a66e3985a406e9df52323cf2b2363ba64c888b;hpb=8813fdf2a4f2055e4867df653644f12ac4c78b15;p=fs%2Flustre-release.git diff --git a/lustre/utils/lustreapi_internal.h b/lustre/utils/lustreapi_internal.h index 00a66e3..4d636f4 100644 --- a/lustre/utils/lustreapi_internal.h +++ b/lustre/utils/lustreapi_internal.h @@ -6,6 +6,8 @@ * (C) Copyright 2012 Commissariat a l'energie atomique et aux energies * alternatives * + * Copyright (c) 2016, 2017, Intel Corporation. + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 or (at your discretion) any later version. @@ -24,9 +26,6 @@ * * lustre/utils/lustreapi_internal.h * - */ -/* - * * Author: Aurelien Degremont * Author: JC Lafoucriere * Author: Thomas Leibovici @@ -35,17 +34,36 @@ #ifndef _LUSTREAPI_INTERNAL_H_ #define _LUSTREAPI_INTERNAL_H_ -#include -#include +#include +#include + +#include +#include + +#include +#include + +#define MAX_IOC_BUFLEN 8192 #define WANT_PATH 0x1 #define WANT_FSNAME 0x2 #define WANT_FD 0x4 #define WANT_INDEX 0x8 #define WANT_ERROR 0x10 + +/* mount point listings in /proc/mounts */ +#ifndef PROC_MOUNTS +#define PROC_MOUNTS "/proc/mounts" +#endif + int get_root_path(int want, char *fsname, int *outfd, char *path, int index); int root_ioctl(const char *mdtname, int opc, void *data, int *mdtidxp, int want_error); +int llapi_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, int max_len); +int llapi_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf, int max_len); +int sattr_cache_get_defaults(const char *const fsname, + const char *const pathname, unsigned int *scount, + unsigned int *ssize, unsigned int *soffset); /** * Often when determining the parameter path in sysfs/procfs we @@ -59,6 +77,7 @@ int root_ioctl(const char *mdtname, int opc, void *data, int *mdtidxp, * path as is. */ enum param_filter { + FILTER_BY_NONE, FILTER_BY_EXACT, FILTER_BY_FS_NAME, FILTER_BY_PATH @@ -113,6 +132,21 @@ static inline bool llapi_stripe_index_is_valid(int64_t index) * terminology instead of the preferred "index". */ #define llapi_stripe_offset_is_valid(os) llapi_stripe_index_is_valid(os) +static inline bool llapi_dir_stripe_count_is_valid(int64_t count) +{ + return count >= -1 && count <= LMV_MAX_STRIPE_COUNT; +} + +static inline bool llapi_dir_stripe_index_is_valid(int64_t index) +{ + return index >= -1 && index < LMV_MAX_STRIPE_COUNT; +} + +static inline bool llapi_dir_hash_type_is_valid(int64_t hash) +{ + return hash > LMV_HASH_TYPE_UNKNOWN && hash < LMV_HASH_TYPE_MAX; +} + /* * Kernel communication for Changelogs and HSM requests. */ @@ -122,4 +156,11 @@ int libcfs_ukuc_get_rfd(struct lustre_kernelcomm *link); int libcfs_ukuc_msg_get(struct lustre_kernelcomm *l, char *buf, int maxsize, int transport); +enum get_lmd_info_type { + GET_LMD_INFO = 1, + GET_LMD_STRIPE = 2, +}; + +int get_lmd_info_fd(char *path, int parentfd, int dirfd, + void *lmd_buf, int lmd_len, enum get_lmd_info_type type); #endif /* _LUSTREAPI_INTERNAL_H_ */