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 "../afs/param.h" /* Should be always first */
43 #include "../afs/sysincludes.h" /* Standard vendor system headers */
44 #include "../afs/afsincludes.h" /* Afs-based standard headers */
45 #include "../afs/osi_inode.h"
46 #include "../afs/afs_stats.h" /* statistics stuff */
48 #define BAD_IGET -1000
51 * SGI dependent system calls
55 * `INODESPECIAL' type inodes are ones that describe volumes.
57 #define INODESPECIAL 0xffffffff /* ... from ../vol/viceinode.h */
60 * copy disk inode to incore inode and vice-versa
63 afsdptoip(struct efs_dinode *dp, struct inode *ip)
67 ip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
68 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
69 || ip->i_version == EFS_IVER_AFSINO);
70 ap = (struct afsparms *)ip->i_afs;
72 ap->vicep1 = dmag(dp, 0) << 24 | dmag(dp, 1) << 16 |
73 dmag(dp, 2) << 8 | dmag(dp, 3) << 0;
75 if (ip->i_version == EFS_IVER_AFSSPEC) {
76 ap->vicep3 = dmag(dp, 8); /* Type */
77 ap->vicep4 = dmag(dp, 4) << 24 | dmag(dp, 5) << 16 |
78 dmag(dp, 6) << 8 | dmag(dp, 7) << 0;
82 ap->vicep2 = dmag(dp, 4) << 16 |
83 dmag(dp, 5) << 8 | dmag(dp, 6) << 0;
85 ap->vicep3 = dmag(dp, 7) << 16 |
86 dmag(dp, 8) << 8 | dmag(dp, 9) << 0;
88 ap->vicep4 = dmag(dp, 10) << 16 |
89 dmag(dp, 11) << 8 | (dp)->di_spare;
94 afsiptodp(struct inode *ip, struct efs_dinode *dp)
98 if (ip->i_afs == NULL)
101 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
102 || ip->i_version == EFS_IVER_AFSINO);
103 ap = (struct afsparms *)ip->i_afs;
104 /* vicep1 is VOLid */
105 dmag(dp, 0) = ap->vicep1 >> 24;
106 dmag(dp, 1) = ap->vicep1 >> 16;
107 dmag(dp, 2) = ap->vicep1 >> 8;
108 dmag(dp, 3) = ap->vicep1 >> 0;
110 if (ip->i_version == EFS_IVER_AFSSPEC) {
112 dmag(dp, 8) = ap->vicep3;
114 dmag(dp, 4) = ap->vicep4 >> 24;
115 dmag(dp, 5) = ap->vicep4 >> 16;
116 dmag(dp, 6) = ap->vicep4 >> 8;
117 dmag(dp, 7) = ap->vicep4 >> 0;
120 dmag(dp, 4) = ap->vicep2 >> 16;
121 dmag(dp, 5) = ap->vicep2 >> 8;
122 dmag(dp, 6) = ap->vicep2 >> 0;
124 dmag(dp, 7) = ap->vicep3 >> 16;
125 dmag(dp, 8) = ap->vicep3 >> 8;
126 dmag(dp, 9) = ap->vicep3 >> 0;
128 dmag(dp, 10) = ap->vicep4 >> 16;
129 dmag(dp, 11) = ap->vicep4 >> 8;
130 dp->di_spare = ap->vicep4 >> 0;
135 afsidestroy(struct inode *ip)
138 kmem_free(ip->i_afs, sizeof(struct afsparms));
143 extern int efs_fstype;
144 #ifdef AFS_SGI_XFS_IOPS_ENV
145 extern int xfs_fstype;
149 getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
156 vfsp = vfs_devsearch(dev, efs_fstype);
158 vfsp = vfs_devsearch(dev);
164 #ifndef AFS_SGI65_ENV
165 if (vfsp->vfs_fstype != efs_fstype)
169 if (error = iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
170 (unsigned int)(inode&0xffffffff), &ip)) {
178 igetinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
183 AFS_STATCNT(igetinode);
184 if (error = getinode(vfsp, dev, inode, &ip))
193 #define SET_XFS_ERROR(POS, DEV, INO) \
194 XFS_IGET_EPOS = (POS), XFS_IGET_DEV = (DEV), XFS_IGET_INO = (INO)
196 int xfs_getinode(struct vfs *vfsp, dev_t dev, ino_t inode,
197 struct xfs_inode **ipp)
199 struct xfs_inode *ip;
204 vfsp = vfs_devsearch(dev, xfs_fstype);
206 vfsp = vfs_devsearch(dev);
209 SET_XFS_ERROR(1, dev, inode);
213 #ifndef AFS_SGI65_ENV
214 if (vfsp->vfs_fstype != xfs_fstype) {
215 SET_XFS_ERROR(2, vfsp->vfs_dev, inode);
220 if (error = xfs_iget((((struct mount *)
221 ((vfsp)->vfs_bh.bh_first)->bd_pdata)),
222 (void*)0, (xfs_ino_t)inode,
223 XFS_ILOCK_SHARED, &ip, (daddr_t)0)) {
224 SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
232 /* xfs_igetinode now returns an unlocked inode. This is fine, since we
233 * have a refcount on the holding vnode.
235 int xfs_igetinode(struct vfs *vfsp, dev_t dev, ino_t inode,
236 struct xfs_inode **ipp)
238 struct xfs_inode *ip;
243 AFS_STATCNT(igetinode);
246 if (error = xfs_getinode(vfsp, dev, inode, &ip)) {
250 xfs_iunlock(ip, XFS_ILOCK_SHARED);
252 vattr.va_mask = AT_STAT;
253 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), error);
255 SET_XFS_ERROR(4, vp->v_vfsp->vfs_dev, inode);
259 if (vattr.va_nlink == 0 || vattr.va_type != VREG) {
260 SET_XFS_ERROR(5, vp->v_vfsp->vfs_dev, inode);
269 /**************************************************************************
270 * inode creation routines.
272 ***************************************************************************/
282 /* EFS only fs suite uses this entry point - icreate in afssyscalls.c. */
283 #ifdef AFS_SGI_EFS_IOPS_ENV
285 icreate(struct icreateargs *uap, rval_t *rvp)
287 AFS_STATCNT(icreate);
288 return(afs_syscall_icreate(uap->dev, uap->near_inode, uap->param1,
289 uap->param2, uap->param3, uap->param4, rvp));
293 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
294 afs_uint32 dev, near_inode, param1, param2, param3, param4;
297 struct inode *ip, *newip;
302 AFS_STATCNT(afs_syscall_icreate);
306 if (error = getinode(0, (dev_t)dev, 2, &ip))
311 if (error = efs_ialloc(ip, IFREG, 1, NODEV, &newip, &cr)) {
317 newip->i_flags |= IACC|IUPD|ICHG;
319 osi_Assert(newip->i_afs == NULL);
320 newip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
321 if (param2 == INODESPECIAL)
322 newip->i_version = EFS_IVER_AFSSPEC;
324 newip->i_version = EFS_IVER_AFSINO;
325 ap = (struct afsparms *)newip->i_afs;
326 ap->vicep1 = param1; /* VOLid */
327 ap->vicep2 = param2; /* Vnode # */
328 ap->vicep3 = param3; /* SPEC:type INO:vnode uniq */
329 ap->vicep4 = param4; /* SPEC:parentId INO:data version */
330 rvp->r_val1 = newip->i_number;
334 #endif /* AFS_SGI_EFS_IOPS_ENV */
336 #ifdef AFS_SGI_XFS_IOPS_ENV
337 /* inode creation routines for icreatename64 entry point. Use for EFS/XFS
338 * fileserver suite. For XFS, create a name in the namespace as well as the
339 * inode. For EFS, just call the original routine.
342 #include <afs/xfsattrs.h>
343 #include <sys/attributes.h>
345 extern char *int_to_base64(char *, int);
347 /* Lock against races creating/removing directory - vos zap RO, vos create RW*/
348 kmutex_t afs_vol_create_lock;
349 int afs_vol_create_lock_inited = 0;
350 #define AFS_LOCK_VOL_CREATE() { \
351 if (!afs_vol_create_lock_inited) { \
352 mutex_init(&afs_vol_create_lock, MUTEX_DEFAULT, \
353 "afs_vol_create_lock"); \
354 afs_vol_create_lock_inited = 1; \
356 mutex_enter(&afs_vol_create_lock); \
358 #define AFS_UNLOCK_VOL_CREATE() mutex_exit(&afs_vol_create_lock)
362 * Create an AFS inode in the XFS name space. If required create the proper
363 * containing directory. See sys/xfsattrs.h for the details on the naming
364 * conventions and the usage of file and directory attributes.
366 * The inode parameters are stored in an XFS attribute called "AFS". In
367 * addition gid is set to XFS_VICEMAGIC and uid is set to the low 31 bits
368 * of the RW volume id. This is so inode verification in iinc and idec
369 * don't need to get the attribute. Note that only the low 31 bits are set.
370 * This is because chmod only accepts up to MAX_UID and chmod is used
371 * to correct these values in xfs_ListViceInodes.
374 xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
375 afs_inode_params_t params, ino_t *inop)
377 #define AFS_PNAME_SIZE 16
380 b64_string_t stmp1, stmp2;
381 afs_xfs_attr_t attrs;
383 int name_version = AFS_XFS_NAME_VERS;
384 int code = 0, unused;
387 int rw_vno; /* volume ID of parent volume */
394 /* Get vnode for directory which will contain new inode. */
395 if (datalen >= AFS_PNAME_SIZE)
398 AFS_COPYINSTR((char*)datap, path, AFS_PNAME_SIZE-1, &junk, unused);
403 rw_vno = (params[1] == INODESPECIAL) ? params[3] : params[0];
407 strcat(path, AFS_INODE_DIR_NAME);
408 strcat(path, int_to_base64(stmp1, rw_vno));
410 if (params[1] == INODESPECIAL)
411 AFS_LOCK_VOL_CREATE();
413 code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, (struct vnode **) 0, &dvp);
414 if (code == ENOENT) {
415 /* Maybe it's an old directory name format. */
416 AFS_COPYINSTR((char*)datap, name, AFS_PNAME_SIZE-1, &junk, unused);
418 strcat(name, int_to_base64(stmp1, rw_vno));
419 code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, (struct vnode **) 0,
422 /* Use old name format. */
424 name_version = AFS_XFS_NAME_VERS1;
428 if (code == ENOENT) {
429 afs_xfs_dattr_t dattr;
430 /* make directory. */
432 code = AFS_VN_OPEN(path, UIO_SYSSPACE, FCREAT|FEXCL, 0700, &dvp,
435 if (code == EEXIST) {
436 /* someone beat us to it? */
437 code = gop_lookupname(path, AFS_UIOSYS, 0, (struct vnode **) 0,
441 AFS_UNLOCK_VOL_CREATE();
447 bzero((char*)&dattr, sizeof(dattr));
448 dattr.atd_version = AFS_XFS_ATD_VERS;
449 dattr.atd_volume = rw_vno;
450 AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char*)&dattr,
452 ATTR_ROOT|ATTR_CREATE, OSI_GET_CURRENT_CRED(), code);
456 (void) vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
457 AFS_UNLOCK_VOL_CREATE();
462 vattr.va_mask = AT_FSID|AT_NODEID; /* gets a guick return using FSID*/
463 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
469 bzero((char*)&attrs, sizeof(attrs));
470 attrs.at_pino = vattr.va_nodeid;
473 /* Create the desired file. Use up to ten tries to create a unique name. */
474 (void) strcpy(name, path);
475 (void) strcat(name, "/.");
476 (void) strcat(name, int_to_base64(stmp2, params[2]));
477 s = &name[strlen(name)];
479 attrs.at_tag = 0; /* Initial guess at a unique tag. */
480 for (i=0; i<10; i++) {
483 strcat(s, int_to_base64(stmp1, attrs.at_tag));
484 code = AFS_VN_OPEN(name, UIO_SYSSPACE, FCREAT|FEXCL, 0600, &vp,
486 if (!code || code != EEXIST)
491 /* Unlock the creation process since the directory now has a file in it.*/
492 if (params[1] == INODESPECIAL)
493 AFS_UNLOCK_VOL_CREATE();
496 /* Set attributes. */
497 bcopy((char*)params, (char*)attrs.at_param,
498 sizeof(afs_inode_params_t));
499 attrs.at_attr_version = AFS_XFS_ATTR_VERS;
500 attrs.at_name_version = name_version;
501 AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char*)&attrs,
503 ATTR_ROOT|ATTR_CREATE, OSI_GET_CURRENT_CRED(),
507 vattr.va_uid = AFS_XFS_VNO_CLIP(params[0]);
508 vattr.va_gid = XFS_VICEMAGIC;
509 vattr.va_mask = AT_MODE | AT_UID | AT_GID;
510 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
513 vattr.va_mask = AT_NODEID;
514 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
517 *inop = vattr.va_nodeid;
522 /* remove partially created file. */
523 (void) vn_remove(name, UIO_SYSSPACE, RMFILE);
525 /* and directory if volume special file. */
527 AFS_LOCK_VOL_CREATE();
528 (void) vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
529 AFS_UNLOCK_VOL_CREATE();
535 /* afs_syscall_icreatename64
536 * This is the icreatename64 entry point used by the combined EFS/XFS
537 * fileserver suite. The datap and datalen do not need to be set for EFS.
540 afs_syscall_icreatename64(int dev, int datap, int datalen, int paramp,
544 afs_inode_params_t param;
554 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
556 vfsp = vfs_devsearch(dev);
562 AFS_COPYIN((char*)paramp, (char*)param, sizeof(afs_inode_params_t), code);
563 if (vfsp->vfs_fstype == xfs_fstype) {
564 code = xfs_icreatename64(vfsp, datap, datalen, param, &ino);
568 AFS_COPYOUT((char*)&ino, (char*)inop, sizeof(ino_t), code);
572 else if (vfsp->vfs_fstype == efs_fstype) {
573 code = afs_syscall_icreate(dev, 0, param[0], param[1], param[2],
578 ino = (ino_t)rval.r_val1;
579 AFS_COPYOUT((char*)&ino, (char*)inop, sizeof(ino_t), code);
585 #endif /* AFS_SGI_XFS_IOPS_ENV */
588 * iopen system calls -- open an inode for reading/writing
589 * Restricted to super user.
591 * The original EFS only system calls are still present in the kernel for
592 * in case a kernel upgrade is done for a fix, but the EFS fileserver is
601 #ifdef AFS_SGI_XFS_IOPS_ENV
611 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t *rvp)
619 AFS_STATCNT(afs_syscall_iopen);
622 vfsp = vfs_devsearch(dev, xfs_fstype);
624 vfsp = vfs_devsearch(dev, efs_fstype);
628 #ifdef AFS_SGI_EFS_IOPS_ENV
629 if (vfsp->vfs_fstype == efs_fstype) {
631 if (error = igetinode(vfsp, (dev_t)dev, inode, &ip))
634 if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
641 #endif /* AFS_SGI_EFS_IOPS_ENV */
642 if (vfsp->vfs_fstype == xfs_fstype) {
643 struct xfs_inode *xip;
644 if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
647 if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
653 osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
662 * EFS/XFS version vectors to correct code based vfs_fstype. Expects a
663 * 64 bit inode number.
666 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t *rvp)
673 AFS_STATCNT(afs_syscall_iopen);
676 vfsp = vfs_devsearch(dev);
681 if (vfsp->vfs_fstype == xfs_fstype) {
682 struct xfs_inode *xip;
684 if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
687 if (error = falloc(vp, (usrmod+1) & (FMASK), &fp, &fd)) {
692 else if (vfsp->vfs_fstype == efs_fstype) {
694 if (error = igetinode(vfsp, (dev_t)dev, inode, &ip))
696 if (error = falloc(EFS_ITOV(ip), (usrmod+1) & (FMASK), &fp, &fd)) {
703 osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
710 #endif /* AFS_SGI65_ENV */
713 iopen(struct iopenargs *uap, rval_t *rvp)
716 return (afs_syscall_iopen(uap->dev, (ino_t)uap->inode, uap->usrmod,
721 iopen64(struct iopenargs64 *uap, rval_t *rvp)
724 return (afs_syscall_iopen(uap->dev,
725 (ino_t)((uap->inode_hi<<32) | uap->inode_lo),
729 #else /* AFS_SGI_XFS_IOPS_ENV */
730 /* iopen/afs_syscall_iopen
732 * Original EFS only 32 bit iopen call.
735 iopen(struct iopenargs *uap, rval_t *rvp)
738 return (afs_syscall_iopen(uap->dev, uap->inode, uap->usrmod, rvp));
742 afs_syscall_iopen(dev, inode, usrmod, rvp)
743 int dev, inode, usrmod;
751 AFS_STATCNT(afs_syscall_iopen);
754 if (error = igetinode(0, (dev_t)dev, inode, &ip))
756 if (error = falloc(EFS_ITOV(ip), (usrmod+1) & (FMASK), &fp, &fd)) {
767 #endif /* AFS_SGI_XFS_IOPS_ENV */
770 * Support for iinc() and idec() system calls--increment or decrement
772 * Restricted to super user.
773 * Only VICEMAGIC type inodes.
775 #ifdef AFS_SGI_XFS_IOPS_ENV
776 #ifdef AFS_SGI_EFS_IOPS_ENV
779 * XFS/EFS iinc/idec code for EFS. Uses 32 bit inode numbers.
781 static int efs_iincdec(vfsp, inode, inode_p1, amount)
783 int inode, inode_p1, amount;
788 if (error = igetinode(vfsp, NULL, inode, &ip))
791 if (!IS_VICEMAGIC(ip))
793 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
796 ip->i_nlink += amount;
797 osi_Assert(ip->i_nlink >= 0);
798 if (ip->i_nlink == 0) {
804 /* XXX sync write?? */
808 #endif /* AFS_SGI_EFS_IOPS_ENV */
812 * XFS/EFS iinc/idec code for EFS. Uses 64 bit inode numbers.
814 static int xfs_iincdec64(struct vfs *vfsp, ino_t inode, int inode_p1,
820 afs_xfs_attr_t attrs;
821 int length = SIZEOF_XFS_ATTR_T;
822 afs_xfs_dattr_t dattr;
827 code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
828 (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, &ip,
834 xfs_iunlock(ip, XFS_ILOCK_SHARED);
836 vattr.va_mask = AT_GID | AT_UID | AT_MODE;
837 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
841 if (!code && (vattr.va_gid != XFS_VICEMAGIC))
844 if (!code && (AFS_XFS_VNO_CLIP(inode_p1) != vattr.va_uid))
852 nlink = vattr.va_mode & AFS_XFS_MODE_LINK_MASK;
858 vattr.va_mode &= ~AFS_XFS_MODE_LINK_MASK;
859 vattr.va_mode |= nlink;
860 vattr.va_mask = AT_MODE;
861 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
867 b64_string_t stmp1, stmp2;
871 length = SIZEOF_XFS_ATTR_T;
872 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char*)&attrs, &length,
873 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
876 if (length != SIZEOF_XFS_ATTR_T
877 || attrs.at_attr_version != AFS_XFS_ATTR_VERS)
880 /* Get the vnode for the directory this file is in. */
884 code = xfs_getinode(vp->v_vfsp, NULL, attrs.at_pino, &ip);
889 xfs_iunlock(ip, XFS_ILOCK_SHARED);
891 /* Verify directory attributes. */
892 length = SIZEOF_XFS_DATTR_T;
893 AFS_VOP_ATTR_GET(dvp, AFS_XFS_DATTR , (char*)&dattr, &length,
894 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
896 if (length != SIZEOF_XFS_DATTR_T
897 || dattr.atd_version != AFS_XFS_ATD_VERS)
906 strcat(path, int_to_base64(stmp1, attrs.at_param[2]));
908 strcat(path, int_to_base64(stmp1, attrs.at_tag));
910 AFS_VOP_REMOVE(dvp, path, OSI_GET_CURRENT_CRED(), code);
914 vattr.va_mask = AT_NLINK;
915 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(),
918 if (vattr.va_nlink == 2) {
919 vnode_t *ddvp; /* parent of volume directory. */
920 /* Try to remove the directory if this is a volume
921 * special file. It's ok to fail.
923 AFS_VOP_LOOKUP(dvp, "..", &ddvp,
924 (struct pathname *)NULL,
925 0, OSI_GET_CURRENT_RDIR(),
926 OSI_GET_CURRENT_CRED(), code2);
931 if (attrs.at_name_version == AFS_XFS_NAME_VERS2)
932 strcpy(path, AFS_INODE_DIR_NAME);
936 (attrs.at_param[1] == INODESPECIAL) ?
937 attrs.at_param[3] : attrs.at_param[0]);
939 AFS_LOCK_VOL_CREATE();
940 AFS_VOP_RMDIR(ddvp, path, OSI_GET_CURRENT_CDIR(),
941 OSI_GET_CURRENT_CRED(), code2);
942 AFS_UNLOCK_VOL_CREATE();
955 iincdec64(int dev, int inode_hi, int inode_lo, int inode_p1, int amount)
962 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
964 vfsp = vfs_devsearch(dev);
970 if (vfsp->vfs_fstype == xfs_fstype) {
975 return xfs_iincdec64(vfsp, inode, inode_p1, amount);
977 #ifdef AFS_SGI_EFS_IOPS_ENV
978 else if (vfsp->vfs_fstype == efs_fstype) {
979 return efs_iincdec(vfsp, inode_lo, inode_p1, amount);
981 #endif /* AFS_SGI_EFS_IOPS_ENV */
986 afs_syscall_idec64(int dev, int inode_hi, int inode_lo, int inode_p1)
988 return iincdec64(dev, inode_hi, inode_lo, inode_p1, -1);
992 afs_syscall_iinc64(int dev, int inode_hi, int inode_lo, int inode_p1)
994 return iincdec64(dev, inode_hi, inode_lo, inode_p1, 1);
1006 #ifdef AFS_SGI65_ENV
1007 int iinc(struct iincargs *uap, rval_t *rvp) {
1011 int idec(struct iincargs *uap, rval_t *rvp) {
1018 * XFS/EFS iinc/idec entry points for EFS only fileservers.
1022 iincdec(dev, inode, inode_p1, amount)
1023 int dev, inode, inode_p1, amount;
1029 vfsp = vfs_devsearch(dev);
1033 if (vfsp->vfs_fstype != efs_fstype)
1036 return efs_iincdec(vfsp, inode, inode_p1, amount);
1039 iinc(struct iincargs *uap, rval_t *rvp) {
1041 return (iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1045 idec(struct iincargs *uap, rval_t *rvp) {
1047 return (iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1049 #endif /* AFS_SGI65_ENV */
1051 #else /* AFS_SGI_XFS_IOPS_ENV */
1052 /* afs_syscall_iincdec iinc idec
1054 * These are the original EFS only entry points.
1057 afs_syscall_iincdec(dev, inode, inode_p1, amount)
1058 int dev, inode, inode_p1, amount;
1065 if (error = igetinode(0, (dev_t)dev, inode, &ip))
1068 if (!IS_VICEMAGIC(ip))
1070 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
1073 ip->i_nlink += amount;
1074 osi_Assert(ip->i_nlink >= 0);
1075 if (ip->i_nlink == 0) {
1076 CLEAR_VICEMAGIC(ip);
1079 ip->i_flags |= ICHG;
1081 /* XXX sync write?? */
1093 iinc(struct iincargs *uap, rval_t *rvp) {
1095 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1099 idec(struct iincargs *uap, rval_t *rvp) {
1101 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1103 #endif /* AFS_SGI_XFS_IOPS_ENV */
1105 #ifdef AFS_SGI_XFS_IOPS_ENV
1106 /* afs_syscall_ilistinode64
1107 * Gathers up all required info for ListViceInodes in one system call.
1110 afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo,
1111 int datap, int datalenp)
1119 afs_xfs_attr_t attrs;
1121 i_list_inode_t data;
1126 #ifdef AFS_SGI65_ENV
1127 vfsp = vfs_devsearch(dev, xfs_fstype);
1129 vfsp = vfs_devsearch(dev);
1134 #ifndef AFS_SGI65_ENV
1135 if (vfsp->vfs_fstype != xfs_fstype)
1139 AFS_COPYIN((char*)datalenp, &idatalen, sizeof(int), code);
1140 if (idatalen < sizeof(i_list_inode_t)) {
1141 idatalen = sizeof(i_list_inode_t);
1142 AFS_COPYOUT((char*)datalenp, (char*)&idatalen, sizeof(int), code);
1145 idatalen = sizeof(i_list_inode_t);
1146 AFS_COPYOUT((char*)datalenp, (char*)&idatalen, sizeof(int), code);
1148 AFS_COPYIN((char*)datap, (char*)&data, sizeof(i_list_inode_t), code);
1149 if (data.ili_version != AFS_XFS_ILI_VERSION) {
1150 data.ili_version = AFS_XFS_ILI_VERSION;
1151 AFS_COPYOUT((char*)&data, (char*)datap, sizeof(i_list_inode_t), code);
1159 code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
1160 (void*)0, (xfs_ino_t)inode,
1161 XFS_ILOCK_SHARED, &ip, (daddr_t)0);
1166 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1168 length = SIZEOF_XFS_ATTR_T;
1170 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char*)&attrs, &length,
1171 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
1177 if (attrs.at_attr_version != AFS_XFS_ATTR_VERS)
1182 vattr.va_mask = AT_STAT;
1183 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
1187 bzero((char*)&data, sizeof(data));
1188 data.ili_info.inodeNumber = inode;
1189 data.ili_info.byteCount = vattr.va_size;
1190 data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK);
1191 bcopy((char*)attrs.at_param, (char*)data.ili_info.param,
1192 sizeof(data.ili_info.param));
1193 data.ili_attr_version = attrs.at_attr_version;
1194 data.ili_name_version = attrs.at_name_version;
1195 data.ili_tag = attrs.at_tag;
1196 data.ili_pino = attrs.at_pino;
1197 data.ili_vno = vattr.va_uid;
1198 data.ili_magic = vattr.va_gid;
1199 AFS_COPYOUT((char*)&data, (char*)datap, sizeof(data), code);
1204 #endif /* AFS_SGI_XFS_IOPS_ENV */