diff options
Diffstat (limited to 'xlators/nfs/server/src/nfs3-fh.c')
| -rw-r--r-- | xlators/nfs/server/src/nfs3-fh.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/xlators/nfs/server/src/nfs3-fh.c b/xlators/nfs/server/src/nfs3-fh.c index eb8223924..e199c56dc 100644 --- a/xlators/nfs/server/src/nfs3-fh.c +++ b/xlators/nfs/server/src/nfs3-fh.c @@ -2,19 +2,10 @@ Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #ifndef _CONFIG_H @@ -46,6 +37,12 @@ nfs3_fh_validate (struct nfs3_fh *fh) if (fh->ident[1] != GF_NFSFH_IDENT1) return 0; + if (fh->ident[2] != GF_NFSFH_IDENT2) + return 0; + + if (fh->ident[3] != GF_NFSFH_IDENT3) + return 0; + return 1; } @@ -58,6 +55,8 @@ nfs3_fh_init (struct nfs3_fh *fh, struct iatt *buf) fh->ident[0] = GF_NFSFH_IDENT0; fh->ident[1] = GF_NFSFH_IDENT1; + fh->ident[2] = GF_NFSFH_IDENT2; + fh->ident[3] = GF_NFSFH_IDENT3; uuid_copy (fh->gfid, buf->ia_gfid); } @@ -112,17 +111,17 @@ nfs3_fh_is_root_fh (struct nfs3_fh *fh) void -nfs3_fh_to_str (struct nfs3_fh *fh, char *str) +nfs3_fh_to_str (struct nfs3_fh *fh, char *str, size_t len) { - char gfid[512]; - char exportid[512]; + char gfid[GF_UUID_BUF_SIZE]; + char exportid[GF_UUID_BUF_SIZE]; if ((!fh) || (!str)) return; - sprintf (str, "FH: exportid %s, gfid %s", - uuid_utoa_r (fh->exportid, exportid), - uuid_utoa_r (fh->gfid, gfid)); + snprintf (str, len, "FH: exportid %s, gfid %s", + uuid_utoa_r (fh->exportid, exportid), + uuid_utoa_r (fh->gfid, gfid)); } void @@ -161,6 +160,8 @@ nfs3_build_fh (inode_t *inode, uuid_t exportid, struct nfs3_fh *newfh) newfh->ident[0] = GF_NFSFH_IDENT0; newfh->ident[1] = GF_NFSFH_IDENT1; + newfh->ident[2] = GF_NFSFH_IDENT2; + newfh->ident[3] = GF_NFSFH_IDENT3; uuid_copy (newfh->gfid, inode->gfid); uuid_copy (newfh->exportid, exportid); return 0; |
