diff options
author | Jeremy Allison <jra@samba.org> | 1997-10-01 23:32:22 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1997-10-01 23:32:22 +0000 |
commit | 5864551aef50295addd1c8aa690a52870f70626d (patch) | |
tree | 5eb2ea3a3b74fb87f4808d0da1282990c03e25e9 /source3/utils | |
parent | a8129c1602f7f537b3c1168b480c5debef12298a (diff) | |
download | samba-5864551aef50295addd1c8aa690a52870f70626d.tar.gz samba-5864551aef50295addd1c8aa690a52870f70626d.tar.bz2 samba-5864551aef50295addd1c8aa690a52870f70626d.zip |
OPLOCK CHECK-IN - oplocks are now *OPERATIONAL* !!!!
Yipeee. At least as far as I can check in a short time :-).
local.h: Changed OPLOCK_BREAK_TIMEOUT to 30 seconds.
locking.c: Big changes to delete oplocks on a share mode entry.
proto.h: updated.
reply.c: Added oplock break code in lockingX reply & readbraw reply.
server.c: Add batch oplock code. Force server shutdown if client fails
to respond to oplock break.
smb.h: Fix silly slow share mode oplock define bug.
status.c: Add oplock status info.
Jeremy (jallison@whistle.com)
(This used to be commit 4c83d37239f15f855fc10f01d7b4bf4217fb9eda)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/status.c | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c index 6fa85c0a63..703105012e 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -98,10 +98,10 @@ for share file %s (%s)\n", progname, fname, strerror(errno)); return 0; } - if (IVAL(buf,0) != LOCKING_VERSION) { + if (IVAL(buf,SMF_VERSION_OFFSET) != LOCKING_VERSION) { printf("%s: ERROR: read_share_file: share file %s has incorrect \ locking version (was %d, should be %d).\n",fname, - progname, IVAL(buf,0), LOCKING_VERSION); + progname, IVAL(buf,SMF_VERSION_OFFSET), LOCKING_VERSION); if(buf) free(buf); return 0; @@ -109,13 +109,13 @@ locking version (was %d, should be %d).\n",fname, /* Sanity check for file contents */ size = sb.st_size; - size -= 10; /* Remove the header */ + size -= SMF_HEADER_LENGTH; /* Remove the header */ /* Remove the filename component. */ - size -= SVAL(buf, 8); + size -= SVAL(buf, SMF_FILENAME_LEN_OFFSET); - /* The remaining size must be a multiple of 16 - error if not. */ - if((size % 16) != 0) + /* The remaining size must be a multiple of SMF_ENTRY_LENGTH - error if not. */ + if((size % SMF_ENTRY_LENGTH) != 0) { printf("%s: ERROR: read_share_file: share file %s is an incorrect length.\n", progname, fname); @@ -148,6 +148,9 @@ locking version (was %d, should be %d).\n",fname, void *dir; char *s; #endif /* FAST_SHARE_MODES */ +#ifdef USE_OPLOCKS + int oplock_type; +#endif /* USE_OPLOCKS */ int i; struct session_record *ptr; @@ -344,6 +347,10 @@ locking version (was %d, should be %d).\n",fname, t.tv_sec = entry_scanner_p->time.tv_sec; t.tv_usec = entry_scanner_p->time.tv_usec; strcpy(fname, file_scanner_p->file_name); +#ifdef USE_OPLOCKS + oplock_type = entry_scanner_p->op_type; +#endif /* USE_OPLOCKS */ + #else /* FAST_SHARE_MODES */ /* For slow share modes go through all the files in @@ -394,16 +401,19 @@ locking version (was %d, should be %d).\n",fname, strcpy( fname, &buf[10]); close(fd); - base = buf + 10 + SVAL(buf,8); - for( i = 0; i < IVAL(buf, 4); i++) + base = buf + SMF_HEADER_LENGTH + SVAL(buf,SMF_FILENAME_LEN_OFFSET); + for( i = 0; i < IVAL(buf, SMF_NUM_ENTRIES_OFFSET); i++) { - char *p = base + (i*16); + char *p = base + (i*SMF_ENTRY_LENGTH); struct timeval t; - int pid = IVAL(p,12); - int mode = IVAL(p,8); + int pid = IVAL(p,SME_PID_OFFSET); + int mode = IVAL(p,SME_SHAREMODE_OFFSET); - t.tv_sec = IVAL(p,0); - t.tv_usec = IVAL(p,4); + t.tv_sec = IVAL(p,SME_SEC_OFFSET); + t.tv_usec = IVAL(p,SME_USEC_OFFSET); +#ifdef USE_OPLOCKS + oplock_type = SVAL(p,SME_OPLOCK_TYPE_OFFSET); +#endif /* USE_OPLOCKS */ #endif /* FAST_SHARE_MODES */ fname[sizeof(fname)-1] = 0; @@ -411,8 +421,13 @@ locking version (was %d, should be %d).\n",fname, if (firstopen) { firstopen=False; printf("Locked files:\n"); - printf("Pid DenyMode R/W Name\n"); - printf("------------------------------\n"); +#ifdef USE_OPLOCKS + printf("Pid DenyMode R/W Oplock Name\n"); + printf("--------------------------------------------------\n"); +#else /* USE_OPLOCKS */ + printf("Pid DenyMode R/W Name\n"); + printf("----------------------------------\n"); +#endif /* USE_OPLOCKS */ } @@ -427,10 +442,20 @@ locking version (was %d, should be %d).\n",fname, } switch (mode&0xF) { - case 0: printf("RDONLY "); break; - case 1: printf("WRONLY "); break; - case 2: printf("RDWR "); break; + case 0: printf("RDONLY "); break; + case 1: printf("WRONLY "); break; + case 2: printf("RDWR "); break; } +#ifdef USE_OPLOCKS + if((oplock_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) == (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) + printf("EXCLUSIVE+BATCH "); + else if (oplock_type & EXCLUSIVE_OPLOCK) + printf("EXCLUSIVE "); + else if (oplock_type & BATCH_OPLOCK) + printf("BATCH "); + else + printf("NONE "); +#endif /* USE_OPLOCKS */ printf(" %s %s",fname,asctime(LocalTime((time_t *)&t.tv_sec))); #ifdef FAST_SHARE_MODES |