Whamcloud - gitweb
LU-14475 log: Rewrite some log messages
[fs/lustre-release.git] / lustre / utils / lustreapi_internal.h
index 4d636f4..522b8c3 100644 (file)
@@ -57,8 +57,6 @@
 #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,
@@ -128,6 +126,37 @@ 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(char **pool_name,
+                                           const char *fsname)
+{
+       char *ptr;
+
+       if (*pool_name == NULL)
+               return false;
+
+       /**
+        * in case user gives the full pool name <fsname>.<poolname>,
+        * strip the fsname
+        */
+       ptr = strchr(*pool_name, '.');
+       if (ptr != NULL) {
+               *ptr = '\0';
+               if (fsname != NULL && strcmp(*pool_name, fsname) != 0) {
+                       *ptr = '.';
+                       return false;
+               }
+               *pool_name = ptr + 1;
+       }
+
+       if (strlen(*pool_name) > LOV_MAXPOOLNAME)
+               return false;
+
+       return true;
+}
+
+
+int llapi_layout_search_ost(__u32 ost, char *pname, char *fsname);
+
 /* 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)
@@ -144,7 +173,9 @@ static inline bool llapi_dir_stripe_index_is_valid(int64_t index)
 
 static inline bool llapi_dir_hash_type_is_valid(int64_t hash)
 {
-       return hash > LMV_HASH_TYPE_UNKNOWN && hash <  LMV_HASH_TYPE_MAX;
+       int64_t _hash = hash & LMV_HASH_TYPE_MASK;
+
+       return _hash >= LMV_HASH_TYPE_UNKNOWN && _hash <  LMV_HASH_TYPE_MAX;
 }
 
 /*
@@ -161,6 +192,8 @@ enum get_lmd_info_type {
        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_ */