inpcb: add const qualifiers on functions that select address/port
There are several functions that keep database locked and do address and port selection before a caller commits the changes to the inpcb. Mark the inpcb argument with a good documenting const.
This commit is contained in:
@@ -754,8 +754,9 @@ in_pcbbind(struct inpcb *inp, struct sockaddr_in *sin, int flags,
|
||||
* lsa can be NULL for IPv6.
|
||||
*/
|
||||
int
|
||||
in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, u_short *lportp,
|
||||
struct sockaddr *fsa, u_short fport, struct ucred *cred, int lookupflags)
|
||||
in_pcb_lport_dest(const struct inpcb *inp, struct sockaddr *lsa,
|
||||
u_short *lportp, struct sockaddr *fsa, u_short fport, struct ucred *cred,
|
||||
int lookupflags)
|
||||
{
|
||||
struct inpcbinfo *pcbinfo;
|
||||
struct inpcb *tmpinp;
|
||||
@@ -1143,8 +1144,8 @@ in_pcbconnect(struct inpcb *inp, struct sockaddr_in *sin, struct ucred *cred)
|
||||
* of connect. Take jails into account as well.
|
||||
*/
|
||||
int
|
||||
in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr,
|
||||
struct ucred *cred)
|
||||
in_pcbladdr(const struct inpcb *inp, struct in_addr *faddr,
|
||||
struct in_addr *laddr, struct ucred *cred)
|
||||
{
|
||||
struct ifaddr *ifa;
|
||||
struct sockaddr *sa;
|
||||
@@ -1360,7 +1361,7 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr,
|
||||
* and port. These are not updated in the error case.
|
||||
*/
|
||||
int
|
||||
in_pcbconnect_setup(struct inpcb *inp, struct sockaddr_in *sin,
|
||||
in_pcbconnect_setup(const struct inpcb *inp, struct sockaddr_in *sin,
|
||||
in_addr_t *laddrp, u_short *lportp, in_addr_t *faddrp, u_short *fportp,
|
||||
struct ucred *cred)
|
||||
{
|
||||
|
||||
@@ -645,13 +645,13 @@ int in_pcbbind(struct inpcb *, struct sockaddr_in *, int, struct ucred *);
|
||||
int in_pcbbind_setup(struct inpcb *, struct sockaddr_in *, in_addr_t *,
|
||||
u_short *, int, struct ucred *);
|
||||
int in_pcbconnect(struct inpcb *, struct sockaddr_in *, struct ucred *);
|
||||
int in_pcbconnect_setup(struct inpcb *, struct sockaddr_in *, in_addr_t *,
|
||||
u_short *, in_addr_t *, u_short *, struct ucred *);
|
||||
int in_pcbconnect_setup(const struct inpcb *, struct sockaddr_in *,
|
||||
in_addr_t *, u_short *, in_addr_t *, u_short *, struct ucred *);
|
||||
void in_pcbdisconnect(struct inpcb *);
|
||||
void in_pcbdrop(struct inpcb *);
|
||||
void in_pcbfree(struct inpcb *);
|
||||
int in_pcbinshash(struct inpcb *);
|
||||
int in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *,
|
||||
int in_pcbladdr(const struct inpcb *, struct in_addr *, struct in_addr *,
|
||||
struct ucred *);
|
||||
int in_pcblbgroup_numa(struct inpcb *, int arg);
|
||||
void in_pcblisten(struct inpcb *);
|
||||
|
||||
@@ -50,7 +50,7 @@ int inp_trylock(struct inpcb *inp, const inp_lookup_t lock);
|
||||
bool inp_smr_lock(struct inpcb *, const inp_lookup_t);
|
||||
int in_pcb_lport(struct inpcb *, struct in_addr *, u_short *,
|
||||
struct ucred *, int);
|
||||
int in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa,
|
||||
int in_pcb_lport_dest(const struct inpcb *inp, struct sockaddr *lsa,
|
||||
u_short *lportp, struct sockaddr *fsa, u_short fport,
|
||||
struct ucred *cred, int lookupflags);
|
||||
struct inpcb *in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short,
|
||||
|
||||
Reference in New Issue
Block a user