mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Rename FROMFIELD to 'container_of'.
Ian Jackson points out that the Linux kernel has a macro of this name with the same purpose, and suggests that it's a good idea to use the same name as they do, so that at least some people reading one code base might recognise it from the other. I never really thought very hard about what order FROMFIELD's parameters should go in, and therefore I'm pleasantly surprised to find that my order agrees with the kernel's, so I don't have to permute every call site as part of making this change :-)
This commit is contained in:
@ -145,14 +145,14 @@ void ssh2_userauth_set_transport_layer(PacketProtocolLayer *userauth,
|
||||
PacketProtocolLayer *transport)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(userauth, struct ssh2_userauth_state, ppl);
|
||||
container_of(userauth, struct ssh2_userauth_state, ppl);
|
||||
s->transport_layer = transport;
|
||||
}
|
||||
|
||||
static void ssh2_userauth_free(PacketProtocolLayer *ppl)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(ppl, struct ssh2_userauth_state, ppl);
|
||||
container_of(ppl, struct ssh2_userauth_state, ppl);
|
||||
bufchain_clear(&s->banner);
|
||||
|
||||
if (s->successor_layer)
|
||||
@ -198,7 +198,7 @@ static PktIn *ssh2_userauth_pop(struct ssh2_userauth_state *s)
|
||||
static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(ppl, struct ssh2_userauth_state, ppl);
|
||||
container_of(ppl, struct ssh2_userauth_state, ppl);
|
||||
PktIn *pktin;
|
||||
|
||||
ssh2_userauth_filter_queue(s); /* no matter why we were called */
|
||||
@ -1653,14 +1653,14 @@ static void ssh2_userauth_special_cmd(PacketProtocolLayer *ppl,
|
||||
static int ssh2_userauth_want_user_input(PacketProtocolLayer *ppl)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(ppl, struct ssh2_userauth_state, ppl);
|
||||
container_of(ppl, struct ssh2_userauth_state, ppl);
|
||||
return s->want_user_input;
|
||||
}
|
||||
|
||||
static void ssh2_userauth_got_user_input(PacketProtocolLayer *ppl)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(ppl, struct ssh2_userauth_state, ppl);
|
||||
container_of(ppl, struct ssh2_userauth_state, ppl);
|
||||
if (s->want_user_input)
|
||||
queue_idempotent_callback(&s->ppl.ic_process_queue);
|
||||
}
|
||||
@ -1668,6 +1668,6 @@ static void ssh2_userauth_got_user_input(PacketProtocolLayer *ppl)
|
||||
static void ssh2_userauth_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
|
||||
{
|
||||
struct ssh2_userauth_state *s =
|
||||
FROMFIELD(ppl, struct ssh2_userauth_state, ppl);
|
||||
container_of(ppl, struct ssh2_userauth_state, ppl);
|
||||
ssh_ppl_reconfigure(s->successor_layer, conf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user