1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

s3:util: rename procid_equal() to serverid_equal()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Michael Adam
2012-06-16 00:26:26 +02:00
committed by Stefan Metzmacher
parent 0159344d4c
commit 73b200064f
16 changed files with 27 additions and 27 deletions

View File

@ -470,7 +470,7 @@ void set_my_unique_id(uint64_t unique_id);
struct server_id pid_to_procid(pid_t pid); struct server_id pid_to_procid(pid_t pid);
struct server_id procid_self(void); struct server_id procid_self(void);
struct server_id *new_server_id_task(TALLOC_CTX *mem_ctx); struct server_id *new_server_id_task(TALLOC_CTX *mem_ctx);
bool procid_equal(const struct server_id *p1, const struct server_id *p2); bool serverid_equal(const struct server_id *p1, const struct server_id *p2);
bool procid_is_me(const struct server_id *pid); bool procid_is_me(const struct server_id *pid);
struct server_id interpret_pid(const char *pid_string); struct server_id interpret_pid(const char *pid_string);
char *procid_str_static(const struct server_id *pid); char *procid_str_static(const struct server_id *pid);

View File

@ -166,7 +166,7 @@ static NTSTATUS dbwrap_record_del_watcher(TDB_DATA w_key, struct server_id id)
num_ids = value.dsize / sizeof(struct server_id); num_ids = value.dsize / sizeof(struct server_id);
for (i=0; i<num_ids; i++) { for (i=0; i<num_ids; i++) {
if (procid_equal(&id, &ids[i])) { if (serverid_equal(&id, &ids[i])) {
ids[i] = ids[num_ids-1]; ids[i] = ids[num_ids-1];
value.dsize -= sizeof(struct server_id); value.dsize -= sizeof(struct server_id);
break; break;

View File

@ -119,7 +119,7 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self,
} }
for (i=0; i<num_locks; i++) { for (i=0; i<num_locks; i++) {
if (procid_equal(&self, &locks[i].pid)) { if (serverid_equal(&self, &locks[i].pid)) {
status = NT_STATUS_INTERNAL_ERROR; status = NT_STATUS_INTERNAL_ERROR;
goto done; goto done;
} }
@ -327,7 +327,7 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name)
goto done; goto done;
} }
for (i=0; i<num_locks; i++) { for (i=0; i<num_locks; i++) {
if (procid_equal(&self, &locks[i].pid)) { if (serverid_equal(&self, &locks[i].pid)) {
break; break;
} }
} }

View File

@ -2058,7 +2058,7 @@ struct server_id *new_server_id_task(TALLOC_CTX *mem_ctx)
return server_id; return server_id;
} }
bool procid_equal(const struct server_id *p1, const struct server_id *p2) bool serverid_equal(const struct server_id *p1, const struct server_id *p2)
{ {
if (p1->pid != p2->pid) { if (p1->pid != p2->pid) {
return false; return false;

View File

@ -69,7 +69,7 @@ static void print_lock_struct(unsigned int i, struct lock_struct *pls)
bool brl_same_context(const struct lock_context *ctx1, bool brl_same_context(const struct lock_context *ctx1,
const struct lock_context *ctx2) const struct lock_context *ctx2)
{ {
return (procid_equal(&ctx1->pid, &ctx2->pid) && return (serverid_equal(&ctx1->pid, &ctx2->pid) &&
(ctx1->smblctx == ctx2->smblctx) && (ctx1->smblctx == ctx2->smblctx) &&
(ctx1->tid == ctx2->tid)); (ctx1->tid == ctx2->tid));
} }
@ -252,7 +252,7 @@ NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool
return NT_STATUS_FILE_LOCK_CONFLICT; return NT_STATUS_FILE_LOCK_CONFLICT;
} }
if (procid_equal(&lock->context.pid, &fsp->last_lock_failure.context.pid) && if (serverid_equal(&lock->context.pid, &fsp->last_lock_failure.context.pid) &&
lock->context.tid == fsp->last_lock_failure.context.tid && lock->context.tid == fsp->last_lock_failure.context.tid &&
lock->fnum == fsp->last_lock_failure.fnum && lock->fnum == fsp->last_lock_failure.fnum &&
lock->start == fsp->last_lock_failure.start) { lock->start == fsp->last_lock_failure.start) {
@ -1509,7 +1509,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx,
for (i=0; i < num_locks_copy; i++) { for (i=0; i < num_locks_copy; i++) {
struct lock_struct *lock = &locks_copy[i]; struct lock_struct *lock = &locks_copy[i];
if (lock->context.tid == tid && procid_equal(&lock->context.pid, &pid) && if (lock->context.tid == tid && serverid_equal(&lock->context.pid, &pid) &&
(lock->fnum == fnum)) { (lock->fnum == fnum)) {
brl_unlock(msg_ctx, brl_unlock(msg_ctx,
br_lck, br_lck,
@ -1958,7 +1958,7 @@ void brl_revalidate(struct messaging_context *msg_ctx,
ZERO_STRUCT(last_pid); ZERO_STRUCT(last_pid);
for (i=0; i<state->num_pids; i++) { for (i=0; i<state->num_pids; i++) {
if (procid_equal(&last_pid, &state->pids[i])) { if (serverid_equal(&last_pid, &state->pids[i])) {
/* /*
* We've seen that one already * We've seen that one already
*/ */

View File

@ -553,7 +553,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx,
se->name_hash = new_name_hash; se->name_hash = new_name_hash;
/* But not to ourselves... */ /* But not to ourselves... */
if (procid_equal(&se->pid, &self_pid)) { if (serverid_equal(&se->pid, &self_pid)) {
continue; continue;
} }
@ -755,7 +755,7 @@ static bool share_modes_identical(struct share_mode_entry *e1,
sharing the same share mode entry may validly differ in sharing the same share mode entry may validly differ in
fsp->share_access field. */ fsp->share_access field. */
return (procid_equal(&e1->pid, &e2->pid) && return (serverid_equal(&e1->pid, &e2->pid) &&
file_id_equal(&e1->id, &e2->id) && file_id_equal(&e1->id, &e2->id) &&
e1->share_file_id == e2->share_file_id ); e1->share_file_id == e2->share_file_id );
} }
@ -763,7 +763,7 @@ static bool share_modes_identical(struct share_mode_entry *e1,
static bool deferred_open_identical(struct share_mode_entry *e1, static bool deferred_open_identical(struct share_mode_entry *e1,
struct share_mode_entry *e2) struct share_mode_entry *e2)
{ {
return (procid_equal(&e1->pid, &e2->pid) && return (serverid_equal(&e1->pid, &e2->pid) &&
(e1->op_mid == e2->op_mid) && (e1->op_mid == e2->op_mid) &&
file_id_equal(&e1->id, &e2->id)); file_id_equal(&e1->id, &e2->id));
} }

View File

@ -777,7 +777,7 @@ static struct lock_list *posix_lock_list(TALLOC_CTX *ctx,
} }
/* Ignore locks not owned by this process. */ /* Ignore locks not owned by this process. */
if (!procid_equal(&lock->context.pid, &lock_ctx->pid)) { if (!serverid_equal(&lock->context.pid, &lock_ctx->pid)) {
continue; continue;
} }

View File

@ -856,7 +856,7 @@ static void sess_file_fn( const struct share_mode_entry *e,
{ {
struct sess_file_count *sess = (struct sess_file_count *)data; struct sess_file_count *sess = (struct sess_file_count *)data;
if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) { if (serverid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid)) {
sess->count++; sess->count++;
} }

View File

@ -232,7 +232,7 @@ static void notify_deferred_opens(struct smbd_server_connection *sconn,
for (i=0; i<num_deferred; i++) { for (i=0; i<num_deferred; i++) {
struct share_mode_entry *e = &deferred[i]; struct share_mode_entry *e = &deferred[i];
if (procid_equal(&self, &e->pid)) { if (serverid_equal(&self, &e->pid)) {
/* /*
* We need to notify ourself to retry the open. Do * We need to notify ourself to retry the open. Do
* this by finding the queued SMB record, moving it to * this by finding the queued SMB record, moving it to
@ -427,7 +427,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
&& (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) { && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
continue; continue;
} }
if (procid_equal(&self, &e->pid) && if (serverid_equal(&self, &e->pid) &&
(e->share_file_id == fsp->fh->gen_id)) { (e->share_file_id == fsp->fh->gen_id)) {
continue; continue;
} }
@ -1103,7 +1103,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) { if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
continue; continue;
} }
if (procid_equal(&self, &e->pid) && if (serverid_equal(&self, &e->pid) &&
(e->share_file_id == fsp->fh->gen_id)) { (e->share_file_id == fsp->fh->gen_id)) {
continue; continue;
} }

View File

@ -453,7 +453,7 @@ static NTSTATUS notify_del_entry(struct db_record *rec,
if (e->private_data != private_data) { if (e->private_data != private_data) {
continue; continue;
} }
if (procid_equal(&e->server, pid)) { if (serverid_equal(&e->server, pid)) {
break; break;
} }
} }

View File

@ -913,7 +913,7 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
struct server_id self = messaging_server_id(sconn->msg_ctx); struct server_id self = messaging_server_id(sconn->msg_ctx);
files_struct *fsp; files_struct *fsp;
if (!procid_equal(&self, &share_entry->pid)) { if (!serverid_equal(&self, &share_entry->pid)) {
return; return;
} }
@ -1363,7 +1363,7 @@ static void defer_open(struct share_mode_lock *lck,
struct share_mode_entry *e = &lck->data->share_modes[i]; struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_deferred_open_entry(e) && if (is_deferred_open_entry(e) &&
procid_equal(&self, &e->pid) && serverid_equal(&self, &e->pid) &&
(e->op_mid == req->mid)) { (e->op_mid == req->mid)) {
DEBUG(0, ("Trying to defer an already deferred " DEBUG(0, ("Trying to defer an already deferred "
"request: mid=%llu, exiting\n", "request: mid=%llu, exiting\n",

View File

@ -564,7 +564,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
/* Need to wait before sending a break /* Need to wait before sending a break
message if we sent ourselves this message. */ message if we sent ourselves this message. */
if (procid_equal(&self, &src)) { if (serverid_equal(&self, &src)) {
wait_before_sending_break(); wait_before_sending_break();
} }
@ -876,7 +876,7 @@ static void do_break_to_none(struct tevent_req *req)
* Bugid #5980. * Bugid #5980.
*/ */
if (procid_equal(&self, &share_entry->pid)) { if (serverid_equal(&self, &share_entry->pid)) {
struct files_struct *cur_fsp = struct files_struct *cur_fsp =
initial_break_processing(state->sconn, initial_break_processing(state->sconn,
share_entry->id, share_entry->id,

View File

@ -343,7 +343,7 @@ static int shutdown_other_smbds(const struct connections_key *key,
return 0; return 0;
} }
if (procid_equal(&crec->pid, &self_pid)) { if (serverid_equal(&crec->pid, &self_pid)) {
DEBUG(10, ("It's me\n")); DEBUG(10, ("It's me\n"));
return 0; return 0;
} }

View File

@ -152,7 +152,7 @@ static int show_share_parseable(const struct connections_key *key,
for (i=0; i<ids->num_entries; i++) { for (i=0; i<ids->num_entries; i++) {
struct server_id id = ids->entries[i].pid; struct server_id id = ids->entries[i].pid;
if (procid_equal(&id, &crec->pid)) { if (serverid_equal(&id, &crec->pid)) {
guest = false; guest = false;
break; break;
} }

View File

@ -88,7 +88,7 @@ static unsigned int Ucrit_checkPid(struct server_id pid)
return 1; return 1;
for (i=0;i<Ucrit_MaxPid;i++) { for (i=0;i<Ucrit_MaxPid;i++) {
if (procid_equal(&pid, &Ucrit_pid[i])) { if (serverid_equal(&pid, &Ucrit_pid[i])) {
return 1; return 1;
} }
} }

View File

@ -89,7 +89,7 @@ static char *mapPid2Machine (struct server_id pid)
/* show machine name rather PID on table "Open Files"? */ /* show machine name rather PID on table "Open Files"? */
if (PID_or_Machine) { if (PID_or_Machine) {
for (map = pidmap; map != NULL; map = map->next) { for (map = pidmap; map != NULL; map = map->next) {
if (procid_equal(&pid, &map->pid)) { if (serverid_equal(&pid, &map->pid)) {
if (map->machine == NULL) /* no machine name */ if (map->machine == NULL) /* no machine name */
break; /* show PID */ break; /* show PID */
@ -207,7 +207,7 @@ static int traverse_fn2(const struct connections_key *key,
void *private_data) void *private_data)
{ {
if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid) || if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid) ||
procid_equal(&crec->pid, &smbd_pid)) serverid_equal(&crec->pid, &smbd_pid))
return 0; return 0;
addPid2Machine (crec->pid, crec->machine); addPid2Machine (crec->pid, crec->machine);