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"
48 #include "afs/sysincludes.h" /* Standard vendor system headers */
49 #include "afsincludes.h" /* Afs-based standard headers */
50 #include "afs/osi_inode.h"
51 #include "afs/afs_stats.h" /* statistics stuff */
53 #define BAD_IGET -1000
56 * SGI dependent system calls
60 * `INODESPECIAL' type inodes are ones that describe volumes.
62 #define INODESPECIAL 0xffffffff /* ... from ../vol/viceinode.h */
65 * copy disk inode to incore inode and vice-versa
68 afsdptoip(struct efs_dinode *dp, struct inode *ip)
72 ip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
73 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
74 || ip->i_version == EFS_IVER_AFSINO);
75 ap = (struct afsparms *)ip->i_afs;
78 dmag(dp, 0) << 24 | dmag(dp, 1) << 16 | dmag(dp, 2) << 8 | dmag(dp,
82 if (ip->i_version == EFS_IVER_AFSSPEC) {
83 ap->vicep3 = dmag(dp, 8); /* Type */
85 dmag(dp, 4) << 24 | dmag(dp, 5) << 16 | dmag(dp,
92 ap->vicep2 = dmag(dp, 4) << 16 | dmag(dp, 5) << 8 | dmag(dp, 6) << 0;
94 ap->vicep3 = dmag(dp, 7) << 16 | dmag(dp, 8) << 8 | dmag(dp, 9) << 0;
96 ap->vicep4 = dmag(dp, 10) << 16 | dmag(dp, 11) << 8 | (dp)->di_spare;
101 afsiptodp(struct inode *ip, struct efs_dinode *dp)
105 if (ip->i_afs == NULL)
108 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
109 || ip->i_version == EFS_IVER_AFSINO);
110 ap = (struct afsparms *)ip->i_afs;
111 /* vicep1 is VOLid */
112 dmag(dp, 0) = ap->vicep1 >> 24;
113 dmag(dp, 1) = ap->vicep1 >> 16;
114 dmag(dp, 2) = ap->vicep1 >> 8;
115 dmag(dp, 3) = ap->vicep1 >> 0;
117 if (ip->i_version == EFS_IVER_AFSSPEC) {
119 dmag(dp, 8) = ap->vicep3;
121 dmag(dp, 4) = ap->vicep4 >> 24;
122 dmag(dp, 5) = ap->vicep4 >> 16;
123 dmag(dp, 6) = ap->vicep4 >> 8;
124 dmag(dp, 7) = ap->vicep4 >> 0;
127 dmag(dp, 4) = ap->vicep2 >> 16;
128 dmag(dp, 5) = ap->vicep2 >> 8;
129 dmag(dp, 6) = ap->vicep2 >> 0;
131 dmag(dp, 7) = ap->vicep3 >> 16;
132 dmag(dp, 8) = ap->vicep3 >> 8;
133 dmag(dp, 9) = ap->vicep3 >> 0;
135 dmag(dp, 10) = ap->vicep4 >> 16;
136 dmag(dp, 11) = ap->vicep4 >> 8;
137 dp->di_spare = ap->vicep4 >> 0;
142 afsidestroy(struct inode *ip)
145 kmem_free(ip->i_afs, sizeof(struct afsparms));
150 extern int efs_fstype;
151 #ifdef AFS_SGI_XFS_IOPS_ENV
152 extern int xfs_fstype;
156 getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
163 vfsp = vfs_devsearch(dev, efs_fstype);
165 vfsp = vfs_devsearch(dev);
171 #ifndef AFS_SGI65_ENV
172 if (vfsp->vfs_fstype != efs_fstype)
177 iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
178 (unsigned int)(inode & 0xffffffff), &ip)) {
186 igetinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
191 AFS_STATCNT(igetinode);
192 if (error = getinode(vfsp, dev, inode, &ip))
201 #define SET_XFS_ERROR(POS, DEV, INO) \
202 XFS_IGET_EPOS = (POS), XFS_IGET_DEV = (DEV), XFS_IGET_INO = (INO)
205 xfs_getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct xfs_inode **ipp)
207 struct xfs_inode *ip;
212 vfsp = vfs_devsearch(dev, xfs_fstype);
214 vfsp = vfs_devsearch(dev);
217 SET_XFS_ERROR(1, dev, inode);
221 #ifndef AFS_SGI65_ENV
222 if (vfsp->vfs_fstype != xfs_fstype) {
223 SET_XFS_ERROR(2, vfsp->vfs_dev, inode);
228 if (error = xfs_iget((((struct mount *)
229 ((vfsp)->vfs_bh.bh_first)->bd_pdata)), (void *)0,
230 (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
232 SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
240 /* xfs_igetinode now returns an unlocked inode. This is fine, since we
241 * have a refcount on the holding vnode.
244 xfs_igetinode(struct vfs *vfsp, dev_t dev, ino_t inode,
245 struct xfs_inode **ipp)
247 struct xfs_inode *ip;
252 AFS_STATCNT(igetinode);
255 if (error = xfs_getinode(vfsp, dev, inode, &ip)) {
259 xfs_iunlock(ip, XFS_ILOCK_SHARED);
261 vattr.va_mask = AT_STAT;
262 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), error);
264 SET_XFS_ERROR(4, vp->v_vfsp->vfs_dev, inode);
268 if (vattr.va_nlink == 0 || vattr.va_type != VREG) {
269 SET_XFS_ERROR(5, vp->v_vfsp->vfs_dev, inode);
278 /**************************************************************************
279 * inode creation routines.
281 ***************************************************************************/
291 /* EFS only fs suite uses this entry point - icreate in afssyscalls.c. */
293 icreate(struct icreateargs *uap, rval_t * rvp)
299 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
300 afs_uint32 dev, near_inode, param1, param2, param3, param4;
306 #ifdef AFS_SGI_XFS_IOPS_ENV
307 /* inode creation routines for icreatename64 entry point. Use for EFS/XFS
308 * fileserver suite. For XFS, create a name in the namespace as well as the
309 * inode. For EFS, just call the original routine.
312 #include <afs/xfsattrs.h>
313 #include <sys/attributes.h>
315 extern char *int_to_base64(char *, int);
317 /* Lock against races creating/removing directory - vos zap RO, vos create RW*/
318 kmutex_t afs_vol_create_lock;
319 int afs_vol_create_lock_inited = 0;
320 #define AFS_LOCK_VOL_CREATE() { \
321 if (!afs_vol_create_lock_inited) { \
322 mutex_init(&afs_vol_create_lock, MUTEX_DEFAULT, \
323 "afs_vol_create_lock"); \
324 afs_vol_create_lock_inited = 1; \
326 mutex_enter(&afs_vol_create_lock); \
328 #define AFS_UNLOCK_VOL_CREATE() mutex_exit(&afs_vol_create_lock)
332 * Create an AFS inode in the XFS name space. If required create the proper
333 * containing directory. See sys/xfsattrs.h for the details on the naming
334 * conventions and the usage of file and directory attributes.
336 * The inode parameters are stored in an XFS attribute called "AFS". In
337 * addition gid is set to XFS_VICEMAGIC and uid is set to the low 31 bits
338 * of the RW volume id. This is so inode verification in iinc and idec
339 * don't need to get the attribute. Note that only the low 31 bits are set.
340 * This is because chmod only accepts up to MAX_UID and chmod is used
341 * to correct these values in xfs_ListViceInodes.
344 xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
345 afs_inode_params_t params, ino_t * inop)
347 #define AFS_PNAME_SIZE 16
350 b64_string_t stmp1, stmp2;
351 afs_xfs_attr_t attrs;
353 int name_version = AFS_XFS_NAME_VERS;
354 int code = 0, unused;
357 int rw_vno; /* volume ID of parent volume */
364 /* Get vnode for directory which will contain new inode. */
365 if (datalen >= AFS_PNAME_SIZE)
368 AFS_COPYINSTR((char *)datap, path, AFS_PNAME_SIZE - 1, &junk, unused);
373 rw_vno = (params[1] == INODESPECIAL) ? params[3] : params[0];
377 strcat(path, AFS_INODE_DIR_NAME);
378 strcat(path, int_to_base64(stmp1, rw_vno));
380 if (params[1] == INODESPECIAL)
381 AFS_LOCK_VOL_CREATE();
383 code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, &dvp);
384 if (code == ENOENT) {
385 /* Maybe it's an old directory name format. */
386 AFS_COPYINSTR((char *)datap, name, AFS_PNAME_SIZE - 1, &junk, unused);
388 strcat(name, int_to_base64(stmp1, rw_vno));
389 code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, &dvp);
391 /* Use old name format. */
393 name_version = AFS_XFS_NAME_VERS1;
397 if (code == ENOENT) {
398 afs_xfs_dattr_t dattr;
399 /* make directory. */
402 AFS_VN_OPEN(path, UIO_SYSSPACE, FCREAT | FEXCL, 0700, &dvp,
405 if (code == EEXIST) {
406 /* someone beat us to it? */
407 code = gop_lookupname(path, AFS_UIOSYS, NO_FOLLOW, &dvp);
410 AFS_UNLOCK_VOL_CREATE();
415 memset((char *)&dattr, 0, sizeof(dattr));
416 dattr.atd_version = AFS_XFS_ATD_VERS;
417 dattr.atd_volume = rw_vno;
418 AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char *)&dattr,
419 SIZEOF_XFS_DATTR_T, ATTR_ROOT | ATTR_CREATE,
420 OSI_GET_CURRENT_CRED(), code);
424 (void)vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
425 AFS_UNLOCK_VOL_CREATE();
430 vattr.va_mask = AT_FSID | AT_NODEID; /* gets a guick return using FSID */
431 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
437 memset((char *)&attrs, 0, sizeof(attrs));
438 attrs.at_pino = vattr.va_nodeid;
441 /* Create the desired file. Use up to ten tries to create a unique name. */
442 (void)strcpy(name, path);
443 (void)strcat(name, "/.");
444 (void)strcat(name, int_to_base64(stmp2, params[2]));
445 s = &name[strlen(name)];
447 attrs.at_tag = 0; /* Initial guess at a unique tag. */
448 for (i = 0; i < 10; i++) {
451 strcat(s, int_to_base64(stmp1, attrs.at_tag));
453 AFS_VN_OPEN(name, UIO_SYSSPACE, FCREAT | FEXCL, 0600, &vp,
455 if (!code || code != EEXIST)
460 /* Unlock the creation process since the directory now has a file in it. */
461 if (params[1] == INODESPECIAL)
462 AFS_UNLOCK_VOL_CREATE();
465 /* Set attributes. */
466 memcpy((char *)attrs.at_param, (char *)params,
467 sizeof(afs_inode_params_t));
468 attrs.at_attr_version = AFS_XFS_ATTR_VERS;
469 attrs.at_name_version = name_version;
470 AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char *)&attrs, SIZEOF_XFS_ATTR_T,
471 ATTR_ROOT | ATTR_CREATE, OSI_GET_CURRENT_CRED(),
475 vattr.va_uid = AFS_XFS_VNO_CLIP(params[0]);
476 vattr.va_gid = XFS_VICEMAGIC;
477 vattr.va_mask = AT_MODE | AT_UID | AT_GID;
478 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
481 vattr.va_mask = AT_NODEID;
482 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
485 *inop = vattr.va_nodeid;
490 /* remove partially created file. */
491 (void)vn_remove(name, UIO_SYSSPACE, RMFILE);
493 /* and directory if volume special file. */
495 AFS_LOCK_VOL_CREATE();
496 (void)vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
497 AFS_UNLOCK_VOL_CREATE();
503 /* afs_syscall_icreatename64
504 * This is the icreatename64 entry point used by the combined EFS/XFS
505 * fileserver suite. The datap and datalen do not need to be set for EFS.
508 afs_syscall_icreatename64(int dev, int datap, int datalen, int paramp,
512 afs_inode_params_t param;
518 if (!afs_suser(NULL))
522 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
524 vfsp = vfs_devsearch(dev);
530 AFS_COPYIN((char *)paramp, (char *)param, sizeof(afs_inode_params_t),
532 if (vfsp->vfs_fstype == xfs_fstype) {
533 code = xfs_icreatename64(vfsp, datap, datalen, param, &ino);
537 AFS_COPYOUT((char *)&ino, (char *)inop, sizeof(ino_t), code);
540 } else if (vfsp->vfs_fstype == efs_fstype) {
542 afs_syscall_icreate(dev, 0, param[0], param[1], param[2],
547 ino = (ino_t) rval.r_val1;
548 AFS_COPYOUT((char *)&ino, (char *)inop, sizeof(ino_t), code);
554 #endif /* AFS_SGI_XFS_IOPS_ENV */
557 * iopen system calls -- open an inode for reading/writing
558 * Restricted to super user.
560 * The original EFS only system calls are still present in the kernel for
561 * in case a kernel upgrade is done for a fix, but the EFS fileserver is
570 #ifdef AFS_SGI_XFS_IOPS_ENV
580 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp)
588 AFS_STATCNT(afs_syscall_iopen);
589 if (!afs_suser(NULL))
591 vfsp = vfs_devsearch(dev, xfs_fstype);
593 vfsp = vfs_devsearch(dev, efs_fstype);
597 if (vfsp->vfs_fstype == xfs_fstype) {
598 struct xfs_inode *xip;
599 if (error = xfs_igetinode(vfsp, (dev_t) dev, inode, &xip))
602 if (error = vfile_alloc((usrmod + 1) & (FMASK), &fp, &fd)) {
607 osi_Panic("afs_syscall_iopen: bad fstype = %d\n", vfsp->vfs_fstype);
615 * EFS/XFS version vectors to correct code based vfs_fstype. Expects a
616 * 64 bit inode number.
619 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp)
626 AFS_STATCNT(afs_syscall_iopen);
627 if (!afs_suser(NULL))
629 vfsp = vfs_devsearch(dev);
634 if (vfsp->vfs_fstype == xfs_fstype) {
635 struct xfs_inode *xip;
637 if (error = xfs_igetinode(vfsp, (dev_t) dev, inode, &xip))
640 if (error = falloc(vp, (usrmod + 1) & (FMASK), &fp, &fd)) {
644 } else if (vfsp->vfs_fstype == efs_fstype) {
646 if (error = igetinode(vfsp, (dev_t) dev, inode, &ip))
648 if (error = falloc(EFS_ITOV(ip), (usrmod + 1) & (FMASK), &fp, &fd)) {
654 osi_Panic("afs_syscall_iopen: bad fstype = %d\n", vfsp->vfs_fstype);
660 #endif /* AFS_SGI65_ENV */
663 iopen(struct iopenargs *uap, rval_t * rvp)
666 return (afs_syscall_iopen
667 (uap->dev, (ino_t) uap->inode, uap->usrmod, rvp));
671 iopen64(struct iopenargs64 *uap, rval_t * rvp)
674 return (afs_syscall_iopen
675 (uap->dev, (ino_t) ((uap->inode_hi << 32) | uap->inode_lo),
679 #else /* AFS_SGI_XFS_IOPS_ENV */
680 /* iopen/afs_syscall_iopen
682 * Original EFS only 32 bit iopen call.
685 iopen(struct iopenargs *uap, rval_t * rvp)
688 return (afs_syscall_iopen(uap->dev, uap->inode, uap->usrmod, rvp));
692 afs_syscall_iopen(dev, inode, usrmod, rvp)
693 int dev, inode, usrmod;
701 AFS_STATCNT(afs_syscall_iopen);
702 if (!afs_suser(NULL))
704 if (error = igetinode(0, (dev_t) dev, inode, &ip))
706 if (error = falloc(EFS_ITOV(ip), (usrmod + 1) & (FMASK), &fp, &fd)) {
717 #endif /* AFS_SGI_XFS_IOPS_ENV */
720 * Support for iinc() and idec() system calls--increment or decrement
722 * Restricted to super user.
723 * Only VICEMAGIC type inodes.
725 #ifdef AFS_SGI_XFS_IOPS_ENV
729 * XFS/EFS iinc/idec code for EFS. Uses 64 bit inode numbers.
732 xfs_iincdec64(struct vfs *vfsp, ino_t inode, int inode_p1, int amount)
737 afs_xfs_attr_t attrs;
738 int length = SIZEOF_XFS_ATTR_T;
739 afs_xfs_dattr_t dattr;
745 xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
746 (void *)0, (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
752 xfs_iunlock(ip, XFS_ILOCK_SHARED);
754 vattr.va_mask = AT_GID | AT_UID | AT_MODE;
755 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
759 if (!code && (vattr.va_gid != XFS_VICEMAGIC))
762 if (!code && (AFS_XFS_VNO_CLIP(inode_p1) != vattr.va_uid))
770 nlink = vattr.va_mode & AFS_XFS_MODE_LINK_MASK;
776 vattr.va_mode &= ~AFS_XFS_MODE_LINK_MASK;
777 vattr.va_mode |= nlink;
778 vattr.va_mask = AT_MODE;
779 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
784 b64_string_t stmp1, stmp2;
788 length = SIZEOF_XFS_ATTR_T;
789 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char *)&attrs, &length, ATTR_ROOT,
790 OSI_GET_CURRENT_CRED(), code);
793 if (length != SIZEOF_XFS_ATTR_T
794 || attrs.at_attr_version != AFS_XFS_ATTR_VERS)
797 /* Get the vnode for the directory this file is in. */
801 code = xfs_getinode(vp->v_vfsp, NULL, attrs.at_pino, &ip);
806 xfs_iunlock(ip, XFS_ILOCK_SHARED);
808 /* Verify directory attributes. */
809 length = SIZEOF_XFS_DATTR_T;
810 AFS_VOP_ATTR_GET(dvp, AFS_XFS_DATTR, (char *)&dattr, &length,
811 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
813 if (length != SIZEOF_XFS_DATTR_T
814 || dattr.atd_version != AFS_XFS_ATD_VERS)
823 strcat(path, int_to_base64(stmp1, attrs.at_param[2]));
825 strcat(path, int_to_base64(stmp1, attrs.at_tag));
827 AFS_VOP_REMOVE(dvp, path, OSI_GET_CURRENT_CRED(), code);
831 vattr.va_mask = AT_NLINK;
832 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code2);
834 if (vattr.va_nlink == 2) {
835 vnode_t *ddvp; /* parent of volume directory. */
836 /* Try to remove the directory if this is a volume
837 * special file. It's ok to fail.
839 AFS_VOP_LOOKUP(dvp, "..", &ddvp, (struct pathname *)NULL,
840 0, OSI_GET_CURRENT_RDIR(),
841 OSI_GET_CURRENT_CRED(), code2);
846 if (attrs.at_name_version == AFS_XFS_NAME_VERS2)
847 strcpy(path, AFS_INODE_DIR_NAME);
851 (attrs.at_param[1] ==
852 INODESPECIAL) ? attrs.
853 at_param[3] : attrs.at_param[0]);
855 AFS_LOCK_VOL_CREATE();
856 AFS_VOP_RMDIR(ddvp, path, OSI_GET_CURRENT_CDIR(),
857 OSI_GET_CURRENT_CRED(), code2);
858 AFS_UNLOCK_VOL_CREATE();
871 iincdec64(int dev, int inode_hi, int inode_lo, int inode_p1, int amount)
875 if (!afs_suser(NULL))
878 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
880 vfsp = vfs_devsearch(dev);
886 if (vfsp->vfs_fstype == xfs_fstype) {
891 return xfs_iincdec64(vfsp, inode, inode_p1, amount);
897 afs_syscall_idec64(int dev, int inode_hi, int inode_lo, int inode_p1)
899 return iincdec64(dev, inode_hi, inode_lo, inode_p1, -1);
903 afs_syscall_iinc64(int dev, int inode_hi, int inode_lo, int inode_p1)
905 return iincdec64(dev, inode_hi, inode_lo, inode_p1, 1);
919 iinc(struct iincargs *uap, rval_t * rvp)
926 idec(struct iincargs *uap, rval_t * rvp)
934 * XFS/EFS iinc/idec entry points for EFS only fileservers.
938 iincdec(dev, inode, inode_p1, amount)
939 int dev, inode, inode_p1, amount;
943 if (!afs_suser(NULL))
945 vfsp = vfs_devsearch(dev);
949 if (vfsp->vfs_fstype != efs_fstype)
952 return efs_iincdec(vfsp, inode, inode_p1, amount);
956 iinc(struct iincargs *uap, rval_t * rvp)
959 return (iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
963 idec(struct iincargs *uap, rval_t * rvp)
966 return (iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
968 #endif /* AFS_SGI65_ENV */
970 #else /* AFS_SGI_XFS_IOPS_ENV */
971 /* afs_syscall_iincdec iinc idec
973 * These are the original EFS only entry points.
976 afs_syscall_iincdec(dev, inode, inode_p1, amount)
977 int dev, inode, inode_p1, amount;
982 if (!afs_suser(NULL))
984 if (error = igetinode(0, (dev_t) dev, inode, &ip))
987 if (!IS_VICEMAGIC(ip))
989 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
992 ip->i_nlink += amount;
993 osi_Assert(ip->i_nlink >= 0);
994 if (ip->i_nlink == 0) {
1000 /* XXX sync write?? */
1012 iinc(struct iincargs *uap, rval_t * rvp)
1015 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1019 idec(struct iincargs *uap, rval_t * rvp)
1022 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1024 #endif /* AFS_SGI_XFS_IOPS_ENV */
1026 #ifdef AFS_SGI_XFS_IOPS_ENV
1027 /* afs_syscall_ilistinode64
1028 * Gathers up all required info for ListViceInodes in one system call.
1031 afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo, int datap,
1040 afs_xfs_attr_t attrs;
1042 i_list_inode_t data;
1045 if (!afs_suser(NULL))
1047 #ifdef AFS_SGI65_ENV
1048 vfsp = vfs_devsearch(dev, xfs_fstype);
1050 vfsp = vfs_devsearch(dev);
1055 #ifndef AFS_SGI65_ENV
1056 if (vfsp->vfs_fstype != xfs_fstype)
1060 AFS_COPYIN((char *)datalenp, &idatalen, sizeof(int), code);
1061 if (idatalen < sizeof(i_list_inode_t)) {
1062 idatalen = sizeof(i_list_inode_t);
1063 AFS_COPYOUT((char *)datalenp, (char *)&idatalen, sizeof(int), code);
1066 idatalen = sizeof(i_list_inode_t);
1067 AFS_COPYOUT((char *)datalenp, (char *)&idatalen, sizeof(int), code);
1069 AFS_COPYIN((char *)datap, (char *)&data, sizeof(i_list_inode_t), code);
1070 if (data.ili_version != AFS_XFS_ILI_VERSION) {
1071 data.ili_version = AFS_XFS_ILI_VERSION;
1072 AFS_COPYOUT((char *)&data, (char *)datap, sizeof(i_list_inode_t),
1082 xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
1083 (void *)0, (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
1089 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1091 length = SIZEOF_XFS_ATTR_T;
1093 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char *)&attrs, &length, ATTR_ROOT,
1094 OSI_GET_CURRENT_CRED(), code);
1100 if (attrs.at_attr_version != AFS_XFS_ATTR_VERS)
1105 vattr.va_mask = AT_STAT;
1106 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
1110 memset((char *)&data, 0, sizeof(data));
1111 data.ili_info.inodeNumber = inode;
1112 data.ili_info.byteCount = vattr.va_size;
1113 data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK);
1114 memcpy((char *)data.ili_info.param, (char *)attrs.at_param,
1115 sizeof(data.ili_info.param));
1116 data.ili_attr_version = attrs.at_attr_version;
1117 data.ili_name_version = attrs.at_name_version;
1118 data.ili_tag = attrs.at_tag;
1119 data.ili_pino = attrs.at_pino;
1120 data.ili_vno = vattr.va_uid;
1121 data.ili_magic = vattr.va_gid;
1122 AFS_COPYOUT((char *)&data, (char *)datap, sizeof(data), code);
1127 #endif /* AFS_SGI_XFS_IOPS_ENV */