Whamcloud - gitweb
LU-15220 utils: use 'fallthrough' pseudo keyword for switch
[fs/lustre-release.git] / lustre / utils / lustreapi_internal.h
index 367393d..3d291dc 100644 (file)
 #define WANT_INDEX  0x8
 #define WANT_ERROR  0x10
 
+/* 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"
@@ -126,6 +131,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)