From: Jeffrey Altman Date: Thu, 20 Jan 2011 06:39:11 +0000 (-0500) Subject: vol: make it clearer that SetOGM is not impl on Windows X-Git-Tag: upstream/1.6.0.pre2^2~62 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1cf2d94d4703807186924cc4b5fabc5ded7215bf;p=packages%2Fo%2Fopenafs.git vol: make it clearer that SetOGM is not impl on Windows Separate the SetOGM function into two implementations to match the other OGM functions. Implement the Windows version as returning -1 always. In the future, the OGM functions could be renamed to express their purpose: saving and restoring the volume id and tag associated with a file. Windows currently encodes this information using the CreationDate and the file name but in the future this information might be stored in an alternate data stream. Reviewed-on: http://gerrit.openafs.org/3700 Reviewed-by: Derrick Brashear Tested-by: BuildBot (cherry picked from commit 270e5c01784f6459dd3d1dec81b714a6d7f2baea) Change-Id: I347fb7b135c6fccb941ca4e34b3fb4f080f5b09c Reviewed-on: http://gerrit.openafs.org/3847 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index a1535ddf5..526b30245 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -657,32 +657,14 @@ namei_MakeSpecIno(int volid, int type) return ino; } -/* SetOGM - set owner group and mode bits from parm and tag */ +#ifdef AFS_NT40_ENV +/* SetOGM */ static int SetOGM(FD_t fd, int parm, int tag) { -#ifndef AFS_NT40_ENV -/* - * owner - low 15 bits of parm. - * group - next 15 bits of parm. - * mode - 2 bits of parm, then lowest = 3 bits of tag. - */ - int owner, group, mode; - - owner = parm & 0x7fff; - group = (parm >> 15) & 0x7fff; - if (fchown(fd, owner, group) < 0) - return -1; - - mode = (parm >> 27) & 0x18; - mode |= tag & 0x7; - if (fchmod(fd, mode) < 0) - return -1; -#endif - return 0; + return -1; } -#ifdef AFS_NT40_ENV static int CheckOGM(namei_t *name, FdHandle_t *fdP, int p1) { @@ -704,7 +686,30 @@ CheckOGM(namei_t *name, FdHandle_t *fdP, int p1) return 0; } -#else +#else /* AFS_NT40_ENV */ +/* SetOGM - set owner group and mode bits from parm and tag */ +static int +SetOGM(FD_t fd, int parm, int tag) +{ +/* + * owner - low 15 bits of parm. + * group - next 15 bits of parm. + * mode - 2 bits of parm, then lowest = 3 bits of tag. + */ + int owner, group, mode; + + owner = parm & 0x7fff; + group = (parm >> 15) & 0x7fff; + if (fchown(fd, owner, group) < 0) + return -1; + + mode = (parm >> 27) & 0x18; + mode |= tag & 0x7; + if (fchmod(fd, mode) < 0) + return -1; + return 0; +} + /* GetOGM - get parm and tag from owner, group and mode bits. */ static void GetOGMFromStat(struct afs_stat *status, int *parm, int *tag) @@ -728,7 +733,7 @@ CheckOGM(namei_t *name, FdHandle_t *fdP, int p1) return 0; } -#endif +#endif /* !AFS_NT40_ENV */ int big_vno = 0; /* Just in case we ever do 64 bit vnodes. */