The Samba-Bugzilla – Attachment 8985 Details for
Bug 8912
Patch to allow write time caching to be turned off
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
unified patch for media harmony (samba 4.0.5)
patch.mediaharmony.s_4.0.5 (text/plain), 12.78 KB, created by
revomo
on 2013-06-19 14:29:14 UTC
(
hide
)
Description:
unified patch for media harmony (samba 4.0.5)
Filename:
MIME Type:
Creator:
revomo
Created:
2013-06-19 14:29:14 UTC
Size:
12.78 KB
patch
obsolete
>--- vfs_media_harmony.c 2012-12-04 11:07:44.000000000 +0100 >+++ media_harmony.c 2013-03-18 19:29:11.745924000 +0100 >@@ -94,12 +94,8 @@ > #define MH_ERR_DEBUG 0 > > static const char* MH_MODULE_NAME = "media_harmony"; >-static const char* MDB_FILENAME = "msmMMOB.mdb"; >-static const size_t MDB_FILENAME_LEN = 11; >-static const char* PMR_FILENAME = "msmFMID.pmr"; >-static const size_t PMR_FILENAME_LEN = 11; >-static const char* CREATING_DIRNAME = "Creating"; >-static const size_t CREATING_DIRNAME_LEN = 8; >+static const char* SUB_DIRNAME = "1"; >+static const size_t SUB_DIRNAME_LEN = 1; > static const char* AVID_MEDIAFILES_DIRNAME = "Avid MediaFiles"; > static const size_t AVID_MEDIAFILES_DIRNAME_LEN = 15; > static const char* OMFI_MEDIAFILES_DIRNAME = "OMFI MediaFiles"; >@@ -118,13 +114,11 @@ > char *dirpath; > char *clientPath; > bool isInMediaFiles; >- char *clientMDBFilename; >- char *clientPMRFilename; >- char *clientCreatingDirname; >+ char *clientSubDirname; > } mh_dirinfo_struct; > > >-/* Add "_<ip address>_<user name>" suffix to path or filename. >+/* Add "_<remote_adress>.01" suffix to path or filename. > * > * Success: return 0 > * Failure: set errno, path NULL, return -1 >@@ -139,7 +133,7 @@ > > raddr = tsocket_address_inet_addr_string( > handle->conn->sconn->remote_address, talloc_tos()); >- if (raddr == NULL) >+ if (raddr == NULL) > { > errno = ENOMEM; > status = -1; >@@ -147,11 +141,10 @@ > } > > /* talloc_asprintf_append uses talloc_realloc, which >- * frees original 'path' memory so we don't have to. >+ * frees original 'path' memory so we don't have to > */ >- *path = talloc_asprintf_append(*path, "_%s_%s", >- raddr, >- handle->conn->session_info->unix_info->sanitized_username); >+ *path = talloc_asprintf_append(*path, "_%s.01", >+ raddr); > if (*path == NULL) > { > DEBUG(MH_ERR_DEBUG, ("alloc_append_client_suffix " >@@ -330,53 +323,7 @@ > return transition_count; > } > >-/* Identifies MDB and PMR files at end of path. */ >-static bool is_avid_database( >- char *path, >- size_t path_len, >- const char *avid_db_filename, >- const size_t avid_db_filename_len) >-{ >- bool ret = False; >- >- DEBUG(MH_INFO_DEBUG, ("Entering with path '%s', " >- "avid_db_filename '%s', " >- "path_len '%i', " >- "avid_db_filename_len '%i'\n", >- path, avid_db_filename, >- (int)path_len, (int)avid_db_filename_len)); >- >- if ( >- path_len > avid_db_filename_len >- && >- strcmp(&path[path_len - avid_db_filename_len], >- avid_db_filename) == 0 >- && >- ( >- path[path_len - avid_db_filename_len - 1] == '/' >- || >- path_len > avid_db_filename_len >- + APPLE_DOUBLE_PREFIX_LEN >- && >- path[path_len - avid_db_filename_len >- - APPLE_DOUBLE_PREFIX_LEN - 1] == '/' >- && >- is_apple_double(&path[path_len >- - avid_db_filename_len >- - APPLE_DOUBLE_PREFIX_LEN]) >- ) >- ) >- { >- ret = True; >- } >- DEBUG(MH_INFO_DEBUG, ("Leaving with ret '%s'\n", >- ret == True ? "True" : "False")); >- return ret; >-} >- >- >-/* Add client suffix to paths to MDB_FILENAME, PMR_FILENAME and >- * CREATING_SUBDIRNAME. >+/* Add client suffix to path SUB_SUBDIRNAME. > * > * Caller must free newPath. > * >@@ -388,8 +335,8 @@ > const char *path, > char **newPath) > { >- /* replace /CREATING_DIRNAME/ or /._CREATING_DIRNAME/ >- * directory in path - potentially in middle of path >+ /* replace /1/ or /._1/ >+ * directory in path > * - with suffixed name. > */ > int status = 0; >@@ -397,9 +344,8 @@ > size_t intermPathLen; > > DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path)); >- > *newPath = talloc_strdup(ctx, path); >- if (*newPath == NULL) >+ if (*newPath == NULL) > { > DEBUG(MH_ERR_DEBUG, ("alloc_get_client_path ENOMEM #1\n")); > errno = ENOMEM; >@@ -408,12 +354,13 @@ > } > DEBUG(MH_INFO_DEBUG, ("newPath #1 %s\n", *newPath)); > if ( >- (pathPtr = strstr(path, CREATING_DIRNAME)) != NULL >+ /*strstr returns pointer */ >+ (pathPtr = strstr(path, SUB_DIRNAME)) != NULL > && > ( >- *(pathPtr + CREATING_DIRNAME_LEN) == '\0' >+ *(pathPtr + SUB_DIRNAME_LEN) == '\0' > || >- *(pathPtr + CREATING_DIRNAME_LEN) == '/' >+ *(pathPtr + SUB_DIRNAME_LEN) == '/' > ) > && > ( >@@ -430,7 +377,7 @@ > ) > { > /* Insert client suffix into path. */ >- (*newPath)[pathPtr - path + CREATING_DIRNAME_LEN] = '\0'; >+ (*newPath)[pathPtr - path + SUB_DIRNAME_LEN] = '\0'; > DEBUG(MH_INFO_DEBUG, ("newPath #2 %s\n", *newPath)); > > if ((status = alloc_append_client_suffix(handle, newPath))) >@@ -439,8 +386,8 @@ > } > > DEBUG(MH_INFO_DEBUG, ("newPath #3 %s\n", *newPath)); >- *newPath = talloc_strdup_append(*newPath, >- pathPtr + CREATING_DIRNAME_LEN); >+ *newPath = talloc_strdup_append(*newPath, >+ pathPtr + SUB_DIRNAME_LEN); > if (*newPath == NULL) > { > DEBUG(MH_ERR_DEBUG, ("alloc_get_client_path " >@@ -451,26 +398,6 @@ > } > DEBUG(MH_INFO_DEBUG, ("newPath #4 %s\n", *newPath)); > } >- >- /* replace /MDB_FILENAME or /PMR_FILENAME or /._MDB_FILENAME >- * or /._PMR_FILENAME at newPath end with suffixed name. >- */ >- intermPathLen = strlen(*newPath); >- if ( >- is_avid_database(*newPath, intermPathLen, >- MDB_FILENAME, MDB_FILENAME_LEN) >- || >- is_avid_database(*newPath, intermPathLen, >- PMR_FILENAME, PMR_FILENAME_LEN) >- ) >- { >- DEBUG(MH_INFO_DEBUG, ("newPath #5 %s\n", *newPath)); >- if ((status = alloc_append_client_suffix(handle, newPath))) >- { >- goto out; >- } >- DEBUG(MH_INFO_DEBUG, ("newPath #6 %s\n", *newPath)); >- } > out: > /* newPath must be freed in caller. */ > DEBUG(MH_INFO_DEBUG, ("Leaving with *newPath '%s'\n", *newPath)); >@@ -544,92 +471,6 @@ > err: > return status; > } >- >-/* >- * Replace mtime on clientFname with mtime from client-suffixed >- * equivalent, if it exists. >- * >- * Success: return 0 >- * Failure: set errno, return -1 >- */ >-static int set_fake_mtime(vfs_handle_struct *handle, >- TALLOC_CTX *ctx, >- struct smb_filename **clientFname, >- int (*statFn)(const char *, SMB_STRUCT_STAT *, bool)) >-{ >- int status = 0; >- char *statPath; >- SMB_STRUCT_STAT fakeStat; >- int copy_len; >- >- DEBUG(MH_INFO_DEBUG, ("Entering with (*clientFname)->base_name " >- "'%s', (*clientFname)->st.st_ex_mtime %s", >- (*clientFname)->base_name, >- ctime(&((*clientFname)->st.st_ex_mtime.tv_sec)))); >- >- if ( >- depth_from_media_dir(AVID_MXF_DIRNAME, >- AVID_MXF_DIRNAME_LEN, >- (*clientFname)->base_name) >- != 1 >- && >- depth_from_media_dir(OMFI_MEDIAFILES_DIRNAME, >- OMFI_MEDIAFILES_DIRNAME_LEN, >- (*clientFname)->base_name) >- != 0 >- ) >- { >- goto out; >- } >- >- copy_len = strlen((*clientFname)->base_name); >- >- /* Hack to deal with occasional "Avid MediaFiles/MXF/1/." paths. >- * We know we're under a media dir, so paths are at least 2 chars >- * long. >- */ >- if ((*clientFname)->base_name[copy_len - 1] == '.' && >- (*clientFname)->base_name[copy_len - 2] == '/') >- { >- copy_len -= 2; >- } >- >- if (((statPath = talloc_strndup(ctx, >- (*clientFname)->base_name, copy_len)) == NULL)) >- { >- errno = ENOMEM; >- status = -1; >- goto err; >- } >- if ((status = alloc_append_client_suffix(handle, &statPath))) >- { >- goto err; >- } >- >- DEBUG(MH_INFO_DEBUG, ("Fake stat'ing '%s'\n", statPath)); >- if (statFn(statPath, &fakeStat, >- lp_fake_dir_create_times(SNUM(handle->conn)))) >- { >- /* This can fail for legitimate reasons - i.e. the >- * fakeStat directory doesn't exist, which is okay >- * - so we don't set status. But if it does fail, >- * we need to skip over the mtime assignment. >- */ >- goto err; >- } >- >- DEBUG(MH_INFO_DEBUG, ("Setting fake mtime from '%s'\n", statPath)); >- (*clientFname)->st.st_ex_mtime = fakeStat.st_ex_mtime; >-err: >- TALLOC_FREE(statPath); >-out: >- DEBUG(MH_INFO_DEBUG, ("Leaving with (*clientFname)->base_name " >- "'%s', (*clientFname)->st.st_ex_mtime %s", >- (*clientFname)->base_name, >- ctime(&((*clientFname)->st.st_ex_mtime.tv_sec)))); >- return status; >-} >- > /* > * Success: return 0 > * Failure: set errno, return -1 >@@ -693,35 +534,17 @@ > if (!is_in_media_files(fname)) > { > (*dirInfo)->clientPath = NULL; >- (*dirInfo)->clientMDBFilename = NULL; >- (*dirInfo)->clientPMRFilename = NULL; >- (*dirInfo)->clientCreatingDirname = NULL; >+ (*dirInfo)->clientSubDirname = NULL; > (*dirInfo)->isInMediaFiles = False; > goto out; > } > > (*dirInfo)->isInMediaFiles = True; >- >+ > if (alloc_set_client_dirinfo_path(handle, > *dirInfo, >- &((*dirInfo)->clientMDBFilename), >- MDB_FILENAME)) >- { >- goto err; >- } >- >- if (alloc_set_client_dirinfo_path(handle, >- *dirInfo, >- &((*dirInfo)->clientPMRFilename), >- PMR_FILENAME)) >- { >- goto err; >- } >- >- if (alloc_set_client_dirinfo_path(handle, >- *dirInfo, >- &((*dirInfo)->clientCreatingDirname), >- CREATING_DIRNAME)) >+ &((*dirInfo)->clientSubDirname), >+ SUB_DIRNAME)) > { > goto err; > } >@@ -808,7 +631,7 @@ > const char *mask, > uint32 attr) > { >- struct mh_dirinfo_struct *dirInfo; >+ struct mh_dirinfo_struct *dirInfo = NULL; > DIR *dirstream; > > DEBUG(MH_INFO_DEBUG, ("Entering with fsp->fsp_name->base_name '%s'\n", >@@ -832,11 +655,6 @@ > goto out; > } > >- if (set_fake_mtime(handle, fsp, &(fsp->fsp_name), sys_stat)) >- { >- goto err; >- } >- > out: > DEBUG(MH_INFO_DEBUG, ("Leaving with dirInfo->dirpath '%s', " > "dirInfo->clientPath '%s', " >@@ -855,11 +673,8 @@ > } > > /* >- * skip MDB_FILENAME and PMR_FILENAME filenames and CREATING_DIRNAME >- * directory, skip other client's suffixed MDB_FILENAME and PMR_FILENAME >- * filenames and CREATING_DIRNAME directory, replace this client's >- * suffixed MDB_FILENAME and PMR_FILENAME filenames and CREATING_DIRNAME >- * directory with non suffixed. >+ * skip own SUB_DIRNAME directory >+ * replace own SUB_DIRNAME directory with non suffixed. > * > * Success: return dirent > * End of data: return NULL >@@ -878,15 +693,11 @@ > DEBUG(MH_INFO_DEBUG, ("dirInfo->dirpath '%s', " > "dirInfo->clientPath '%s', " > "dirInfo->isInMediaFiles '%s', " >- "dirInfo->clientMDBFilename '%s', " >- "dirInfo->clientPMRFilename '%s', " >- "dirInfo->clientCreatingDirname '%s'\n", >+ "dirInfo->clientSubDirname '%s'\n", > dirInfo->dirpath, > dirInfo->clientPath, > dirInfo->isInMediaFiles ? "True" : "False", >- dirInfo->clientMDBFilename, >- dirInfo->clientPMRFilename, >- dirInfo->clientCreatingDirname)); >+ dirInfo->clientSubDirname)); > > if (! dirInfo->isInMediaFiles) > { >@@ -919,73 +730,36 @@ > isAppleDouble = False; > } > >- /* skip Avid-special files with no client suffix */ >+ /* ? skip "/1/ subdirectory with no client suffix */ > if ( >- strcmp(dname, MDB_FILENAME) == 0 >- || >- strcmp(dname, PMR_FILENAME) == 0 >- || >- strcmp(dname, CREATING_DIRNAME) == 0 >+ strcmp(dname, SUB_DIRNAME) == 0 > ) > { > skip = True; > } > /* chop client suffix off this client's suffixed files */ >- else if (strcmp(dname, dirInfo->clientMDBFilename) == 0) >- { >- if (isAppleDouble) >- { >- d->d_name[MDB_FILENAME_LEN >- + APPLE_DOUBLE_PREFIX_LEN] = '\0'; >- } >- else >- { >- d->d_name[MDB_FILENAME_LEN] = '\0'; >- } >- } >- else if (strcmp(dname, dirInfo->clientPMRFilename) == 0) >- { >- if (isAppleDouble) >- { >- d->d_name[PMR_FILENAME_LEN >- + APPLE_DOUBLE_PREFIX_LEN] = '\0'; >- } >- else >- { >- d->d_name[PMR_FILENAME_LEN] = '\0'; >- } >- } >- else if (strcmp(dname, dirInfo->clientCreatingDirname) >+ else if (strcmp(dname, dirInfo->clientSubDirname) > == 0) > { > if (isAppleDouble) > { >- d->d_name[CREATING_DIRNAME_LEN >+ d->d_name[SUB_DIRNAME_LEN > + APPLE_DOUBLE_PREFIX_LEN] = '\0'; > } > else > { >- d->d_name[CREATING_DIRNAME_LEN] = '\0'; >+ d->d_name[SUB_DIRNAME_LEN] = '\0'; > } > } > /* >- * Anything that starts as an Avid-special file >- * that's made it this far should be skipped. This >- * is different from the original behaviour, which >- * only skipped other client's suffixed files. >+ * Set to False to see another clients subdirectories > */ > else if ( >- strncmp(MDB_FILENAME, dname, >- MDB_FILENAME_LEN) == 0 >- || >- strncmp(PMR_FILENAME, dname, >- PMR_FILENAME_LEN) == 0 >- || >- strncmp(CREATING_DIRNAME, dname, >- CREATING_DIRNAME_LEN) == 0 >+ strncmp(SUB_DIRNAME, dname, >+ SUB_DIRNAME_LEN) == 0 > ) > { >- skip = True; >+ skip = False; > } > } > while (skip); >@@ -1387,10 +1161,6 @@ > { > goto err; > } >- if ((status = set_fake_mtime(handle, ctx, &clientFname, sys_stat))) >- { >- goto err; >- } > > /* Unlike functions with const smb_filename, we have to > * modify smb_fname itself to pass our info back up. >@@ -1442,10 +1212,6 @@ > goto err; > } > >- if ((status = set_fake_mtime(handle, ctx, &clientFname, sys_lstat))) >- { >- goto err; >- } > /* Unlike functions with const smb_filename, we have to > * modify smb_fname itself to pass our info back up. > */ >@@ -1490,7 +1256,9 @@ > out: > DEBUG(MH_INFO_DEBUG, ("Leaving with fsp->fsp_name->st.st_ex_mtime " > "%s", >- ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)))); >+ fsp->fsp_name != NULL ? >+ ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)) : >+ "0")); > return status; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8912
:
7516
|
7517
|
7522
|
8971
|
8985
|
9037