int max_len);
char *escape_shell_string(const char *src);
char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
+ssize_t full_path_tos(const char *dir, const char *name,
+ char *tmpbuf, size_t tmpbuf_len,
+ char **pdst, char **to_free);
/* The following definitions come from lib/version.c */
TALLOC_FREE(s);
return list;
}
+
+/*
+ * This routine improves performance for operations temporarily acting on a
+ * full path. It is equivalent to the much more expensive
+ *
+ * talloc_asprintf(talloc_tos(), "%s/%s", dir, name)
+ *
+ * This actually does make a difference in metadata-heavy workloads (i.e. the
+ * "standard" client.txt nbench run.
+ */
+
+ssize_t full_path_tos(const char *dir, const char *name,
+ char *tmpbuf, size_t tmpbuf_len,
+ char **pdst, char **to_free)
+{
+ size_t dirlen, namelen, len;
+ char *dst;
+
+ dirlen = strlen(dir);
+ namelen = strlen(name);
+ len = dirlen + namelen + 1;
+
+ if (len < tmpbuf_len) {
+ dst = tmpbuf;
+ *to_free = NULL;
+ } else {
+ dst = talloc_array(talloc_tos(), char, len+1);
+ if (dst == NULL) {
+ return -1;
+ }
+ *to_free = dst;
+ }
+
+ memcpy(dst, dir, dirlen);
+ dst[dirlen] = '/';
+ memcpy(dst+dirlen+1, name, namelen+1);
+ *pdst = dst;
+ return len;
+}
return fsp_set_smb_fname(to, from->fsp_name);
}
-/*
- * This routine improves performance for operations temporarily acting on a
- * full path. It is equivalent to the much more expensive
- *
- * talloc_asprintf(talloc_tos(), "%s/%s", dir, name)
- *
- * This actually does make a difference in metadata-heavy workloads (i.e. the
- * "standard" client.txt nbench run.
- */
-
-ssize_t full_path_tos(const char *dir, const char *name,
- char *tmpbuf, size_t tmpbuf_len,
- char **pdst, char **to_free)
-{
- size_t dirlen, namelen, len;
- char *dst;
-
- dirlen = strlen(dir);
- namelen = strlen(name);
- len = dirlen + namelen + 1;
-
- if (len < tmpbuf_len) {
- dst = tmpbuf;
- *to_free = NULL;
- } else {
- dst = talloc_array(talloc_tos(), char, len+1);
- if (dst == NULL) {
- return -1;
- }
- *to_free = dst;
- }
-
- memcpy(dst, dir, dirlen);
- dst[dirlen] = '/';
- memcpy(dst+dirlen+1, name, namelen+1);
- *pdst = dst;
- return len;
-}
-
/**
* Return a jenkins hash of a pathname on a connection.
*/
const char *name, uint32_t *p_name_hash);
NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
const struct smb_filename *smb_fname_in);
-ssize_t full_path_tos(const char *dir, const char *name,
- char *tmpbuf, size_t tmpbuf_len,
- char **pdst, char **to_free);
/* The following definitions come from smbd/ipc.c */