components/samba/samba/patches/vfs_samfs.c.patch
changeset 4109 b8f324d4e07c
parent 1207 1d0be3a9fc06
equal deleted inserted replaced
4108:9738d7207050 4109:b8f324d4e07c
     1 bug #5780
     1 Source: Oracle Solaris (based on VFS module written by [email protected])
       
     2 Shared with community as Samba.org bug #5780 :
       
     3 https://bugzilla.samba.org/show_bug.cgi?id=5780
     2 
     4 
     3 diff --git a/source3/Makefile.in b/source3/Makefile.in
     5 diff --git a/source3/Makefile.in b/source3/Makefile.in
     4 index 425aa2b..db1d809 100644
     6 index 425aa2b..db1d809 100644
     5 --- a/source3/Makefile.in
     7 --- a/source3/Makefile.in
     6 +++ b/source3/Makefile.in
     8 +++ b/source3/Makefile.in
    39 diff --git a/source3/modules/vfs_samfs.c b/source3/modules/vfs_samfs.c
    41 diff --git a/source3/modules/vfs_samfs.c b/source3/modules/vfs_samfs.c
    40 new file mode 100644
    42 new file mode 100644
    41 index 0000000..9370768
    43 index 0000000..9370768
    42 --- /dev/null	2012-07-16 09:13:54.000000000 -0700
    44 --- /dev/null	2012-07-16 09:13:54.000000000 -0700
    43 +++ b/source3/modules/vfs_samfs.c	2012-07-16 09:21:00.168046000 -0700
    45 +++ b/source3/modules/vfs_samfs.c	2012-07-16 09:21:00.168046000 -0700
    44 @@ -0,0 +1,181 @@
    46 @@ -0,0 +1,179 @@
    45 +/*
    47 +/*
    46 + * Support for offline files with Sun SAM-QFS
    48 + * Support for offline files with Sun SAM-QFS
    47 + *
    49 + *
    48 + * Copyright (C) Dirk Nitschke, 2009
    50 + * Copyright (C) Dirk Nitschke, 2009
    49 + *
    51 + *
    69 +#include "smbd/smbd.h"
    71 +#include "smbd/smbd.h"
    70 +/*
    72 +/*
    71 + * Include files for Sun SAM-QFS
    73 + * Include files for Sun SAM-QFS
    72 + *
    74 + *
    73 + */
    75 + */
    74 +#include <pub/stat.h>
    76 +#include <samfs/stat.h>
    75 +#include <pub/lib.h>
    77 +#include <samfs/lib.h>
    76 +
    78 +
    77 +#undef DBGC_CLASS
    79 +#undef DBGC_CLASS
    78 +#define DBGC_CLASS DBGC_VFS
    80 +#define DBGC_CLASS DBGC_VFS
    79 +
    81 +
    80 +#define SAMFS_MODULE_NAME "samfs"
    82 +#define SAMFS_MODULE_NAME "samfs"
   141 +	 */
   143 +	 */
   142 +	if (SS_ISSEGMENT_F(file_info.attr)) {
   144 +	if (SS_ISSEGMENT_F(file_info.attr)) {
   143 +		number_of_segments = NUM_SEGS(&file_info);
   145 +		number_of_segments = NUM_SEGS(&file_info);
   144 +		seg_info_ptr = (struct sam_stat *)TALLOC_ZERO_ARRAY(talloc_tos(),
   146 +		seg_info_ptr = (struct sam_stat *)TALLOC_ZERO_ARRAY(talloc_tos(),
   145 +						struct sam_stat, number_of_segments);
   147 +						struct sam_stat, number_of_segments);
   146 +		if (seg_info_ptr != NULL) {
   148 +		if (seg_info_ptr == NULL) {
   147 +			DEBUG(10,("samfs_is_offline: cannot talloc for "
   149 +			DEBUG(10,("samfs_is_offline: cannot talloc for "
   148 +				"segment stat info %s\nAssuming file is offline.\n",
   150 +				"segment stat info %s\nAssuming file is offline.\n",
   149 +				path));
   151 +				path));
   150 +			return true;
   152 +			return true;
   151 +		}
   153 +		}
   177 +	}
   179 +	}
   178 +	return (number_of_segments_offline) ? true : false ;
   180 +	return (number_of_segments_offline) ? true : false ;
   179 +}
   181 +}
   180 +
   182 +
   181 +/*
   183 +/*
   182 + * release a file-command to SAM-stagger
       
   183 + */
       
   184 +extern int sam_release(const char *path, const char *command);
       
   185 +
       
   186 +/*
       
   187 + * samfs_set_offline()
   184 + * samfs_set_offline()
   188 + *
   185 + *
   189 + * Release the local file in the sense of SAM-QFS.
   186 + * Release the local file in the sense of SAM-QFS.
   190 + * See sam_release(3) for details.
   187 + * See sam_release(3) for details.
   191 + *
   188 + *
   200 +        if (!NT_STATUS_IS_OK(status)) {
   197 +        if (!NT_STATUS_IS_OK(status)) {
   201 +                errno = map_errno_from_nt_status(status);
   198 +                errno = map_errno_from_nt_status(status);
   202 +                return false;
   199 +                return false;
   203 +        }
   200 +        }
   204 +
   201 +
       
   202 +	/*
       
   203 +	 * release a file-command to SAM-stager
       
   204 +	 */
   205 +	result = sam_release(path, "i");
   205 +	result = sam_release(path, "i");
   206 +	if (result != 0) {
   206 +	if (result != 0) {
   207 +		DEBUG(10,("samfs_set_offline: sam_release %s returned %s\n",
   207 +		DEBUG(10,("samfs_set_offline: sam_release %s returned %s\n",
   208 +			path, strerror(errno)));
   208 +			path, strerror(errno)));
   209 +		return -1;
   209 +		return -1;