summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-14 15:34:42 +0200
committerVolker Lendecke <vl@samba.org>2009-05-26 17:48:23 +0200
commit49ca690b4b22ee6e597179059c9442e94c5bd423 (patch)
treead233a9bcfee2d467824290448ca366219dbd301 /source3/modules
parent52f2f9449f8d53aa9181d656a4b54a007c80fa81 (diff)
downloadsamba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.gz
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.bz2
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.zip
Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/nfs4_acls.c11
-rw-r--r--source3/modules/vfs_acl_tdb.c4
-rw-r--r--source3/modules/vfs_acl_xattr.c4
-rw-r--r--source3/modules/vfs_afsacl.c6
-rw-r--r--source3/modules/vfs_commit.c2
-rw-r--r--source3/modules/vfs_default.c44
-rw-r--r--source3/modules/vfs_fake_perms.c20
-rw-r--r--source3/modules/vfs_fileid.c4
-rw-r--r--source3/modules/vfs_gpfs.c4
-rw-r--r--source3/modules/vfs_hpuxacl.c2
-rw-r--r--source3/modules/vfs_netatalk.c12
-rw-r--r--source3/modules/vfs_recycle.c8
-rw-r--r--source3/modules/vfs_shadow_copy2.c2
-rw-r--r--source3/modules/vfs_streams_depot.c10
-rw-r--r--source3/modules/vfs_streams_xattr.c54
-rw-r--r--source3/modules/vfs_tsmsm.c15
16 files changed, 103 insertions, 99 deletions
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 462e59313a..04ea73f45e 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -289,10 +289,11 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf,
* shouldn't alloc 0 for
* win */
- uid_to_sid(&sid_owner, sbuf->st_uid);
- gid_to_sid(&sid_group, sbuf->st_gid);
+ uid_to_sid(&sid_owner, sbuf->st_ex_uid);
+ gid_to_sid(&sid_group, sbuf->st_ex_gid);
- if (smbacl4_nfs42win(mem_ctx, theacl, &sid_owner, &sid_group, S_ISDIR(sbuf->st_mode),
+ if (smbacl4_nfs42win(mem_ctx, theacl, &sid_owner, &sid_group,
+ S_ISDIR(sbuf->st_ex_mode),
&nt_ace_list, &good_aces)==False) {
DEBUG(8,("smbacl4_nfs42win failed\n"));
return map_nt_error_from_unix(errno);
@@ -733,8 +734,8 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
DEBUG(8, ("unpack_nt_owners failed"));
return status;
}
- if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) ||
- ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) {
+ if (((newUID != (uid_t)-1) && (sbuf.st_ex_uid != newUID)) ||
+ ((newGID != (gid_t)-1) && (sbuf.st_ex_gid != newGID))) {
if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) {
DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index a77f6d60f4..463250a9ed 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -414,8 +414,8 @@ static struct security_descriptor *default_file_sd(TALLOC_CTX *mem_ctx,
struct security_ace *pace = NULL;
struct security_acl *pacl = NULL;
- uid_to_sid(&owner_sid, psbuf->st_uid);
- gid_to_sid(&group_sid, psbuf->st_gid);
+ uid_to_sid(&owner_sid, psbuf->st_ex_uid);
+ gid_to_sid(&group_sid, psbuf->st_ex_gid);
pace = TALLOC_ARRAY(mem_ctx, struct security_ace, 2);
if (!pace) {
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 49e4899879..05156f8456 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -282,8 +282,8 @@ static struct security_descriptor *default_file_sd(TALLOC_CTX *mem_ctx,
struct security_ace *pace = NULL;
struct security_acl *pacl = NULL;
- uid_to_sid(&owner_sid, psbuf->st_uid);
- gid_to_sid(&group_sid, psbuf->st_gid);
+ uid_to_sid(&owner_sid, psbuf->st_ex_uid);
+ gid_to_sid(&group_sid, psbuf->st_ex_gid);
pace = TALLOC_ARRAY(mem_ctx, struct security_ace, 2);
if (!pace) {
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 8c89d2fd9f..e537f01b03 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -599,8 +599,8 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
struct afs_ace *afs_ace;
- uid_to_sid(&owner_sid, psbuf->st_uid);
- gid_to_sid(&group_sid, psbuf->st_gid);
+ uid_to_sid(&owner_sid, psbuf->st_ex_uid);
+ gid_to_sid(&group_sid, psbuf->st_ex_gid);
if (afs_acl->num_aces) {
nt_ace_list = TALLOC_ARRAY(mem_ctx, SEC_ACE, afs_acl->num_aces);
@@ -626,7 +626,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
continue;
}
- if (S_ISDIR(psbuf->st_mode))
+ if (S_ISDIR(psbuf->st_ex_mode))
afs_to_nt_dir_rights(afs_ace->rights, &nt_rights,
&flag);
else
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index a8105e021e..c22e8161d7 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -220,7 +220,7 @@ static int commit_open(
if (SMB_VFS_FSTAT(fsp, &st) == -1) {
return -1;
}
- c->eof = st.st_size;
+ c->eof = st.st_ex_size;
}
return 0;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index aa207056b3..fe63d5001a 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -430,7 +430,7 @@ static int copy_reg(const char *source, const char *dest)
if (sys_lstat (source, &source_stats) == -1)
return -1;
- if (!S_ISREG (source_stats.st_mode))
+ if (!S_ISREG (source_stats.st_ex_mode))
return -1;
if((ifd = sys_open (source, O_RDONLY, 0)) < 0)
@@ -455,9 +455,9 @@ static int copy_reg(const char *source, const char *dest)
*/
#ifdef HAVE_FCHOWN
- if ((fchown(ofd, source_stats.st_uid, source_stats.st_gid) == -1) && (errno != EPERM))
+ if ((fchown(ofd, source_stats.st_ex_uid, source_stats.st_ex_gid) == -1) && (errno != EPERM))
#else
- if ((chown(dest, source_stats.st_uid, source_stats.st_gid) == -1) && (errno != EPERM))
+ if ((chown(dest, source_stats.st_ex_uid, source_stats.st_ex_gid) == -1) && (errno != EPERM))
#endif
goto err;
@@ -467,9 +467,9 @@ static int copy_reg(const char *source, const char *dest)
*/
#if defined(HAVE_FCHMOD)
- if (fchmod (ofd, source_stats.st_mode & 07777))
+ if (fchmod (ofd, source_stats.st_ex_mode & 07777))
#else
- if (chmod (dest, source_stats.st_mode & 07777))
+ if (chmod (dest, source_stats.st_ex_mode & 07777))
#endif
goto err;
@@ -483,8 +483,8 @@ static int copy_reg(const char *source, const char *dest)
{
struct utimbuf tv;
- tv.actime = source_stats.st_atime;
- tv.modtime = source_stats.st_mtime;
+ tv.actime = convert_timespec_to_time_t(source_stats.st_ex_atime);
+ tv.modtime = convert_timespec_to_time_t(source_stats.st_ex_mtime);
utime(dest, &tv);
}
@@ -575,13 +575,13 @@ static uint64_t vfswrap_get_alloc_size(vfs_handle_struct *handle,
START_PROFILE(syscall_get_alloc_size);
- if(S_ISDIR(sbuf->st_mode)) {
+ if(S_ISDIR(sbuf->st_ex_mode)) {
result = 0;
goto out;
}
#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
- result = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_blocks;
+ result = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_ex_blocks;
#else
result = get_file_size_stat(sbuf);
#endif
@@ -777,18 +777,18 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
if (SMB_VFS_FSTAT(fsp, &st) == -1)
return -1;
- space_to_write = len - st.st_size;
+ space_to_write = len - st.st_ex_size;
#ifdef S_ISFIFO
- if (S_ISFIFO(st.st_mode))
+ if (S_ISFIFO(st.st_ex_mode))
return 0;
#endif
- if (st.st_size == len)
+ if (st.st_ex_size == len)
return 0;
/* Shrink - just ftruncate. */
- if (st.st_size > len)
+ if (st.st_ex_size > len)
return sys_ftruncate(fsp->fh->fd, len);
/* available disk space is enough or not? */
@@ -806,10 +806,10 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
}
/* Write out the real space on disk. */
- if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size)
+ if (SMB_VFS_LSEEK(fsp, st.st_ex_size, SEEK_SET) != st.st_ex_size)
return -1;
- space_to_write = len - st.st_size;
+ space_to_write = len - st.st_ex_size;
memset(zero_space, '\0', sizeof(zero_space));
while ( space_to_write > 0) {
@@ -872,18 +872,18 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O
}
#ifdef S_ISFIFO
- if (S_ISFIFO(st.st_mode)) {
+ if (S_ISFIFO(st.st_ex_mode)) {
result = 0;
goto done;
}
#endif
- if (st.st_size == len) {
+ if (st.st_ex_size == len) {
result = 0;
goto done;
}
- if (st.st_size > len) {
+ if (st.st_ex_size > len) {
/* the sys_ftruncate should have worked */
goto done;
}
@@ -1051,8 +1051,8 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle,
* blob */
ZERO_STRUCT(key);
- key.devid = sbuf->st_dev;
- key.inode = sbuf->st_ino;
+ key.devid = sbuf->st_ex_dev;
+ key.inode = sbuf->st_ex_ino;
/* key.extid is unused by default. */
return key;
@@ -1088,7 +1088,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
return map_nt_error_from_unix(errno);
}
- if (S_ISDIR(sbuf.st_mode)) {
+ if (S_ISDIR(sbuf.st_ex_mode)) {
goto done;
}
@@ -1098,7 +1098,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
return NT_STATUS_NO_MEMORY;
}
- streams->size = sbuf.st_size;
+ streams->size = sbuf.st_ex_size;
streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
streams->name = talloc_strdup(streams, "::$DATA");
diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c
index 2989322147..cc3ab6220d 100644
--- a/source3/modules/vfs_fake_perms.c
+++ b/source3/modules/vfs_fake_perms.c
@@ -32,13 +32,13 @@ static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STR
ret = SMB_VFS_NEXT_STAT(handle, fname, sbuf);
if (ret == 0) {
- if (S_ISDIR(sbuf->st_mode)) {
- sbuf->st_mode = S_IFDIR | S_IRWXU;
+ if (S_ISDIR(sbuf->st_ex_mode)) {
+ sbuf->st_ex_mode = S_IFDIR | S_IRWXU;
} else {
- sbuf->st_mode = S_IRWXU;
+ sbuf->st_ex_mode = S_IRWXU;
}
- sbuf->st_uid = handle->conn->server_info->utok.uid;
- sbuf->st_gid = handle->conn->server_info->utok.gid;
+ sbuf->st_ex_uid = handle->conn->server_info->utok.uid;
+ sbuf->st_ex_gid = handle->conn->server_info->utok.gid;
}
return ret;
@@ -50,13 +50,13 @@ static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_ST
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
if (ret == 0) {
- if (S_ISDIR(sbuf->st_mode)) {
- sbuf->st_mode = S_IFDIR | S_IRWXU;
+ if (S_ISDIR(sbuf->st_ex_mode)) {
+ sbuf->st_ex_mode = S_IFDIR | S_IRWXU;
} else {
- sbuf->st_mode = S_IRWXU;
+ sbuf->st_ex_mode = S_IRWXU;
}
- sbuf->st_uid = handle->conn->server_info->utok.uid;
- sbuf->st_gid = handle->conn->server_info->utok.gid;
+ sbuf->st_ex_uid = handle->conn->server_info->utok.uid;
+ sbuf->st_ex_gid = handle->conn->server_info->utok.gid;
}
return ret;
}
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index 8152c5477e..93b71a4dc0 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -237,8 +237,8 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
struct fileid_handle_data,
return id);
- id.devid = data->device_mapping_fn(data, sbuf->st_dev);
- id.inode = sbuf->st_ino;
+ id.devid = data->device_mapping_fn(data, sbuf->st_ex_dev);
+ id.inode = sbuf->st_ex_ino;
return id;
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 7ef969d04b..2e4e7ede55 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -846,7 +846,7 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo
}
/* avoid chmod() if possible, to preserve acls */
- if ((st.st_mode & ~S_IFMT) == mode) {
+ if ((st.st_ex_mode & ~S_IFMT) == mode) {
return 0;
}
@@ -866,7 +866,7 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t
}
/* avoid chmod() if possible, to preserve acls */
- if ((st.st_mode & ~S_IFMT) == mode) {
+ if ((st.st_ex_mode & ~S_IFMT) == mode) {
return 0;
}
diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c
index f9293405fb..7d20a73d7b 100644
--- a/source3/modules/vfs_hpuxacl.c
+++ b/source3/modules/vfs_hpuxacl.c
@@ -252,7 +252,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
goto done;
}
- if (S_ISDIR(s.st_mode)) {
+ if (S_ISDIR(s.st_ex_mode)) {
HPUX_ACL_T other_acl;
int other_count;
SMB_ACL_TYPE_T other_type;
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index e2fa0fb88a..ed35922359 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -82,7 +82,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fnam
sys_lstat(*orig_path, orig_info);
- if (S_ISDIR(orig_info->st_mode)) {
+ if (S_ISDIR(orig_info->st_ex_mode)) {
*adbl_path = talloc_asprintf(ctx, "%s/%s/%s/",
path, &fname[ptr0], APPLEDOUBLE);
} else {
@@ -242,7 +242,7 @@ static int atalk_rename(struct vfs_handle_struct *handle, const char *oldname, c
&adbl_info, &orig_info) != 0)
goto exit_rename;
- if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) {
+ if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", adbl_path));
goto exit_rename;
}
@@ -298,7 +298,7 @@ static int atalk_unlink(struct vfs_handle_struct *handle, const char *path)
&adbl_info, &orig_info) != 0)
goto exit_unlink;
- if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) {
+ if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", adbl_path));
goto exit_unlink;
}
@@ -330,7 +330,7 @@ static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_
&adbl_info, &orig_info) != 0)
goto exit_chmod;
- if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) {
+ if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", orig_path));
goto exit_chmod;
}
@@ -362,7 +362,7 @@ static int atalk_chown(struct vfs_handle_struct *handle, const char *path, uid_t
&adbl_info, &orig_info) != 0)
goto exit_chown;
- if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) {
+ if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", orig_path));
goto exit_chown;
}
@@ -396,7 +396,7 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_
&adbl_info, &orig_info) != 0)
goto exit_lchown;
- if (!S_ISDIR(orig_info.st_mode) && !S_ISREG(orig_info.st_mode)) {
+ if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", orig_path));
goto exit_lchown;
}
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 2b0edcdb4a..f1791aa6b1 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -215,7 +215,7 @@ static bool recycle_directory_exist(vfs_handle_struct *handle, const char *dname
SMB_STRUCT_STAT st;
if (SMB_VFS_NEXT_STAT(handle, dname, &st) == 0) {
- if (S_ISDIR(st.st_mode)) {
+ if (S_ISDIR(st.st_ex_mode)) {
return True;
}
}
@@ -228,7 +228,7 @@ static bool recycle_file_exist(vfs_handle_struct *handle, const char *fname)
SMB_STRUCT_STAT st;
if (SMB_VFS_NEXT_STAT(handle, fname, &st) == 0) {
- if (S_ISREG(st.st_mode)) {
+ if (S_ISREG(st.st_ex_mode)) {
return True;
}
}
@@ -251,7 +251,7 @@ static SMB_OFF_T recycle_get_file_size(vfs_handle_struct *handle, const char *fn
return (SMB_OFF_T)0;
}
- return(st.st_size);
+ return(st.st_ex_size);
}
/**
@@ -402,7 +402,7 @@ static void recycle_do_touch(vfs_handle_struct *handle, const char *fname,
return;
}
ft.atime = timespec_current(); /* atime */
- ft.mtime = touch_mtime ? ft.atime : get_mtimespec(&st); /* mtime */
+ ft.mtime = touch_mtime ? ft.atime : st.st_ex_mtime; /* mtime */
become_root();
ret = SMB_VFS_NEXT_NTIMES(handle, fname, &ft);
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 9543af32b9..acfac57b51 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -314,7 +314,7 @@ static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUC
if (shash == 0) {
shash = 1;
}
- sbuf->st_ino ^= shash;
+ sbuf->st_ex_ino ^= shash;
}
}
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index e5a70b1a49..72affe402a 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -182,7 +182,7 @@ static char *stream_dir(vfs_handle_struct *handle, const char *base_path,
if (SMB_VFS_NEXT_STAT(handle, result, &sbuf) == 0) {
char *newname;
- if (!S_ISDIR(sbuf.st_mode)) {
+ if (!S_ISDIR(sbuf.st_ex_mode)) {
errno = EINVAL;
goto fail;
}
@@ -504,7 +504,7 @@ static int streams_depot_unlink(vfs_handle_struct *handle, const char *fname)
return -1;
}
- if (sbuf.st_nlink == 1) {
+ if (sbuf.st_ex_nlink == 1) {
char *dirname = stream_dir(handle, fname, &sbuf, false);
if (dirname != NULL) {
@@ -652,7 +652,7 @@ static bool collect_one_stream(const char *dirname,
if (!add_one_stream(state->mem_ctx,
&state->num_streams, &state->streams,
- dirent, sbuf.st_size,
+ dirent, sbuf.st_ex_size,
SMB_VFS_GET_ALLOC_SIZE(state->handle->conn, NULL,
&sbuf))) {
state->status = NT_STATUS_NO_MEMORY;
@@ -698,10 +698,10 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
state.streams = NULL;
state.num_streams = 0;
- if (!S_ISDIR(sbuf.st_mode)) {
+ if (!S_ISDIR(sbuf.st_ex_mode)) {
if (!add_one_stream(mem_ctx,
&state.num_streams, &state.streams,
- "::$DATA", sbuf.st_size,
+ "::$DATA", sbuf.st_ex_size,
SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
&sbuf))) {
return NT_STATUS_NO_MEMORY;
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 3d5478d7a2..ebc51e79e3 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -42,17 +42,17 @@ static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
char *upper_sname;
DEBUG(10, ("stream_inode called for %lu/%lu [%s]\n",
- (unsigned long)sbuf->st_dev,
- (unsigned long)sbuf->st_ino, sname));
+ (unsigned long)sbuf->st_ex_dev,
+ (unsigned long)sbuf->st_ex_ino, sname));
upper_sname = talloc_strdup_upper(talloc_tos(), sname);
SMB_ASSERT(upper_sname != NULL);
MD5Init(&ctx);
- MD5Update(&ctx, (unsigned char *)&(sbuf->st_dev),
- sizeof(sbuf->st_dev));
- MD5Update(&ctx, (unsigned char *)&(sbuf->st_ino),
- sizeof(sbuf->st_ino));
+ MD5Update(&ctx, (unsigned char *)&(sbuf->st_ex_dev),
+ sizeof(sbuf->st_ex_dev));
+ MD5Update(&ctx, (unsigned char *)&(sbuf->st_ex_ino),
+ sizeof(sbuf->st_ex_ino));
MD5Update(&ctx, (unsigned char *)upper_sname,
talloc_get_size(upper_sname)-1);
MD5Final(hash, &ctx);
@@ -159,18 +159,18 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
return -1;
}
- sbuf->st_size = get_xattr_size(handle->conn, fsp->base_fsp,
+ sbuf->st_ex_size = get_xattr_size(handle->conn, fsp->base_fsp,
io->base, io->xattr_name);
- if (sbuf->st_size == -1) {
+ if (sbuf->st_ex_size == -1) {
return -1;
}
- DEBUG(10, ("sbuf->st_size = %d\n", (int)sbuf->st_size));
+ DEBUG(10, ("sbuf->st_ex_size = %d\n", (int)sbuf->st_ex_size));
- sbuf->st_ino = stream_inode(sbuf, io->xattr_name);
- sbuf->st_mode &= ~S_IFMT;
- sbuf->st_mode |= S_IFREG;
- sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+ sbuf->st_ex_ino = stream_inode(sbuf, io->xattr_name);
+ sbuf->st_ex_mode &= ~S_IFMT;
+ sbuf->st_ex_mode |= S_IFREG;
+ sbuf->st_ex_blocks = sbuf->st_ex_size % STAT_ST_BLOCKSIZE + 1;
return 0;
}
@@ -208,16 +208,16 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname,
goto fail;
}
- sbuf->st_size = get_xattr_size(handle->conn, NULL, base, xattr_name);
- if (sbuf->st_size == -1) {
+ sbuf->st_ex_size = get_xattr_size(handle->conn, NULL, base, xattr_name);
+ if (sbuf->st_ex_size == -1) {
errno = ENOENT;
goto fail;
}
- sbuf->st_ino = stream_inode(sbuf, xattr_name);
- sbuf->st_mode &= ~S_IFMT;
- sbuf->st_mode |= S_IFREG;
- sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+ sbuf->st_ex_ino = stream_inode(sbuf, xattr_name);
+ sbuf->st_ex_mode &= ~S_IFMT;
+ sbuf->st_ex_mode |= S_IFREG;
+ sbuf->st_ex_blocks = sbuf->st_ex_size % STAT_ST_BLOCKSIZE + 1;
result = 0;
fail:
@@ -259,16 +259,16 @@ static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname,
goto fail;
}
- sbuf->st_size = get_xattr_size(handle->conn, NULL, base, xattr_name);
- if (sbuf->st_size == -1) {
+ sbuf->st_ex_size = get_xattr_size(handle->conn, NULL, base, xattr_name);
+ if (sbuf->st_ex_size == -1) {
errno = ENOENT;
goto fail;
}
- sbuf->st_ino = stream_inode(sbuf, xattr_name);
- sbuf->st_mode &= ~S_IFMT;
- sbuf->st_mode |= S_IFREG;
- sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1;
+ sbuf->st_ex_ino = stream_inode(sbuf, xattr_name);
+ sbuf->st_ex_mode &= ~S_IFMT;
+ sbuf->st_ex_mode |= S_IFREG;
+ sbuf->st_ex_blocks = sbuf->st_ex_size % STAT_ST_BLOCKSIZE + 1;
result = 0;
fail:
@@ -740,10 +740,10 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
state.streams = NULL;
state.num_streams = 0;
- if (!S_ISDIR(sbuf.st_mode)) {
+ if (!S_ISDIR(sbuf.st_ex_mode)) {
if (!add_one_stream(mem_ctx,
&state.num_streams, &state.streams,
- "::$DATA", sbuf.st_size,
+ "::$DATA", sbuf.st_ex_size,
SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
&sbuf))) {
return NT_STATUS_NO_MEMORY;
diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c
index 6fb1d1d2d4..57807105f6 100644
--- a/source3/modules/vfs_tsmsm.c
+++ b/source3/modules/vfs_tsmsm.c
@@ -153,10 +153,12 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle,
/* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
then assume it is not offline (it may not be 100%, as it could be sparse) */
- if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size * tsmd->online_ratio) {
+ if (512 * (off_t)stbuf->st_ex_blocks >=
+ stbuf->st_ex_size * tsmd->online_ratio) {
DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld "
- "online_ratio=%.2f\n", path, (long)stbuf->st_blocks,
- (long)stbuf->st_size, tsmd->online_ratio));
+ "online_ratio=%.2f\n", path,
+ (long)stbuf->st_ex_blocks,
+ (long)stbuf->st_ex_size, tsmd->online_ratio));
return false;
}
@@ -254,9 +256,10 @@ static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struc
*/
if(SMB_VFS_FSTAT(fsp, &sbuf) == 0) {
DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld "
- "online_ratio=%.2f\n", (long)sbuf.st_blocks,
- (long)sbuf.st_size, tsmd->online_ratio));
- return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio);
+ "online_ratio=%.2f\n", (long)sbuf.st_ex_blocks,
+ (long)sbuf.st_ex_size, tsmd->online_ratio));
+ return !(512 * (off_t)sbuf.st_ex_blocks >=
+ sbuf.st_ex_size * tsmd->online_ratio);
}
return false;
}