Replace global list for grouplist with list(s) for each exportlist element.
In mountd.c, the grouplist structures are linked into a single global linked list headed by "grphead". The only use of this linked list is to free all list elements when the exportlist elements are also all being free'd at the time the exports are being reloaded. This patch replaces this one global linked list head with a list head in each exportlist structure, where the grouplist elements for that exported file system are linked. The only change is that now the grouplist elements are free'd with the associated exportlist element as they are free'd instead of all grouplist elements being free'd after the exportlist elements are free'd. This change should have no effect in practice. This is being done, since a future patch that will add a "-I" option for incrementally updating the exports in the kernel needs to know which grouplist elements are associated with each exported file system and having them linked into a list headed by the exportlist element does that. MFC after: 1 month
This commit is contained in:
parent
5a1e222bfd
commit
711d44ee56
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347583
@ -114,6 +114,7 @@ struct dirlist {
|
|||||||
struct exportlist {
|
struct exportlist {
|
||||||
struct dirlist *ex_dirl;
|
struct dirlist *ex_dirl;
|
||||||
struct dirlist *ex_defdir;
|
struct dirlist *ex_defdir;
|
||||||
|
struct grouplist *ex_grphead;
|
||||||
int ex_flag;
|
int ex_flag;
|
||||||
fsid_t ex_fs;
|
fsid_t ex_fs;
|
||||||
char *ex_fsdir;
|
char *ex_fsdir;
|
||||||
@ -235,7 +236,6 @@ static void terminate(int);
|
|||||||
|
|
||||||
static struct exportlisthead exphead = SLIST_HEAD_INITIALIZER(&exphead);
|
static struct exportlisthead exphead = SLIST_HEAD_INITIALIZER(&exphead);
|
||||||
static SLIST_HEAD(, mountlist) mlhead = SLIST_HEAD_INITIALIZER(&mlhead);
|
static SLIST_HEAD(, mountlist) mlhead = SLIST_HEAD_INITIALIZER(&mlhead);
|
||||||
static struct grouplist *grphead;
|
|
||||||
static char *exnames_default[2] = { _PATH_EXPORTS, NULL };
|
static char *exnames_default[2] = { _PATH_EXPORTS, NULL };
|
||||||
static char **exnames;
|
static char **exnames;
|
||||||
static char **hosts = NULL;
|
static char **hosts = NULL;
|
||||||
@ -455,7 +455,6 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
grphead = (struct grouplist *)NULL;
|
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
exnames = argv;
|
exnames = argv;
|
||||||
else
|
else
|
||||||
@ -1692,8 +1691,8 @@ get_exportlist_one(void)
|
|||||||
*/
|
*/
|
||||||
if (has_host) {
|
if (has_host) {
|
||||||
hang_dirp(dirhead, tgrp, ep, opt_flags);
|
hang_dirp(dirhead, tgrp, ep, opt_flags);
|
||||||
grp->gr_next = grphead;
|
grp->gr_next = ep->ex_grphead;
|
||||||
grphead = tgrp;
|
ep->ex_grphead = tgrp;
|
||||||
} else {
|
} else {
|
||||||
hang_dirp(dirhead, (struct grouplist *)NULL, ep,
|
hang_dirp(dirhead, (struct grouplist *)NULL, ep,
|
||||||
opt_flags);
|
opt_flags);
|
||||||
@ -1720,7 +1719,6 @@ get_exportlist_one(void)
|
|||||||
static void
|
static void
|
||||||
get_exportlist(void)
|
get_exportlist(void)
|
||||||
{
|
{
|
||||||
struct grouplist *grp, *tgrp;
|
|
||||||
struct export_args export;
|
struct export_args export;
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
struct statfs *mntbufp;
|
struct statfs *mntbufp;
|
||||||
@ -1743,14 +1741,6 @@ get_exportlist(void)
|
|||||||
*/
|
*/
|
||||||
free_exports(&exphead);
|
free_exports(&exphead);
|
||||||
|
|
||||||
grp = grphead;
|
|
||||||
while (grp) {
|
|
||||||
tgrp = grp;
|
|
||||||
grp = grp->gr_next;
|
|
||||||
free_grp(tgrp);
|
|
||||||
}
|
|
||||||
grphead = (struct grouplist *)NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* and the old V4 root dir.
|
* and the old V4 root dir.
|
||||||
*/
|
*/
|
||||||
@ -2448,6 +2438,7 @@ get_host(char *cp, struct grouplist *grp, struct grouplist *tgrp)
|
|||||||
static void
|
static void
|
||||||
free_exp(struct exportlist *ep)
|
free_exp(struct exportlist *ep)
|
||||||
{
|
{
|
||||||
|
struct grouplist *grp, *tgrp;
|
||||||
|
|
||||||
if (ep->ex_defdir) {
|
if (ep->ex_defdir) {
|
||||||
free_host(ep->ex_defdir->dp_hosts);
|
free_host(ep->ex_defdir->dp_hosts);
|
||||||
@ -2458,6 +2449,12 @@ free_exp(struct exportlist *ep)
|
|||||||
if (ep->ex_indexfile)
|
if (ep->ex_indexfile)
|
||||||
free(ep->ex_indexfile);
|
free(ep->ex_indexfile);
|
||||||
free_dir(ep->ex_dirl);
|
free_dir(ep->ex_dirl);
|
||||||
|
grp = ep->ex_grphead;
|
||||||
|
while (grp) {
|
||||||
|
tgrp = grp;
|
||||||
|
grp = grp->gr_next;
|
||||||
|
free_grp(tgrp);
|
||||||
|
}
|
||||||
free((caddr_t)ep);
|
free((caddr_t)ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user