/*
a static string for a file_id structure
*/
-const char *file_id_static_string(const struct file_id *id)
+const char *file_id_string_tos(const struct file_id *id)
{
- static char buf[32];
- snprintf(buf, sizeof(buf), "%llx:%llx",
- (unsigned long long)id->devid,
- (unsigned long long)id->inode);
- return buf;
-}
-
-/*
- a 2nd static string for a file_id structure so we can print 2 at once
- */
-const char *file_id_static_string2(const struct file_id *id)
-{
- static char buf[32];
- snprintf(buf, sizeof(buf), "%llx:%llx",
- (unsigned long long)id->devid,
- (unsigned long long)id->inode);
- return buf;
+ return talloc_asprintf(talloc_tos(), "%llx:%llx",
+ (unsigned long long)id->devid,
+ (unsigned long long)id->inode);
}
/*
struct lock_struct *locks = br_lck->lock_data;
DEBUG(10,("brl_get_locks_internal: %u current locks on file_id %s\n",
br_lck->num_locks,
- file_id_static_string(&fsp->file_id)));
+ file_id_string_tos(&fsp->file_id)));
for( i = 0; i < br_lck->num_locks; i++) {
print_lock_struct(i, &locks[i]);
}
e->share_access, e->private_options,
e->access_mask, e->op_mid, e->op_type, e->share_file_id,
(unsigned int)e->uid, (unsigned int)e->flags,
- file_id_static_string(&e->id));
+ file_id_string_tos(&e->id));
return share_str;
}
DEBUG(10,("rename_share_filename: sending rename message to pid %s "
"file_id %s sharepath %s newname %s\n",
procid_str_static(&se->pid),
- file_id_static_string(&lck->id),
+ file_id_string_tos(&lck->id),
lck->servicepath, lck->filename ));
messaging_send_buf(msg_ctx, se->pid, MSG_SMB_FILE_RENAME,
do_log(SMB_VFS_OP_FILE_ID_CREATE,
!file_id_equal(&id_zero, &result),
- handle, "%s", file_id_static_string(&result));
+ handle, "%s", file_id_string_tos(&result));
return result;
}
DEBUG(5,("close_remove_share_mode: file %s. stored file_id %s, "
"stat file_id %s\n",
fsp->fsp_name,
- file_id_static_string(&fsp->file_id),
- file_id_static_string2(&id)));
+ file_id_string_tos(&fsp->file_id),
+ file_id_string_tos(&id)));
/*
* Don't save the errno here, we ignore this error
*/
for (fsp=Files;fsp;fsp=fsp->next,count++) {
DEBUG(10,("Files[%d], fnum = %d, name %s, fd = %d, gen = %lu, fileid=%s\n",
count, fsp->fnum, fsp->fsp_name, fsp->fh->fd, (unsigned long)fsp->fh->gen_id,
- file_id_static_string(&fsp->file_id)));
+ file_id_string_tos(&fsp->file_id)));
}
}
(fsp->oplock_type != FAKE_LEVEL_II_OPLOCK)) {
DEBUG(0,("file_find_dif: file %s file_id = %s, gen = %u \
oplock_type = %u is a stat open with oplock type !\n", fsp->fsp_name,
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
(unsigned int)fsp->fh->gen_id,
(unsigned int)fsp->oplock_type ));
smb_panic("file_find_dif");
DEBUG(10,("msg_file_was_renamed: Got rename message for sharepath %s, new name %s, "
"file_id %s\n",
- sharepath, newname, file_id_static_string(&id)));
+ sharepath, newname, file_id_string_tos(&id)));
for(fsp = file_find_di_first(id); fsp; fsp = file_find_di_next(fsp)) {
if (memcmp(fsp->conn->connectpath, sharepath, sp_len) == 0) {
DEBUG(5,("set_file_oplock: granted oplock on file %s, %s/%lu, "
"tv_sec = %x, tv_usec = %x\n",
- fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id, (int)fsp->open_time.tv_sec,
(int)fsp->open_time.tv_usec ));
if (!ret) {
DEBUG(0,("remove_oplock: failed to remove share oplock for "
"file %s fnum %d, %s\n",
- fsp->fsp_name, fsp->fnum, file_id_static_string(&fsp->file_id)));
+ fsp->fsp_name, fsp->fnum, file_id_string_tos(&fsp->file_id)));
}
release_file_oplock(fsp);
TALLOC_FREE(lck);
if (!ret) {
DEBUG(0,("downgrade_oplock: failed to downgrade share oplock "
"for file %s fnum %d, file_id %s\n",
- fsp->fsp_name, fsp->fnum, file_id_static_string(&fsp->file_id)));
+ fsp->fsp_name, fsp->fnum, file_id_string_tos(&fsp->file_id)));
}
downgrade_file_oplock(fsp);
if( DEBUGLVL( 3 ) ) {
dbgtext( "initial_break_processing: called for %s/%u\n",
- file_id_static_string(&id), (int)file_id);
+ file_id_string_tos(&id), (int)file_id);
dbgtext( "Current oplocks_open (exclusive = %d, levelII = %d)\n",
exclusive_oplocks_open, level_II_oplocks_open );
}
/* The file could have been closed in the meantime - return success. */
if( DEBUGLVL( 3 ) ) {
dbgtext( "initial_break_processing: cannot find open file with " );
- dbgtext( "file_id %s gen_id = %lu", file_id_static_string(&id), file_id);
+ dbgtext( "file_id %s gen_id = %lu", file_id_string_tos(&id), file_id);
dbgtext( "allowing break to succeed.\n" );
}
return NULL;
if( DEBUGLVL( 3 ) ) {
dbgtext( "initial_break_processing: file %s ", fsp->fsp_name );
dbgtext( "(file_id = %s gen_id = %lu) has no oplock.\n",
- file_id_static_string(&id), fsp->fh->gen_id );
+ file_id_string_tos(&id), fsp->fh->gen_id );
dbgtext( "Allowing break to succeed regardless.\n" );
}
return NULL;
message_to_share_mode_entry(&msg, (char *)data->data);
DEBUG(10, ("Got oplock async level 2 break message from pid %d: %s/%lu\n",
- (int)procid_to_pid(&src), file_id_static_string(&msg.id), msg.share_file_id));
+ (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id));
fsp = initial_break_processing(msg.id, msg.share_file_id);
message_to_share_mode_entry(&msg, (char *)data->data);
DEBUG(10, ("Got oplock break message from pid %d: %s/%lu\n",
- (int)procid_to_pid(&src), file_id_static_string(&msg.id), msg.share_file_id));
+ (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id));
fsp = initial_break_processing(msg.id, msg.share_file_id);
if (EXCLUSIVE_OPLOCK_TYPE(msg.op_type) &&
!EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
DEBUG(3, ("Already downgraded oplock on %s: %s\n",
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
fsp->fsp_name));
/* We just send the same message back. */
messaging_send_buf(msg_ctx, src, MSG_SMB_BREAK_RESPONSE,
file_id = (unsigned long)IVAL(data->data, 16);
DEBUG(10, ("Got kernel oplock break message from pid %d: %s/%u\n",
- (int)procid_to_pid(&src), file_id_static_string(&id),
+ (int)procid_to_pid(&src), file_id_string_tos(&id),
(unsigned int)file_id));
fsp = initial_break_processing(id, file_id);
message_to_share_mode_entry(&msg, (char *)data->data);
DEBUG(10, ("Got oplock break response from pid %d: %s/%lu mid %u\n",
- (int)procid_to_pid(&src), file_id_static_string(&msg.id), msg.share_file_id,
+ (int)procid_to_pid(&src), file_id_string_tos(&msg.id), msg.share_file_id,
(unsigned int)msg.op_mid));
/* Here's the hack from open.c, store the mid in the 'port' field */
message_to_share_mode_entry(&msg, (char *)data->data);
DEBUG(10, ("Got open retry msg from pid %d: %s mid %u\n",
- (int)procid_to_pid(&src), file_id_static_string(&msg.id),
+ (int)procid_to_pid(&src), file_id_string_tos(&msg.id),
(unsigned int)msg.op_mid));
schedule_deferred_open_smb_message(msg.op_mid);
DEBUG(5,("irix_oplock_receive_message: kernel oplock break request "
"received for file_id %s gen_id = %ul",
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id ));
return fsp;
DEBUG(0,("irix_set_kernel_oplock: Unable to get "
"kernel oplock on file %s, file_id %s "
"gen_id = %ul. Error was %s\n",
- fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id,
strerror(errno) ));
} else {
"gen_id = %ul. Another process had the file "
"open.\n",
fsp->fsp_name, fsp->fh->fd,
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id ));
}
return False;
DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, file_id = %s "
"gen_id = %ul\n",
- fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id));
return True;
int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1);
dbgtext("irix_release_kernel_oplock: file %s, file_id = %s"
"gen_id = %ul, has kernel oplock state "
- "of %x.\n", fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ "of %x.\n", fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id, state );
}
"removing kernel oplock on file " );
dbgtext("%s, file_id = %s gen_id = %ul. "
"Error was %s\n",
- fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id,
strerror(errno) );
}
DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, "
"fd = %d, file_id = %s. (%s)\n",
fsp->fsp_name, fsp->fh->fd,
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
strerror(errno)));
return False;
}
DEBUG(3,("linux_set_kernel_oplock: got kernel oplock on file %s, "
"file_id = %s gen_id = %lu\n",
- fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id));
return True;
int state = fcntl(fsp->fh->fd, F_GETLEASE, 0);
dbgtext("linux_release_kernel_oplock: file %s, file_id = %s "
"gen_id = %lu has kernel oplock state "
- "of %x.\n", fsp->fsp_name, file_id_static_string(&fsp->file_id),
+ "of %x.\n", fsp->fsp_name, file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id, state );
}
"removing kernel oplock on file " );
dbgtext("%s, file_id = %s, gen_id = %lu. "
"Error was %s\n", fsp->fsp_name,
- file_id_static_string(&fsp->file_id),
+ file_id_string_tos(&fsp->file_id),
fsp->fh->gen_id, strerror(errno) );
}
}
continue;
}
DEBUG(10,("rename_open_files: renaming file fnum %d (file_id %s) from %s -> %s\n",
- fsp->fnum, file_id_static_string(&fsp->file_id),
+ fsp->fnum, file_id_string_tos(&fsp->file_id),
fsp->fsp_name, newname ));
string_set(&fsp->fsp_name, newname);
did_rename = True;
if (!did_rename) {
DEBUG(10,("rename_open_files: no open files on file_id %s for %s\n",
- file_id_static_string(&lck->id), newname ));
+ file_id_string_tos(&lck->id), newname ));
}
/* Send messages to all smbd's (not ourself) that the name has changed. */
#endif
printf("%s %s %s %.0f:%.0f(%.0f)\n",
- procid_str_static(&pid), file_id_static_string(&id),
+ procid_str_static(&pid), file_id_string_tos(&id),
lock_type==READ_LOCK?"R":"W",
(double)start, (double)start+size-1,(double)size);
void *private_data)
{
printf("%6d %s %s %.0f:%.0f(%.0f)\n",
- (int)procid_to_pid(&pid), file_id_static_string(&id),
+ (int)procid_to_pid(&pid), file_id_string_tos(&id),
lock_type==READ_LOCK?"R":"W",
(double)start, (double)start+size-1,(double)size);
}
d_printf("%-10s %-15s %-4s %-9.0f %-9.0f %-24s %-24s\n",
- procid_str_static(&pid), file_id_static_string(&id),
+ procid_str_static(&pid), file_id_string_tos(&id),
desc,
(double)start, (double)size,
sharepath, fname);