s3/lib: add get_remote_arch_from_str()
authorRalph Boehme <slow@samba.org>
Wed, 13 Apr 2016 15:55:11 +0000 (17:55 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 3 May 2016 23:28:22 +0000 (01:28 +0200)
This will be used when fetching remote arch from gencache.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/proto.h
source3/lib/util.c

index afbbff09bb95e84ced90d4ad1af1a4ac045ab150..8baf9d93a4ba310e4ffacb1977ae14731a766431 100644 (file)
@@ -389,6 +389,7 @@ bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppi
 bool is_myname(const char *s);
 void ra_lanman_string( const char *native_lanman );
 const char *get_remote_arch_str(void);
+enum remote_arch_types get_remote_arch_from_str(const char *remote_arch_string);
 void set_remote_arch(enum remote_arch_types type);
 enum remote_arch_types get_remote_arch(void);
 const char *tab_depth(int level, int depth);
index a02e0cf6586fff7b8d15aa659471242a9b10d8ef..62ea50f2947646062daae1385f5550bd2c3b7b4b 100644 (file)
@@ -1260,6 +1260,18 @@ const char *get_remote_arch_str(void)
        return remote_arch_strings[ra_type];
 }
 
+enum remote_arch_types get_remote_arch_from_str(const char *remote_arch_string)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(remote_arch_strings); i++) {
+               if (strcmp(remote_arch_string, remote_arch_strings[i]) == 0) {
+                       return i;
+               }
+       }
+       return RA_UNKNOWN;
+}
+
 /*******************************************************************
  Set the horrid remote_arch string based on an enum.
 ********************************************************************/