X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flustreapi_internal.h;h=38ce3954aa9e6d144f5d3016b723031f1f0b42a2;hb=0f67ab9b00c3949f257cd4e6081184858f245b4e;hp=c0662b4056e7e452407db26f6a9ea4a28b7aa9be;hpb=c605ef1dbeb401bdff5ab3cfa1c407ea87a7b95d;p=fs%2Flustre-release.git diff --git a/lustre/utils/lustreapi_internal.h b/lustre/utils/lustreapi_internal.h index c0662b4..38ce395 100644 --- a/lustre/utils/lustreapi_internal.h +++ b/lustre/utils/lustreapi_internal.h @@ -44,22 +44,31 @@ #include #define MAX_IOC_BUFLEN 8192 +#define MAX_LINE_LEN 256 +#define MAX_INSTANCE_LEN 32 #define WANT_PATH 0x1 #define WANT_FSNAME 0x2 #define WANT_FD 0x4 #define WANT_INDEX 0x8 #define WANT_ERROR 0x10 +#define WANT_DEV 0x20 +#define WANT_NID 0x40 + +/* Define a fixed 4096-byte encryption unit size */ +#define LUSTRE_ENCRYPTION_BLOCKBITS 12 +#define LUSTRE_ENCRYPTION_UNIT_SIZE ((size_t)1 << LUSTRE_ENCRYPTION_BLOCKBITS) +#define LUSTRE_ENCRYPTION_MASK (~(LUSTRE_ENCRYPTION_UNIT_SIZE - 1)) /* 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 get_root_path(int want, char *fsname, int *outfd, char *path, int index, + dev_t *dev, char *nid); int llapi_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, int max_len); +int llapi_ioctl_dev(int dev_id, unsigned int cmd, void *buf); 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, @@ -128,6 +137,24 @@ static inline bool llapi_stripe_index_is_valid(int64_t index) return index >= -1 && index <= LOV_V1_INSANE_STRIPE_COUNT; } +static inline bool llapi_pool_name_is_valid(const char **pool_name) +{ + const char *ptr; + + if (*pool_name == NULL) + return false; + + /* Strip off any 'fsname.' portion. */ + ptr = strchr(*pool_name, '.'); + if (ptr != NULL) + *pool_name = ptr + 1; + + if (strlen(*pool_name) > LOV_MAXPOOLNAME) + return false; + + return true; +} + /* Compatibility macro for legacy llapi functions that use "offset" * terminology instead of the preferred "index". */ #define llapi_stripe_offset_is_valid(os) llapi_stripe_index_is_valid(os) @@ -146,7 +173,7 @@ static inline bool llapi_dir_hash_type_is_valid(int64_t hash) { int64_t _hash = hash & LMV_HASH_TYPE_MASK; - return _hash > LMV_HASH_TYPE_UNKNOWN && _hash < LMV_HASH_TYPE_MAX; + return _hash >= LMV_HASH_TYPE_UNKNOWN && _hash < LMV_HASH_TYPE_MAX; } /* @@ -158,11 +185,22 @@ 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 lctl_param_flags { + PARAM_FLAGS_YAML_FORMAT = 0x0001, + PARAM_FLAGS_SHOW_SOURCE = 0x0002, + PARAM_FLAGS_EXTRA_DETAILS = 0x0004, +}; + +int llapi_param_display_value(char *path, int version, + enum lctl_param_flags flags, FILE *fp); + enum get_lmd_info_type { GET_LMD_INFO = 1, GET_LMD_STRIPE = 2, }; -int get_lmd_info_fd(char *path, int parentfd, int dirfd, +int get_lmd_info_fd(const char *path, int parentfd, int dirfd, void *lmd_buf, int lmd_len, enum get_lmd_info_type type); + +int lov_comp_md_size(struct lov_comp_md_v1 *lcm); #endif /* _LUSTREAPI_INTERNAL_H_ */