From: David van Moolenbroek Date: Sun, 21 Jun 2015 17:53:53 +0000 (+0000) Subject: libfsdriver: default to noop for putnode X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=3f30eb69f06e23d35b1afcf262f8d5e2c83777c5;p=minix.git libfsdriver: default to noop for putnode While putnode requests should always succeed, very simple file system services may not care about reference counts and thus about putnode requests at all. For this reason, we now default to an OK response if no fdr_putnode implementation is given. Change-Id: I01f6421abf4546a1f69d8c21900a92d6acc45745 --- diff --git a/minix/lib/libfsdriver/call.c b/minix/lib/libfsdriver/call.c index 7b4367396..6b0e78ddb 100644 --- a/minix/lib/libfsdriver/call.c +++ b/minix/lib/libfsdriver/call.c @@ -99,15 +99,15 @@ fsdriver_putnode(const struct fsdriver * __restrict fdp, ino_nr = m_in->m_vfs_fs_putnode.inode; count = m_in->m_vfs_fs_putnode.count; - if (fdp->fdr_putnode == NULL) - return ENOSYS; - if (count == 0 || count > INT_MAX) { printf("fsdriver: invalid reference count\n"); return EINVAL; } - return fdp->fdr_putnode(ino_nr, count); + if (fdp->fdr_putnode != NULL) + return fdp->fdr_putnode(ino_nr, count); + else + return OK; } /* diff --git a/minix/lib/libfsdriver/lookup.c b/minix/lib/libfsdriver/lookup.c index b3bee1a90..b8e2ae080 100644 --- a/minix/lib/libfsdriver/lookup.c +++ b/minix/lib/libfsdriver/lookup.c @@ -259,7 +259,8 @@ fsdriver_lookup(const struct fsdriver * __restrict fdp, else r = ELOOP; - fdp->fdr_putnode(next_node.fn_ino_nr, 1); + if (fdp->fdr_putnode != NULL) + fdp->fdr_putnode(next_node.fn_ino_nr, 1); if (r != OK) break; @@ -276,7 +277,8 @@ fsdriver_lookup(const struct fsdriver * __restrict fdp, } /* We have found a new node. Continue from this node. */ - fdp->fdr_putnode(cur_node.fn_ino_nr, 1); + if (fdp->fdr_putnode != NULL) + fdp->fdr_putnode(cur_node.fn_ino_nr, 1); cur_node = next_node; @@ -324,7 +326,7 @@ fsdriver_lookup(const struct fsdriver * __restrict fdp, m_out->m_fs_vfs_lookup.uid = cur_node.fn_uid; m_out->m_fs_vfs_lookup.gid = cur_node.fn_gid; m_out->m_fs_vfs_lookup.device = cur_node.fn_dev; - } else + } else if (fdp->fdr_putnode != NULL) fdp->fdr_putnode(cur_node.fn_ino_nr, 1); return r;