2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * IRIX inode operations
24 * afs_syscall_icreatename64
38 * afs_syscall_ilistinode64
42 #include <afsconfig.h>
43 #include "afs/param.h"
46 #include "afs/sysincludes.h" /* Standard vendor system headers */
47 #include "afsincludes.h" /* Afs-based standard headers */
48 #include "afs/osi_inode.h"
49 #include "afs/afs_stats.h" /* statistics stuff */
51 #define BAD_IGET -1000
54 * SGI dependent system calls
58 * `INODESPECIAL' type inodes are ones that describe volumes.
60 #define INODESPECIAL 0xffffffff /* ... from ../vol/viceinode.h */
63 * copy disk inode to incore inode and vice-versa
66 afsdptoip(struct efs_dinode *dp, struct inode *ip)
70 ip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
71 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
72 || ip->i_version == EFS_IVER_AFSINO);
73 ap = (struct afsparms *)ip->i_afs;
76 dmag(dp, 0) << 24 | dmag(dp, 1) << 16 | dmag(dp, 2) << 8 | dmag(dp,
80 if (ip->i_version == EFS_IVER_AFSSPEC) {
81 ap->vicep3 = dmag(dp, 8); /* Type */
83 dmag(dp, 4) << 24 | dmag(dp, 5) << 16 | dmag(dp,
90 ap->vicep2 = dmag(dp, 4) << 16 | dmag(dp, 5) << 8 | dmag(dp, 6) << 0;
92 ap->vicep3 = dmag(dp, 7) << 16 | dmag(dp, 8) << 8 | dmag(dp, 9) << 0;
94 ap->vicep4 = dmag(dp, 10) << 16 | dmag(dp, 11) << 8 | (dp)->di_spare;
99 afsiptodp(struct inode *ip, struct efs_dinode *dp)
103 if (ip->i_afs == NULL)
106 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
107 || ip->i_version == EFS_IVER_AFSINO);
108 ap = (struct afsparms *)ip->i_afs;
109 /* vicep1 is VOLid */
110 dmag(dp, 0) = ap->vicep1 >> 24;
111 dmag(dp, 1) = ap->vicep1 >> 16;
112 dmag(dp, 2) = ap->vicep1 >> 8;
113 dmag(dp, 3) = ap->vicep1 >> 0;
115 if (ip->i_version == EFS_IVER_AFSSPEC) {
117 dmag(dp, 8) = ap->vicep3;
119 dmag(dp, 4) = ap->vicep4 >> 24;
120 dmag(dp, 5) = ap->vicep4 >> 16;
121 dmag(dp, 6) = ap->vicep4 >> 8;
122 dmag(dp, 7) = ap->vicep4 >> 0;
125 dmag(dp, 4) = ap->vicep2 >> 16;
126 dmag(dp, 5) = ap->vicep2 >> 8;
127 dmag(dp, 6) = ap->vicep2 >> 0;
129 dmag(dp, 7) = ap->vicep3 >> 16;
130 dmag(dp, 8) = ap->vicep3 >> 8;
131 dmag(dp, 9) = ap->vicep3 >> 0;
133 dmag(dp, 10) = ap->vicep4 >> 16;
134 dmag(dp, 11) = ap->vicep4 >> 8;
135 dp->di_spare = ap->vicep4 >> 0;
140 afsidestroy(struct inode *ip)
143 kmem_free(ip->i_afs, sizeof(struct afsparms));
148 extern int efs_fstype;
149 #ifdef AFS_SGI_XFS_IOPS_ENV
150 extern int xfs_fstype;
154 getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
161 vfsp = vfs_devsearch(dev, efs_fstype);
163 vfsp = vfs_devsearch(dev);
169 #ifndef AFS_SGI65_ENV
170 if (vfsp->vfs_fstype != efs_fstype)
175 iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
176 (unsigned int)(inode & 0xffffffff), &ip)) {
184 igetinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
189 AFS_STATCNT(igetinode);
190 if (error = getinode(vfsp, dev, inode, &ip))
199 #define SET_XFS_ERROR(POS, DEV, INO) \
200 XFS_IGET_EPOS = (POS), XFS_IGET_DEV = (DEV), XFS_IGET_INO = (INO)
203 xfs_getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct xfs_inode **ipp)
205 struct xfs_inode *ip;
210 vfsp = vfs_devsearch(dev, xfs_fstype);
212 vfsp = vfs_devsearch(dev);
215 SET_XFS_ERROR(1, dev, inode);
219 #ifndef AFS_SGI65_ENV
220 if (vfsp->vfs_fstype != xfs_fstype) {
221 SET_XFS_ERROR(2, vfsp->vfs_dev, inode);
226 if (error = xfs_iget((((struct mount *)
227 ((vfsp)->vfs_bh.bh_first)->bd_pdata)), (void *)0,
228 (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
230 SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
238 /* xfs_igetinode now returns an unlocked inode. This is fine, since we
239 * have a refcount on the holding vnode.
242 xfs_igetinode(struct vfs *vfsp, dev_t dev, ino_t inode,
243 struct xfs_inode **ipp)
245 struct xfs_inode *ip;
250 AFS_STATCNT(igetinode);
253 if (error = xfs_getinode(vfsp, dev, inode, &ip)) {
257 xfs_iunlock(ip, XFS_ILOCK_SHARED);
259 vattr.va_mask = AT_STAT;
260 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), error);
262 SET_XFS_ERROR(4, vp->v_vfsp->vfs_dev, inode);
266 if (vattr.va_nlink == 0 || vattr.va_type != VREG) {
267 SET_XFS_ERROR(5, vp->v_vfsp->vfs_dev, inode);
276 /**************************************************************************
277 * inode creation routines.
279 ***************************************************************************/
289 /* EFS only fs suite uses this entry point - icreate in afssyscalls.c. */
291 icreate(struct icreateargs *uap, rval_t * rvp)
297 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
298 afs_uint32 dev, near_inode, param1, param2, param3, param4;
304 #ifdef AFS_SGI_XFS_IOPS_ENV
305 /* inode creation routines for icreatename64 entry point. Use for EFS/XFS
306 * fileserver suite. For XFS, create a name in the namespace as well as the
307 * inode. For EFS, just call the original routine.
310 #include <afs/xfsattrs.h>
311 #include <sys/attributes.h>
313 extern char *int_to_base64(char *, int);
315 /* Lock against races creating/removing directory - vos zap RO, vos create RW*/
316 kmutex_t afs_vol_create_lock;
317 int afs_vol_create_lock_inited = 0;
318 #define AFS_LOCK_VOL_CREATE() { \
319 if (!afs_vol_create_lock_inited) { \
320 mutex_init(&afs_vol_create_lock, MUTEX_DEFAULT, \
321 "afs_vol_create_lock"); \
322 afs_vol_create_lock_inited = 1; \
324 mutex_enter(&afs_vol_create_lock); \
326 #define AFS_UNLOCK_VOL_CREATE() mutex_exit(&afs_vol_create_lock)
330 * Create an AFS inode in the XFS name space. If required create the proper
331 * containing directory. See sys/xfsattrs.h for the details on the naming
332 * conventions and the usage of file and directory attributes.
334 * The inode parameters are stored in an XFS attribute called "AFS". In
335 * addition gid is set to XFS_VICEMAGIC and uid is set to the low 31 bits
336 * of the RW volume id. This is so inode verification in iinc and idec
337 * don't need to get the attribute. Note that only the low 31 bits are set.
338 * This is because chmod only accepts up to MAX_UID and chmod is used
339 * to correct these values in xfs_ListViceInodes.
342 xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
343 afs_inode_params_t params, ino_t * inop)
345 #define AFS_PNAME_SIZE 16
348 b64_string_t stmp1, stmp2;
349 afs_xfs_attr_t attrs;
351 int name_version = AFS_XFS_NAME_VERS;
352 int code = 0, unused;
355 int rw_vno; /* volume ID of parent volume */
362 /* Get vnode for directory which will contain new inode. */
363 if (datalen >= AFS_PNAME_SIZE)
366 AFS_COPYINSTR((char *)datap, path, AFS_PNAME_SIZE - 1, &junk, unused);
371 rw_vno = (params[1] == INODESPECIAL) ? params[3] : params[0];
375 strcat(path, AFS_INODE_DIR_NAME);
376 strcat(path, int_to_base64(stmp1, rw_vno));
378 if (params[1] == INODESPECIAL)
379 AFS_LOCK_VOL_CREATE();
381 code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, &dvp);
382 if (code == ENOENT) {
383 /* Maybe it's an old directory name format. */
384 AFS_COPYINSTR((char *)datap, name, AFS_PNAME_SIZE - 1, &junk, unused);
386 strcat(name, int_to_base64(stmp1, rw_vno));
387 code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, &dvp);
389 /* Use old name format. */
391 name_version = AFS_XFS_NAME_VERS1;
395 if (code == ENOENT) {
396 afs_xfs_dattr_t dattr;
397 /* make directory. */
400 AFS_VN_OPEN(path, UIO_SYSSPACE, FCREAT | FEXCL, 0700, &dvp,
403 if (code == EEXIST) {
404 /* someone beat us to it? */
405 code = gop_lookupname(path, AFS_UIOSYS, NO_FOLLOW, &dvp);
408 AFS_UNLOCK_VOL_CREATE();
413 memset((char *)&dattr, 0, sizeof(dattr));
414 dattr.atd_version = AFS_XFS_ATD_VERS;
415 dattr.atd_volume = rw_vno;
416 AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char *)&dattr,
417 SIZEOF_XFS_DATTR_T, ATTR_ROOT | ATTR_CREATE,
418 OSI_GET_CURRENT_CRED(), code);
422 (void)vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
423 AFS_UNLOCK_VOL_CREATE();
428 vattr.va_mask = AT_FSID | AT_NODEID; /* gets a guick return using FSID */
429 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
435 memset((char *)&attrs, 0, sizeof(attrs));
436 attrs.at_pino = vattr.va_nodeid;
439 /* Create the desired file. Use up to ten tries to create a unique name. */
440 (void)strcpy(name, path);
441 (void)strcat(name, "/.");
442 (void)strcat(name, int_to_base64(stmp2, params[2]));
443 s = &name[strlen(name)];
445 attrs.at_tag = 0; /* Initial guess at a unique tag. */
446 for (i = 0; i < 10; i++) {
449 strcat(s, int_to_base64(stmp1, attrs.at_tag));
451 AFS_VN_OPEN(name, UIO_SYSSPACE, FCREAT | FEXCL, 0600, &vp,
453 if (!code || code != EEXIST)
458 /* Unlock the creation process since the directory now has a file in it. */
459 if (params[1] == INODESPECIAL)
460 AFS_UNLOCK_VOL_CREATE();
463 /* Set attributes. */
464 memcpy((char *)attrs.at_param, (char *)params,
465 sizeof(afs_inode_params_t));
466 attrs.at_attr_version = AFS_XFS_ATTR_VERS;
467 attrs.at_name_version = name_version;
468 AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char *)&attrs, SIZEOF_XFS_ATTR_T,
469 ATTR_ROOT | ATTR_CREATE, OSI_GET_CURRENT_CRED(),
473 vattr.va_uid = AFS_XFS_VNO_CLIP(params[0]);
474 vattr.va_gid = XFS_VICEMAGIC;
475 vattr.va_mask = AT_MODE | AT_UID | AT_GID;
476 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
479 vattr.va_mask = AT_NODEID;
480 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
483 *inop = vattr.va_nodeid;
488 /* remove partially created file. */
489 (void)vn_remove(name, UIO_SYSSPACE, RMFILE);
491 /* and directory if volume special file. */
493 AFS_LOCK_VOL_CREATE();
494 (void)vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
495 AFS_UNLOCK_VOL_CREATE();
501 /* afs_syscall_icreatename64
502 * This is the icreatename64 entry point used by the combined EFS/XFS
503 * fileserver suite. The datap and datalen do not need to be set for EFS.
506 afs_syscall_icreatename64(int dev, int datap, int datalen, int paramp,
510 afs_inode_params_t param;
516 if (!afs_suser(NULL))
520 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
522 vfsp = vfs_devsearch(dev);
528 AFS_COPYIN((char *)paramp, (char *)param, sizeof(afs_inode_params_t),
530 if (vfsp->vfs_fstype == xfs_fstype) {
531 code = xfs_icreatename64(vfsp, datap, datalen, param, &ino);
535 AFS_COPYOUT((char *)&ino, (char *)inop, sizeof(ino_t), code);
538 } else if (vfsp->vfs_fstype == efs_fstype) {
540 afs_syscall_icreate(dev, 0, param[0], param[1], param[2],
545 ino = (ino_t) rval.r_val1;
546 AFS_COPYOUT((char *)&ino, (char *)inop, sizeof(ino_t), code);
552 #endif /* AFS_SGI_XFS_IOPS_ENV */
555 * iopen system calls -- open an inode for reading/writing
556 * Restricted to super user.
558 * The original EFS only system calls are still present in the kernel for
559 * in case a kernel upgrade is done for a fix, but the EFS fileserver is
568 #ifdef AFS_SGI_XFS_IOPS_ENV
578 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp)
586 AFS_STATCNT(afs_syscall_iopen);
587 if (!afs_suser(NULL))
589 vfsp = vfs_devsearch(dev, xfs_fstype);
591 vfsp = vfs_devsearch(dev, efs_fstype);
595 if (vfsp->vfs_fstype == xfs_fstype) {
596 struct xfs_inode *xip;
597 if (error = xfs_igetinode(vfsp, (dev_t) dev, inode, &xip))
600 if (error = vfile_alloc((usrmod + 1) & (FMASK), &fp, &fd)) {
605 osi_Panic("afs_syscall_iopen: bad fstype = %d\n", vfsp->vfs_fstype);
613 * EFS/XFS version vectors to correct code based vfs_fstype. Expects a
614 * 64 bit inode number.
617 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp)
624 AFS_STATCNT(afs_syscall_iopen);
625 if (!afs_suser(NULL))
627 vfsp = vfs_devsearch(dev);
632 if (vfsp->vfs_fstype == xfs_fstype) {
633 struct xfs_inode *xip;
635 if (error = xfs_igetinode(vfsp, (dev_t) dev, inode, &xip))
638 if (error = falloc(vp, (usrmod + 1) & (FMASK), &fp, &fd)) {
642 } else if (vfsp->vfs_fstype == efs_fstype) {
644 if (error = igetinode(vfsp, (dev_t) dev, inode, &ip))
646 if (error = falloc(EFS_ITOV(ip), (usrmod + 1) & (FMASK), &fp, &fd)) {
652 osi_Panic("afs_syscall_iopen: bad fstype = %d\n", vfsp->vfs_fstype);
658 #endif /* AFS_SGI65_ENV */
661 iopen(struct iopenargs *uap, rval_t * rvp)
664 return (afs_syscall_iopen
665 (uap->dev, (ino_t) uap->inode, uap->usrmod, rvp));
669 iopen64(struct iopenargs64 *uap, rval_t * rvp)
672 return (afs_syscall_iopen
673 (uap->dev, (ino_t) ((uap->inode_hi << 32) | uap->inode_lo),
677 #else /* AFS_SGI_XFS_IOPS_ENV */
678 /* iopen/afs_syscall_iopen
680 * Original EFS only 32 bit iopen call.
683 iopen(struct iopenargs *uap, rval_t * rvp)
686 return (afs_syscall_iopen(uap->dev, uap->inode, uap->usrmod, rvp));
690 afs_syscall_iopen(dev, inode, usrmod, rvp)
691 int dev, inode, usrmod;
699 AFS_STATCNT(afs_syscall_iopen);
700 if (!afs_suser(NULL))
702 if (error = igetinode(0, (dev_t) dev, inode, &ip))
704 if (error = falloc(EFS_ITOV(ip), (usrmod + 1) & (FMASK), &fp, &fd)) {
715 #endif /* AFS_SGI_XFS_IOPS_ENV */
718 * Support for iinc() and idec() system calls--increment or decrement
720 * Restricted to super user.
721 * Only VICEMAGIC type inodes.
723 #ifdef AFS_SGI_XFS_IOPS_ENV
727 * XFS/EFS iinc/idec code for EFS. Uses 64 bit inode numbers.
730 xfs_iincdec64(struct vfs *vfsp, ino_t inode, int inode_p1, int amount)
735 afs_xfs_attr_t attrs;
736 int length = SIZEOF_XFS_ATTR_T;
737 afs_xfs_dattr_t dattr;
743 xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
744 (void *)0, (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
750 xfs_iunlock(ip, XFS_ILOCK_SHARED);
752 vattr.va_mask = AT_GID | AT_UID | AT_MODE;
753 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
757 if (!code && (vattr.va_gid != XFS_VICEMAGIC))
760 if (!code && (AFS_XFS_VNO_CLIP(inode_p1) != vattr.va_uid))
768 nlink = vattr.va_mode & AFS_XFS_MODE_LINK_MASK;
774 vattr.va_mode &= ~AFS_XFS_MODE_LINK_MASK;
775 vattr.va_mode |= nlink;
776 vattr.va_mask = AT_MODE;
777 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
782 b64_string_t stmp1, stmp2;
786 length = SIZEOF_XFS_ATTR_T;
787 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char *)&attrs, &length, ATTR_ROOT,
788 OSI_GET_CURRENT_CRED(), code);
791 if (length != SIZEOF_XFS_ATTR_T
792 || attrs.at_attr_version != AFS_XFS_ATTR_VERS)
795 /* Get the vnode for the directory this file is in. */
799 code = xfs_getinode(vp->v_vfsp, NULL, attrs.at_pino, &ip);
804 xfs_iunlock(ip, XFS_ILOCK_SHARED);
806 /* Verify directory attributes. */
807 length = SIZEOF_XFS_DATTR_T;
808 AFS_VOP_ATTR_GET(dvp, AFS_XFS_DATTR, (char *)&dattr, &length,
809 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
811 if (length != SIZEOF_XFS_DATTR_T
812 || dattr.atd_version != AFS_XFS_ATD_VERS)
821 strcat(path, int_to_base64(stmp1, attrs.at_param[2]));
823 strcat(path, int_to_base64(stmp1, attrs.at_tag));
825 AFS_VOP_REMOVE(dvp, path, OSI_GET_CURRENT_CRED(), code);
829 vattr.va_mask = AT_NLINK;
830 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code2);
832 if (vattr.va_nlink == 2) {
833 vnode_t *ddvp; /* parent of volume directory. */
834 /* Try to remove the directory if this is a volume
835 * special file. It's ok to fail.
837 AFS_VOP_LOOKUP(dvp, "..", &ddvp, (struct pathname *)NULL,
838 0, OSI_GET_CURRENT_RDIR(),
839 OSI_GET_CURRENT_CRED(), code2);
844 if (attrs.at_name_version == AFS_XFS_NAME_VERS2)
845 strcpy(path, AFS_INODE_DIR_NAME);
849 (attrs.at_param[1] ==
850 INODESPECIAL) ? attrs.
851 at_param[3] : attrs.at_param[0]);
853 AFS_LOCK_VOL_CREATE();
854 AFS_VOP_RMDIR(ddvp, path, OSI_GET_CURRENT_CDIR(),
855 OSI_GET_CURRENT_CRED(), code2);
856 AFS_UNLOCK_VOL_CREATE();
869 iincdec64(int dev, int inode_hi, int inode_lo, int inode_p1, int amount)
873 if (!afs_suser(NULL))
876 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
878 vfsp = vfs_devsearch(dev);
884 if (vfsp->vfs_fstype == xfs_fstype) {
889 return xfs_iincdec64(vfsp, inode, inode_p1, amount);
895 afs_syscall_idec64(int dev, int inode_hi, int inode_lo, int inode_p1)
897 return iincdec64(dev, inode_hi, inode_lo, inode_p1, -1);
901 afs_syscall_iinc64(int dev, int inode_hi, int inode_lo, int inode_p1)
903 return iincdec64(dev, inode_hi, inode_lo, inode_p1, 1);
917 iinc(struct iincargs *uap, rval_t * rvp)
924 idec(struct iincargs *uap, rval_t * rvp)
932 * XFS/EFS iinc/idec entry points for EFS only fileservers.
936 iincdec(dev, inode, inode_p1, amount)
937 int dev, inode, inode_p1, amount;
941 if (!afs_suser(NULL))
943 vfsp = vfs_devsearch(dev);
947 if (vfsp->vfs_fstype != efs_fstype)
950 return efs_iincdec(vfsp, inode, inode_p1, amount);
954 iinc(struct iincargs *uap, rval_t * rvp)
957 return (iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
961 idec(struct iincargs *uap, rval_t * rvp)
964 return (iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
966 #endif /* AFS_SGI65_ENV */
968 #else /* AFS_SGI_XFS_IOPS_ENV */
969 /* afs_syscall_iincdec iinc idec
971 * These are the original EFS only entry points.
974 afs_syscall_iincdec(dev, inode, inode_p1, amount)
975 int dev, inode, inode_p1, amount;
980 if (!afs_suser(NULL))
982 if (error = igetinode(0, (dev_t) dev, inode, &ip))
985 if (!IS_VICEMAGIC(ip))
987 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
990 ip->i_nlink += amount;
991 osi_Assert(ip->i_nlink >= 0);
992 if (ip->i_nlink == 0) {
998 /* XXX sync write?? */
1010 iinc(struct iincargs *uap, rval_t * rvp)
1013 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1017 idec(struct iincargs *uap, rval_t * rvp)
1020 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1022 #endif /* AFS_SGI_XFS_IOPS_ENV */
1024 #ifdef AFS_SGI_XFS_IOPS_ENV
1025 /* afs_syscall_ilistinode64
1026 * Gathers up all required info for ListViceInodes in one system call.
1029 afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo, int datap,
1038 afs_xfs_attr_t attrs;
1040 i_list_inode_t data;
1043 if (!afs_suser(NULL))
1045 #ifdef AFS_SGI65_ENV
1046 vfsp = vfs_devsearch(dev, xfs_fstype);
1048 vfsp = vfs_devsearch(dev);
1053 #ifndef AFS_SGI65_ENV
1054 if (vfsp->vfs_fstype != xfs_fstype)
1058 AFS_COPYIN((char *)datalenp, &idatalen, sizeof(int), code);
1059 if (idatalen < sizeof(i_list_inode_t)) {
1060 idatalen = sizeof(i_list_inode_t);
1061 AFS_COPYOUT((char *)datalenp, (char *)&idatalen, sizeof(int), code);
1064 idatalen = sizeof(i_list_inode_t);
1065 AFS_COPYOUT((char *)datalenp, (char *)&idatalen, sizeof(int), code);
1067 AFS_COPYIN((char *)datap, (char *)&data, sizeof(i_list_inode_t), code);
1068 if (data.ili_version != AFS_XFS_ILI_VERSION) {
1069 data.ili_version = AFS_XFS_ILI_VERSION;
1070 AFS_COPYOUT((char *)&data, (char *)datap, sizeof(i_list_inode_t),
1080 xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
1081 (void *)0, (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
1087 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1089 length = SIZEOF_XFS_ATTR_T;
1091 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char *)&attrs, &length, ATTR_ROOT,
1092 OSI_GET_CURRENT_CRED(), code);
1098 if (attrs.at_attr_version != AFS_XFS_ATTR_VERS)
1103 vattr.va_mask = AT_STAT;
1104 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
1108 memset((char *)&data, 0, sizeof(data));
1109 data.ili_info.inodeNumber = inode;
1110 data.ili_info.byteCount = vattr.va_size;
1111 data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK);
1112 memcpy((char *)data.ili_info.param, (char *)attrs.at_param,
1113 sizeof(data.ili_info.param));
1114 data.ili_attr_version = attrs.at_attr_version;
1115 data.ili_name_version = attrs.at_name_version;
1116 data.ili_tag = attrs.at_tag;
1117 data.ili_pino = attrs.at_pino;
1118 data.ili_vno = vattr.va_uid;
1119 data.ili_magic = vattr.va_gid;
1120 AFS_COPYOUT((char *)&data, (char *)datap, sizeof(data), code);
1125 #endif /* AFS_SGI_XFS_IOPS_ENV */