summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-08-11 23:28:35 +0000
committerJeremy Allison <jra@samba.org>1998-08-11 23:28:35 +0000
commitb1778b6b57401d78fb4352992fde54706af6b75f (patch)
treeb2e1de96669fca53c57d78e2aaaa9a7c84ed33b1 /source3/smbd
parentea8631d249dc41b9c3abbe8bfaf8c64a313b0478 (diff)
downloadsamba-b1778b6b57401d78fb4352992fde54706af6b75f.tar.gz
samba-b1778b6b57401d78fb4352992fde54706af6b75f.tar.bz2
samba-b1778b6b57401d78fb4352992fde54706af6b75f.zip
include/smb.h: Removed dir_ptr. Not needed.
locking/locking.c: First cut a blocking lock code. #ifdef'ed out for now. locking/locking_shm.c: Removed dir_ptr. Not needed. smbd/nttrans.c: More work on ChangeNotify - return is not an error and needs to be handled as a nttrans with zero params. Removed dir_ptr. Not needed. smbd/reply.c: smbd/server.c: smbd/trans2.c: Removed dir_ptr. Not needed. Hmmm. At the moment smbclient is broken - doesn't issue prompt correctly. This needs looking at. Jeremy. (This used to be commit ddfbcc05815621d3c463f92faed047f126412342)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/nttrans.c72
-rw-r--r--source3/smbd/reply.c55
-rw-r--r--source3/smbd/server.c53
-rw-r--r--source3/smbd/trans2.c8
4 files changed, 95 insertions, 93 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 143bfc9a8b..8709b9c646 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -572,7 +572,7 @@ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize)
return(ERROR(ERRDOS,ERRnoaccess));
}
} else {
- if (fstat(fsp->f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fnum,False);
restore_case_semantics(file_attributes);
return(ERROR(ERRDOS,ERRnoaccess));
@@ -801,7 +801,7 @@ static int call_nt_transact_create(char *inbuf, char *outbuf, int length,
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- if (fstat(fsp->f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fnum,False);
restore_case_semantics(file_attributes);
@@ -969,6 +969,8 @@ typedef struct {
int fnum;
int cnum;
time_t next_check_time;
+ time_t modify_time; /* Info from the directory we're monitoring. */
+ time_t status_time; /* Info from the directory we're monitoring. */
char request_buf[smb_size];
} change_notify_buf;
@@ -981,8 +983,9 @@ static ubi_slList change_notify_queue = { NULL, (ubi_slNodePtr)&change_notify_qu
static void change_notify_reply_packet(char *inbuf, int error_class, uint32 error_code)
{
extern int Client;
- char outbuf[smb_size];
+ char outbuf[smb_size+38];
+ memset(outbuf, '\0', sizeof(outbuf));
construct_reply_common(inbuf, outbuf);
/*
@@ -993,10 +996,17 @@ static void change_notify_reply_packet(char *inbuf, int error_class, uint32 erro
* can even determine how MS failed to test stuff and why.... :-). JRA.
*/
- if(error_class == 0 && error_code == NT_STATUS_NOTIFY_ENUM_DIR)
+ if(error_class == 0) /* NT Error. */
SSVAL(outbuf,smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
ERROR(error_class,error_code);
+
+ /*
+ * Seems NT needs a transact command with an error code
+ * in it. This is a longer packet than a simple error.
+ */
+ set_message(outbuf,18,0,False);
+
send_smb(Client,outbuf);
}
@@ -1032,7 +1042,7 @@ void remove_pending_change_notify_requests_by_mid(int mid)
while(cnbp != NULL) {
if(SVAL(cnbp->request_buf,smb_mid) == mid) {
- change_notify_reply_packet(cnbp->request_buf,ERRSRV,ERRaccess);
+ change_notify_reply_packet(cnbp->request_buf,0,NT_STATUS_CANCELLED);
free((char *)ubi_slRemNext( &change_notify_queue, prev));
cnbp = (change_notify_buf *)(prev ? ubi_slNext(prev) : ubi_slFirst(&change_notify_queue));
continue;
@@ -1109,8 +1119,8 @@ Error was %s.\n", fsp->name, strerror(errno) ));
continue;
}
- if(fsp->f_u.dir_ptr->modify_time != st.st_mtime ||
- fsp->f_u.dir_ptr->status_time != st.st_ctime) {
+ if(cnbp->modify_time != st.st_mtime ||
+ cnbp->status_time != st.st_ctime) {
/*
* Remove the entry and return a change notify to the client.
*/
@@ -1160,40 +1170,6 @@ static int call_nt_transact_notify_change(char *inbuf, char *outbuf, int length,
if((!fsp->open) || (!fsp->is_directory) || (cnum != fsp->cnum))
return(ERROR(ERRDOS,ERRbadfid));
- if(fsp->f_u.dir_ptr == NULL) {
-
- /*
- * No currently stored directory info - we must
- * generate it here.
- */
-
- if((fsp->f_u.dir_ptr = (dir_status_struct *)malloc(sizeof(dir_status_struct))) == NULL) {
- DEBUG(0,("call_nt_transact_notify_change: Malloc fail !\n" ));
- return -1;
- }
-
- /*
- * Setup the current directory information in the
- * directory entry in the files_struct. We will use
- * this to check against when the timer expires.
- * NB. We only do this if there is no current directory
- * information in the directory struct - as when we start
- * monitoring file size etc. this information will start
- * becoming increasingly expensive to maintain, so we won't
- * want to re-generate it for every ChangeNofity call.
- */
-
- if(sys_stat(fsp->name, &st) < 0) {
- DEBUG(0,("call_nt_transact_notify_change: Unable to stat fnum = %d, name = %s. \
-Error was %s\n", fnum, fsp->name, strerror(errno) ));
- return -1;
- }
-
- fsp->f_u.dir_ptr->modify_time = st.st_mtime;
- fsp->f_u.dir_ptr->status_time = st.st_ctime;
-
- }
-
/*
* Now queue an entry on the notify change stack. We timestamp
* the entry we are adding so that we know when to scan next.
@@ -1207,9 +1183,23 @@ Error was %s\n", fnum, fsp->name, strerror(errno) ));
return -1;
}
+ /*
+ * Store the current timestamp on the directory we are monitoring.
+ */
+
+ if(sys_stat(fsp->name, &st) < 0) {
+ DEBUG(0,("call_nt_transact_notify_change: Unable to stat fnum = %d, name = %s. \
+Error was %s\n", fnum, fsp->name, strerror(errno) ));
+ free((char *)cnbp);
+ return(UNIXERROR(ERRDOS,ERRbadfid));
+ }
+
memcpy(cnbp->request_buf, inbuf, smb_size);
cnbp->fnum = fnum;
cnbp->cnum = cnum;
+ cnbp->modify_time = st.st_mtime;
+ cnbp->status_time = st.st_ctime;
+
cnbp->next_check_time = time(NULL) + lp_change_notify_timeout();
/*
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2e6ceb93aa..b0509bf3d5 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1320,7 +1320,7 @@ int reply_open(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- if (fstat(fsp->f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fnum,False);
return(ERROR(ERRDOS,ERRnoaccess));
}
@@ -1425,7 +1425,7 @@ int reply_open_and_X(char *inbuf,char *outbuf,int length,int bufsize)
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- if (fstat(fsp->f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fnum,False);
return(ERROR(ERRDOS,ERRnoaccess));
}
@@ -1603,7 +1603,7 @@ int reply_mknew(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
DEBUG( 2, ( "new file %s\n", fname ) );
DEBUG( 3, ( "mknew %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
- fname, fsp->f_u.fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
+ fname, fsp->fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
return(outsize);
}
@@ -1682,7 +1682,7 @@ int reply_ctemp(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
DEBUG( 2, ( "created temp file %s\n", fname2 ) );
DEBUG( 3, ( "ctemp %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
- fname2, fsp->f_u.fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
+ fname2, fsp->fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
return(outsize);
}
@@ -1865,7 +1865,7 @@ int reply_readbraw(char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
{
fsp = &Files[fnum];
- fd = fsp->f_u.fd_ptr->fd;
+ fd = fsp->fd_ptr->fd;
fname = fsp->name;
}
@@ -1877,7 +1877,7 @@ int reply_readbraw(char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
if (size < sizeneeded) {
struct stat st;
- if (fstat(fsp->f_u.fd_ptr->fd,&st) == 0)
+ if (fstat(fsp->fd_ptr->fd,&st) == 0)
size = st.st_size;
if (!fsp->can_write)
fsp->size = size;
@@ -2148,7 +2148,7 @@ int reply_writebraw(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
tcount,nwritten,numtowrite));
}
- nwritten = transfer_file(Client,Files[fnum].f_u.fd_ptr->fd,numtowrite,NULL,0,
+ nwritten = transfer_file(Client,Files[fnum].fd_ptr->fd,numtowrite,NULL,0,
startpos+nwritten);
total_written += nwritten;
@@ -2265,7 +2265,7 @@ int reply_write(char *inbuf,char *outbuf,int dum_size,int dum_buffsize)
zero then the file size should be extended or
truncated to the size given in smb_vwv[2-3] */
if(numtowrite == 0)
- nwritten = set_filelen(Files[fnum].f_u.fd_ptr->fd, startpos);
+ nwritten = set_filelen(Files[fnum].fd_ptr->fd, startpos);
else
nwritten = write_file(fnum,data,numtowrite);
@@ -2383,7 +2383,7 @@ int reply_lseek(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
fsp = &Files[fnum];
- res = lseek(fsp->f_u.fd_ptr->fd,startpos,umode);
+ res = lseek(fsp->fd_ptr->fd,startpos,umode);
fsp->pos = res;
outsize = set_message(outbuf,2,0,True);
@@ -2493,7 +2493,7 @@ int reply_close(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
set_filetime(cnum, fsp->name,mtime);
DEBUG( 3, ( "close fd=%d fnum=%d cnum=%d (numopen=%d)\n",
- fsp->f_u.fd_ptr->fd, fnum, cnum,
+ fsp->fd_ptr->fd, fnum, cnum,
Connections[cnum].num_files_open ) );
close_file(fnum,True);
@@ -2577,7 +2577,7 @@ int reply_lock(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
offset = IVAL(inbuf,smb_vwv3);
DEBUG( 3, ("lock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
- Files[fnum].f_u.fd_ptr->fd, fnum, cnum, offset, count ) );
+ Files[fnum].fd_ptr->fd, fnum, cnum, offset, count ) );
if(!do_lock( fnum, cnum, count, offset, F_WRLCK, &eclass, &ecode))
return (ERROR(eclass,ecode));
@@ -2610,7 +2610,7 @@ int reply_unlock(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
return (ERROR(eclass,ecode));
DEBUG( 3, ( "unlock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
- Files[fnum].f_u.fd_ptr->fd, fnum, cnum, offset, count ) );
+ Files[fnum].fd_ptr->fd, fnum, cnum, offset, count ) );
return(outsize);
}
@@ -2759,7 +2759,7 @@ int reply_printopen(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_vwv0,fnum);
DEBUG( 3, ("openprint %s fd=%d fnum=%d cnum=%d\n",
- fname2, fsp->f_u.fd_ptr->fd, fnum, cnum ) );
+ fname2, fsp->fd_ptr->fd, fnum, cnum ) );
return(outsize);
}
@@ -2783,7 +2783,7 @@ int reply_printclose(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
return(ERROR(ERRDOS,ERRnoaccess));
DEBUG( 3, ( "printclose fd=%d fnum=%d cnum=%d\n",
- Files[fnum].f_u.fd_ptr->fd,fnum,cnum));
+ Files[fnum].fd_ptr->fd,fnum,cnum));
close_file(fnum,True);
@@ -3476,12 +3476,12 @@ static BOOL copy_file(char *src,char *dest1,int cnum,int ofun,
}
if ((ofun&3) == 1) {
- lseek(Files[fnum2].f_u.fd_ptr->fd,0,SEEK_END);
+ lseek(Files[fnum2].fd_ptr->fd,0,SEEK_END);
}
if (st.st_size)
- ret = transfer_file(Files[fnum1].f_u.fd_ptr->fd,
- Files[fnum2].f_u.fd_ptr->fd,st.st_size,NULL,0,0);
+ ret = transfer_file(Files[fnum1].fd_ptr->fd,
+ Files[fnum2].fd_ptr->fd,st.st_size,NULL,0,0);
close_file(fnum1,False);
close_file(fnum2,False);
@@ -3678,7 +3678,7 @@ int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize)
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
uint16 num_locks = SVAL(inbuf,smb_vwv7);
uint32 count, offset;
-
+ int32 lock_timeout = IVAL(inbuf,smb_vwv4);
int cnum;
int i;
char *data;
@@ -3699,8 +3699,8 @@ int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize)
{
int token;
files_struct *fsp = &Files[fnum];
- uint32 dev = fsp->f_u.fd_ptr->dev;
- uint32 inode = fsp->f_u.fd_ptr->inode;
+ uint32 dev = fsp->fd_ptr->dev;
+ uint32 inode = fsp->fd_ptr->inode;
DEBUG(5,("reply_lockingX: oplock break reply from client for fnum = %d\n",
fnum));
@@ -3749,6 +3749,9 @@ dev = %x, inode = %x\n",
return ERROR(eclass,ecode);
}
+ /* Setup the timeout in seconds. */
+ lock_timeout = ((lock_timeout == -1) ? -1 : lock_timeout/1000);
+
/* Now do any requested locks */
data += 10*num_ulocks;
/* Data now points at the beginning of the list
@@ -3758,6 +3761,16 @@ dev = %x, inode = %x\n",
offset = IVAL(data,SMB_LKOFF_OFFSET(i));
if(!do_lock(fnum,cnum,count,offset, ((locktype & 1) ? F_RDLCK : F_WRLCK),
&eclass, &ecode))
+#if 0 /* JRATEST - blocking lock code. */
+ if((ecode == ERRlock) && (lock_timeout != 0)) {
+ /*
+ * A blocking lock was requested. Package up
+ * this smb into a queued request and push it
+ * onto the blocking lock queue.
+ */
+ if(push_blocking_lock_request(inbuf, length, lock_timeout, i))
+ return -1;
+#endif /* JRATEST */
break;
}
@@ -4103,7 +4116,7 @@ int reply_getattrE(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
CHECK_ERROR(fnum);
/* Do an fstat on this file */
- if(fstat(Files[fnum].f_u.fd_ptr->fd, &sbuf))
+ if(fstat(Files[fnum].fd_ptr->fd, &sbuf))
return(UNIXERROR(ERRDOS,ERRnoaccess));
mode = dos_mode(cnum,Files[fnum].name,&sbuf);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 47fb175d8e..143b45e9ef 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1047,7 +1047,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
int accmode = (flags & (O_RDONLY | O_WRONLY | O_RDWR));
fsp->open = False;
- fsp->f_u.fd_ptr = 0;
+ fsp->fd_ptr = 0;
fsp->granted_oplock = False;
errno = EPERM;
@@ -1222,7 +1222,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
if (sys_disk_free(dname,&dum1,&dum2,&dum3) <
lp_minprintspace(SNUM(cnum))) {
fd_attempt_close(fd_ptr);
- fsp->f_u.fd_ptr = 0;
+ fsp->fd_ptr = 0;
if(fd_ptr->ref_count == 0)
sys_unlink(fname);
errno = ENOSPC;
@@ -1259,7 +1259,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
fd_ptr->dev = (uint32)sbuf->st_dev;
fd_ptr->inode = (uint32)sbuf->st_ino;
- fsp->f_u.fd_ptr = fd_ptr;
+ fsp->fd_ptr = fd_ptr;
Connections[cnum].num_files_open++;
fsp->mode = sbuf->st_mode;
GetTimeOfDay(&fsp->open_time);
@@ -1315,7 +1315,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
{
fsp->mmap_size = file_size(fname);
fsp->mmap_ptr = (char *)mmap(NULL,fsp->mmap_size,
- PROT_READ,MAP_SHARED,fsp->f_u.fd_ptr->fd,0);
+ PROT_READ,MAP_SHARED,fsp->fd_ptr->fd,0);
if (fsp->mmap_ptr == (char *)-1 || !fsp->mmap_ptr)
{
@@ -1333,7 +1333,7 @@ void sync_file(int cnum, int fnum)
{
#ifdef HAVE_FSYNC
if(lp_strict_sync(SNUM(cnum)))
- fsync(Files[fnum].f_u.fd_ptr->fd);
+ fsync(Files[fnum].fd_ptr->fd);
#endif
}
@@ -1417,14 +1417,14 @@ void close_file(int fnum, BOOL normal_close)
{
files_struct *fs_p = &Files[fnum];
int cnum = fs_p->cnum;
- uint32 dev = fs_p->f_u.fd_ptr->dev;
- uint32 inode = fs_p->f_u.fd_ptr->inode;
+ uint32 dev = fs_p->fd_ptr->dev;
+ uint32 inode = fs_p->fd_ptr->inode;
int token;
close_filestruct(fs_p);
#if USE_READ_PREDICTION
- invalidate_read_prediction(fs_p->f_u.fd_ptr->fd);
+ invalidate_read_prediction(fs_p->fd_ptr->fd);
#endif
if (lp_share_modes(SNUM(cnum)))
@@ -1433,7 +1433,7 @@ void close_file(int fnum, BOOL normal_close)
del_share_mode(token, fnum);
}
- fd_attempt_close(fs_p->f_u.fd_ptr);
+ fd_attempt_close(fs_p->fd_ptr);
if (lp_share_modes(SNUM(cnum)))
unlock_share_entry( cnum, dev, inode, token);
@@ -1485,9 +1485,6 @@ void close_directory(int fnum)
if (fsp->name)
string_free(&fsp->name);
- if (fsp->f_u.dir_ptr)
- free((char *)fsp->f_u.dir_ptr);
-
/* we will catch bugs faster by zeroing this structure */
memset(fsp, 0, sizeof(*fsp));
}
@@ -1541,7 +1538,7 @@ int open_directory(int fnum,int cnum,char *fname, int smb_ofun, int unixmode, in
* Setup the files_struct for it.
*/
- fsp->f_u.dir_ptr = NULL;
+ fsp->fd_ptr = NULL;
Connections[cnum].num_files_open++;
fsp->mode = 0;
GetTimeOfDay(&fsp->open_time);
@@ -1761,13 +1758,15 @@ free_and_exit:
static void truncate_unless_locked(int fnum, int cnum, int token,
BOOL *share_locked)
{
- if (Files[fnum].can_write){
+ files_struct *fsp = &Files[fnum];
+
+ if (fsp->can_write){
if (is_locked(fnum,cnum,0x3FFFFFFF,0,F_WRLCK)){
/* If share modes are in force for this connection we
have the share entry locked. Unlock it before closing. */
if (*share_locked && lp_share_modes(SNUM(cnum)))
- unlock_share_entry( cnum, Files[fnum].f_u.fd_ptr->dev,
- Files[fnum].f_u.fd_ptr->inode, token);
+ unlock_share_entry( cnum, fsp->fd_ptr->dev,
+ fsp->fd_ptr->inode, token);
close_file(fnum,False);
/* Share mode no longer locked. */
*share_locked = False;
@@ -1776,7 +1775,7 @@ static void truncate_unless_locked(int fnum, int cnum, int token,
unix_ERR_code = ERRlock;
}
else
- ftruncate(Files[fnum].f_u.fd_ptr->fd,0);
+ ftruncate(fsp->fd_ptr->fd,0);
}
}
@@ -1841,7 +1840,7 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
int num_share_modes = 0;
fs_p->open = False;
- fs_p->f_u.fd_ptr = 0;
+ fs_p->fd_ptr = 0;
/* this is for OS/2 EAs - try and say we don't support them */
if (strstr(fname,".+,;=[]."))
@@ -2017,8 +2016,8 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode));
if((share_locked == False) && lp_share_modes(SNUM(cnum)))
{
/* We created the file - thus we must now lock the share entry before creating it. */
- dev = fs_p->f_u.fd_ptr->dev;
- inode = fs_p->f_u.fd_ptr->inode;
+ dev = fs_p->fd_ptr->dev;
+ inode = fs_p->fd_ptr->inode;
lock_share_entry(cnum, dev, inode, &token);
share_locked = True;
}
@@ -2098,7 +2097,7 @@ int seek_file(int fnum,uint32 pos)
if (fsp->print_file && POSTSCRIPT(fsp->cnum))
offset = 3;
- fsp->pos = (int)(lseek(fsp->f_u.fd_ptr->fd,pos+offset,SEEK_SET) - offset);
+ fsp->pos = (int)(lseek(fsp->fd_ptr->fd,pos+offset,SEEK_SET) - offset);
return(fsp->pos);
}
@@ -2113,7 +2112,7 @@ int read_file(int fnum,char *data,uint32 pos,int n)
#if USE_READ_PREDICTION
if (!fsp->can_write)
{
- ret = read_predict(fsp->f_u.fd_ptr->fd,pos,data,NULL,n);
+ ret = read_predict(fsp->fd_ptr->fd,pos,data,NULL,n);
data += ret;
n -= ret;
@@ -2147,7 +2146,7 @@ int read_file(int fnum,char *data,uint32 pos,int n)
}
if (n > 0) {
- readret = read(fsp->f_u.fd_ptr->fd,data,n);
+ readret = read(fsp->fd_ptr->fd,data,n);
if (readret > 0) ret += readret;
}
@@ -2170,7 +2169,7 @@ int write_file(int fnum,char *data,int n)
if (!fsp->modified) {
struct stat st;
fsp->modified = True;
- if (fstat(fsp->f_u.fd_ptr->fd,&st) == 0) {
+ if (fstat(fsp->fd_ptr->fd,&st) == 0) {
int dosmode = dos_mode(fsp->cnum,fsp->name,&st);
if (MAP_ARCHIVE(fsp->cnum) && !IS_DOS_ARCHIVE(dosmode)) {
dos_chmod(fsp->cnum,fsp->name,dosmode | aARCH,&st);
@@ -2178,7 +2177,7 @@ int write_file(int fnum,char *data,int n)
}
}
- return(write_data(fsp->f_u.fd_ptr->fd,data,n));
+ return(write_data(fsp->fd_ptr->fd,data,n));
}
@@ -2924,7 +2923,7 @@ BOOL oplock_break(uint32 dev, uint32 inode, struct timeval *tval)
{
if(OPEN_FNUM(fnum))
{
- if((Files[fnum].f_u.fd_ptr->dev == dev) && (Files[fnum].f_u.fd_ptr->inode == inode) &&
+ if((Files[fnum].fd_ptr->dev == dev) && (Files[fnum].fd_ptr->inode == inode) &&
(Files[fnum].open_time.tv_sec == tval->tv_sec) &&
(Files[fnum].open_time.tv_usec == tval->tv_usec)) {
fsp = &Files[fnum];
@@ -3789,7 +3788,7 @@ static BOOL attempt_close_oplocked_file(files_struct *fsp)
if (fsp->open && fsp->granted_oplock && !fsp->sent_oplock_break) {
/* Try and break the oplock. */
- file_fd_struct *fd_ptr = fsp->f_u.fd_ptr;
+ file_fd_struct *fd_ptr = fsp->fd_ptr;
if(oplock_break( fd_ptr->dev, fd_ptr->inode, &fsp->open_time)) {
if(!fsp->open) /* Did the oplock break close the file ? */
return True;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 84cd99c91f..fc119307cd 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -251,7 +251,7 @@ static int call_trans2open(char *inbuf, char *outbuf, int bufsize, int cnum,
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- if (fstat(fsp->f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
close_file(fnum,False);
return(ERROR(ERRDOS,ERRnoaccess));
}
@@ -1207,11 +1207,11 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
CHECK_ERROR(fnum);
fname = Files[fnum].name;
- if (fstat(Files[fnum].f_u.fd_ptr->fd,&sbuf) != 0) {
+ if (fstat(Files[fnum].fd_ptr->fd,&sbuf) != 0) {
DEBUG(3,("fstat of fnum %d failed (%s)\n",fnum, strerror(errno)));
return(UNIXERROR(ERRDOS,ERRbadfid));
}
- pos = lseek(Files[fnum].f_u.fd_ptr->fd,0,SEEK_CUR);
+ pos = lseek(Files[fnum].fd_ptr->fd,0,SEEK_CUR);
} else {
/* qpathinfo */
info_level = SVAL(params,0);
@@ -1431,7 +1431,7 @@ static int call_trans2setfilepathinfo(char *inbuf, char *outbuf, int length,
CHECK_ERROR(fnum);
fname = Files[fnum].name;
- fd = Files[fnum].f_u.fd_ptr->fd;
+ fd = Files[fnum].fd_ptr->fd;
if(fstat(fd,&st)!=0) {
DEBUG(3,("fstat of %s failed (%s)\n", fname, strerror(errno)));