Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/modules/vfs_gpfs.c

    r599 r745  
    2323
    2424#include "includes.h"
     25
     26
     27
    2528
    2629#undef DBGC_CLASS
     
    3033#include "nfs4_acls.h"
    3134#include "vfs_gpfs.h"
     35
    3236
    3337struct gpfs_config_data {
    3438        bool sharemodes;
    3539        bool leases;
     40
    3641};
    3742
     
    117122        char real_pathname[PATH_MAX+1];
    118123        int buflen;
     124
     125
     126
     127
     128
     129
     130
    119131
    120132        full_path = talloc_asprintf(talloc_tos(), "%s/%s", path, name);
     
    323335static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
    324336        files_struct *fsp, uint32 security_info,
    325         SEC_DESC **ppdesc)
     337        **ppdesc)
    326338{
    327339        SMB4ACL_T *pacl = NULL;
     
    345357static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle,
    346358        const char *name,
    347         uint32 security_info, SEC_DESC **ppdesc)
     359        uint32 security_info, **ppdesc)
    348360{
    349361        SMB4ACL_T *pacl = NULL;
     
    461473}
    462474
    463 static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
     475static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const *psd)
    464476{
    465477        struct gpfs_acl *acl;
     
    489501}
    490502
    491 static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
     503static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const *psd)
    492504{
    493505        return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
     
    927939static int gpfs_set_xattr(struct vfs_handle_struct *handle,  const char *path,
    928940                           const char *name, const void *value, size_t size,  int flags){
     941
     942
     943
    929944        const char *attrstr = value;
    930945        unsigned int dosmode=0;
     
    940955        }
    941956
    942         if (size < 2 || attrstr[0] != '0' || attrstr[1] != 'x' ||
    943                                 sscanf(attrstr, "%x", &dosmode) != 1) {
    944                         DEBUG(1,("gpfs_set_xattr: Trying to set badly formed DOSATTRIB on file %s - %s\n", path, attrstr));
    945                 return False;
    946         }
     957        blob.data = (uint8_t *)attrstr;
     958        blob.length = size;
     959
     960        ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &dosattrib,
     961                        (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
     962
     963        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     964                DEBUG(1, ("gpfs_set_xattr: bad ndr decode "
     965                          "from EA on file %s: Error = %s\n",
     966                          path, ndr_errstr(ndr_err)));
     967                return false;
     968        }
     969
     970        if (dosattrib.version != 3) {
     971                DEBUG(1, ("gpfs_set_xattr: expected dosattrib version 3, got "
     972                          "%d\n", (int)dosattrib.version));
     973                return false;
     974        }
     975        if (!(dosattrib.info.info3.valid_flags & XATTR_DOSINFO_ATTRIB)) {
     976                DEBUG(10, ("gpfs_set_xattr: XATTR_DOSINFO_ATTRIB not "
     977                           "valid, ignoring\n"));
     978                return true;
     979        }
     980
     981        dosmode = dosattrib.info.info3.attrib;
    947982
    948983        attrs.winAttrs = 0;
    949         /*Just map RD_ONLY, ARCHIVE, SYSTEM and HIDDEN. Ignore the others*/
     984        /*Just map RD_ONLY, ARCHIVE, SYSTEM . Ignore the others*/
    950985        if (dosmode & FILE_ATTRIBUTE_ARCHIVE){
    951986                attrs.winAttrs |= GPFS_WINATTR_ARCHIVE;
     
    960995                        attrs.winAttrs |= GPFS_WINATTR_READONLY;
    961996        }
     997
     998
     999
    9621000
    9631001
     
    9841022        struct gpfs_winattr attrs;
    9851023        int ret = 0;
    986         ssize_t result;
    9871024
    9881025        DEBUG(10, ("gpfs_get_xattr: %s \n",path));
     
    10011038                }
    10021039
    1003                 DEBUG(1, ("gpfs_get_xattr: Get GPFS attributes failed: %d\n",ret));
     1040                DEBUG(1, ("gpfs_get_xattr: Get GPFS attributes failed: "
     1041                          "%d (%s)\n", ret, strerror(errno)));
    10041042                return -1;
    10051043        }
     
    10071045        DEBUG(10, ("gpfs_get_xattr:Got attributes: 0x%x\n",attrs.winAttrs));
    10081046
    1009         /*Just map RD_ONLY, ARCHIVE, SYSTEM and HIDDEN. Ignore the others*/
     1047        /*Just map RD_ONLY, ARCHIVE, SYSTEM. Ignore the others*/
    10101048        if (attrs.winAttrs & GPFS_WINATTR_ARCHIVE){
    10111049                dosmode |= FILE_ATTRIBUTE_ARCHIVE;
     
    10201058                dosmode |= FILE_ATTRIBUTE_READONLY;
    10211059        }
    1022 
    1023         result = snprintf(attrstr, size, "0x%x",
    1024                           dosmode & SAMBA_ATTRIBUTES_MASK) + 1;
    1025 
     1060        if (attrs.winAttrs & GPFS_WINATTR_SPARSE_FILE) {
     1061                dosmode |= FILE_ATTRIBUTE_SPARSE;
     1062        }
     1063
     1064        snprintf(attrstr, size, "0x%2.2x",
     1065                 (unsigned int)(dosmode & SAMBA_ATTRIBUTES_MASK));
    10261066        DEBUG(10, ("gpfs_get_xattr: returning %s\n",attrstr));
    1027         return result;
     1067        return ;
    10281068}
    10291069
     
    10501090                smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
    10511091                smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
     1092
    10521093        }
    10531094        return 0;
     
    10971138                smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
    10981139                smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
     1140
    10991141        }
    11001142        return 0;
     
    11421184}
    11431185
     1186
     1187
     1188
     1189
     1190
     1191
     1192
     1193
     1194
     1195
     1196
     1197
     1198
     1199
     1200
     1201
     1202
     1203
     1204
     1205
     1206
     1207
     1208
     1209
     1210
     1211
     1212
     1213
     1214
     1215
     1216
     1217
     1218
     1219
     1220
     1221
     1222
     1223
     1224
     1225
     1226
     1227
     1228
     1229
     1230
     1231
     1232
     1233
     1234
     1235
     1236
     1237
     1238
     1239
     1240
     1241
     1242
     1243
     1244
     1245
     1246
     1247
     1248
     1249
    11441250int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
    11451251                        const char *user)
    11461252{
    11471253        struct gpfs_config_data *config;
     1254
     1255
     1256
    11481257        int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
    11491258
     
    11641273                                        "leases", true);
    11651274
     1275
     1276
     1277
    11661278        SMB_VFS_HANDLE_SET_DATA(handle, config,
    11671279                                NULL, struct gpfs_config_data,
     
    11711283}
    11721284
    1173 
    1174 static int vfs_gpfs_ftruncate(struct vfs_handle_struct *handle,
    1175                               struct files_struct *fsp,
    1176                               SMB_OFF_T len)
    1177 {
    1178        int result;
    1179 
    1180        result = smbd_gpfs_ftrunctate(fsp->fh->fd, len);
    1181        if ((result == -1) && (errno == ENOSYS)) {
    1182                return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
    1183        }
    1184        return result;
    1185 }
     1285static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle,
     1286                                      enum timestamp_set_resolution *p_ts_res)
     1287{
     1288        struct gpfs_config_data *config;
     1289        uint32_t next;
     1290
     1291        next = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
     1292
     1293        SMB_VFS_HANDLE_GET_DATA(handle, config,
     1294                                struct gpfs_config_data,
     1295                                return next);
     1296
     1297        if (config->hsm) {
     1298                next |= FILE_SUPPORTS_REMOTE_STORAGE;
     1299        }
     1300        return next;
     1301}
     1302
     1303static int vfs_gpfs_open(struct vfs_handle_struct *handle,
     1304                         struct smb_filename *smb_fname, files_struct *fsp,
     1305                         int flags, mode_t mode)
     1306{
     1307        if (lp_parm_bool(fsp->conn->params->service, "gpfs", "syncio",
     1308                         false)) {
     1309                flags |= O_SYNC;
     1310        }
     1311        return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
     1312}
     1313
    11861314
    11871315static struct vfs_fn_pointers vfs_gpfs_fns = {
    11881316        .connect_fn = vfs_gpfs_connect,
     1317
    11891318        .kernel_flock = vfs_gpfs_kernel_flock,
    11901319        .linux_setlease = vfs_gpfs_setlease,
     
    12071336        .lstat = vfs_gpfs_lstat,
    12081337        .ntimes = vfs_gpfs_ntimes,
    1209         .ftruncate = vfs_gpfs_ftruncate,
     1338        .is_offline = vfs_gpfs_is_offline,
     1339        .aio_force = vfs_gpfs_aio_force,
     1340        .sendfile = vfs_gpfs_sendfile,
     1341        .open_fn = vfs_gpfs_open,
     1342        .ftruncate = vfs_gpfs_ftruncate
    12101343};
    12111344
Note: See TracChangeset for help on using the changeset viewer.