1 /* Copyright (C) 1995 Transarc Corporation - All rights reserved. */
3 * IRIX inode operations
16 * afs_syscall_icreatename64
30 * afs_syscall_ilistinode64
34 #include "../afs/param.h" /* Should be always first */
35 #include "../afs/sysincludes.h" /* Standard vendor system headers */
36 #include "../afs/afsincludes.h" /* Afs-based standard headers */
37 #include "../afs/osi_inode.h"
38 #include "../afs/afs_stats.h" /* statistics stuff */
40 #define BAD_IGET -1000
43 * SGI dependent system calls
47 * `INODESPECIAL' type inodes are ones that describe volumes.
49 #define INODESPECIAL 0xffffffff /* ... from ../vol/viceinode.h */
52 * copy disk inode to incore inode and vice-versa
55 afsdptoip(struct efs_dinode *dp, struct inode *ip)
59 ip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
60 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
61 || ip->i_version == EFS_IVER_AFSINO);
62 ap = (struct afsparms *)ip->i_afs;
64 ap->vicep1 = dmag(dp, 0) << 24 | dmag(dp, 1) << 16 |
65 dmag(dp, 2) << 8 | dmag(dp, 3) << 0;
67 if (ip->i_version == EFS_IVER_AFSSPEC) {
68 ap->vicep3 = dmag(dp, 8); /* Type */
69 ap->vicep4 = dmag(dp, 4) << 24 | dmag(dp, 5) << 16 |
70 dmag(dp, 6) << 8 | dmag(dp, 7) << 0;
74 ap->vicep2 = dmag(dp, 4) << 16 |
75 dmag(dp, 5) << 8 | dmag(dp, 6) << 0;
77 ap->vicep3 = dmag(dp, 7) << 16 |
78 dmag(dp, 8) << 8 | dmag(dp, 9) << 0;
80 ap->vicep4 = dmag(dp, 10) << 16 |
81 dmag(dp, 11) << 8 | (dp)->di_spare;
86 afsiptodp(struct inode *ip, struct efs_dinode *dp)
90 if (ip->i_afs == NULL)
93 osi_Assert(ip->i_version == EFS_IVER_AFSSPEC
94 || ip->i_version == EFS_IVER_AFSINO);
95 ap = (struct afsparms *)ip->i_afs;
97 dmag(dp, 0) = ap->vicep1 >> 24;
98 dmag(dp, 1) = ap->vicep1 >> 16;
99 dmag(dp, 2) = ap->vicep1 >> 8;
100 dmag(dp, 3) = ap->vicep1 >> 0;
102 if (ip->i_version == EFS_IVER_AFSSPEC) {
104 dmag(dp, 8) = ap->vicep3;
106 dmag(dp, 4) = ap->vicep4 >> 24;
107 dmag(dp, 5) = ap->vicep4 >> 16;
108 dmag(dp, 6) = ap->vicep4 >> 8;
109 dmag(dp, 7) = ap->vicep4 >> 0;
112 dmag(dp, 4) = ap->vicep2 >> 16;
113 dmag(dp, 5) = ap->vicep2 >> 8;
114 dmag(dp, 6) = ap->vicep2 >> 0;
116 dmag(dp, 7) = ap->vicep3 >> 16;
117 dmag(dp, 8) = ap->vicep3 >> 8;
118 dmag(dp, 9) = ap->vicep3 >> 0;
120 dmag(dp, 10) = ap->vicep4 >> 16;
121 dmag(dp, 11) = ap->vicep4 >> 8;
122 dp->di_spare = ap->vicep4 >> 0;
127 afsidestroy(struct inode *ip)
130 kmem_free(ip->i_afs, sizeof(struct afsparms));
135 extern int efs_fstype;
136 #ifdef AFS_SGI_XFS_IOPS_ENV
137 extern int xfs_fstype;
141 getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
148 vfsp = vfs_devsearch(dev, efs_fstype);
150 vfsp = vfs_devsearch(dev);
156 #ifndef AFS_SGI65_ENV
157 if (vfsp->vfs_fstype != efs_fstype)
161 if (error = iget(vfstom(vfsp), (unsigned int)(inode&0xffffffff), &ip)) {
169 igetinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct inode **ipp)
174 AFS_STATCNT(igetinode);
175 if (error = getinode(vfsp, dev, inode, &ip))
184 #define SET_XFS_ERROR(POS, DEV, INO) \
185 XFS_IGET_EPOS = (POS), XFS_IGET_DEV = (DEV), XFS_IGET_INO = (INO)
187 int xfs_getinode(struct vfs *vfsp, dev_t dev, ino_t inode,
188 struct xfs_inode **ipp)
190 struct xfs_inode *ip;
195 vfsp = vfs_devsearch(dev, xfs_fstype);
197 vfsp = vfs_devsearch(dev);
200 SET_XFS_ERROR(1, dev, inode);
204 #ifndef AFS_SGI65_ENV
205 if (vfsp->vfs_fstype != xfs_fstype) {
206 SET_XFS_ERROR(2, vfsp->vfs_dev, inode);
211 if (error = xfs_iget(vfstom(vfsp), (void*)0,
212 (xfs_ino_t)inode,XFS_ILOCK_SHARED, &ip, (daddr_t)0)) {
213 SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
221 /* xfs_igetinode now returns an unlocked inode. This is fine, since we
222 * have a refcount on the holding vnode.
224 int xfs_igetinode(struct vfs *vfsp, dev_t dev, ino_t inode,
225 struct xfs_inode **ipp)
227 struct xfs_inode *ip;
232 AFS_STATCNT(igetinode);
235 if (error = xfs_getinode(vfsp, dev, inode, &ip)) {
239 xfs_iunlock(ip, XFS_ILOCK_SHARED);
241 vattr.va_mask = AT_STAT;
242 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), error);
244 SET_XFS_ERROR(4, vp->v_vfsp->vfs_dev, inode);
248 if (vattr.va_nlink == 0 || vattr.va_type != VREG) {
249 SET_XFS_ERROR(5, vp->v_vfsp->vfs_dev, inode);
258 /**************************************************************************
259 * inode creation routines.
261 ***************************************************************************/
271 /* EFS only fs suite uses this entry point - icreate in afssyscalls.c. */
273 icreate(struct icreateargs *uap, rval_t *rvp)
275 AFS_STATCNT(icreate);
276 return(afs_syscall_icreate(uap->dev, uap->near_inode, uap->param1,
277 uap->param2, uap->param3, uap->param4, rvp));
281 afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
282 afs_uint32 dev, near_inode, param1, param2, param3, param4;
285 struct inode *ip, *newip;
290 AFS_STATCNT(afs_syscall_icreate);
294 if (error = getinode(0, (dev_t)dev, 2, &ip))
299 if (error = efs_ialloc(ip, IFREG, 1, NODEV, &newip, &cr)) {
305 newip->i_flags |= IACC|IUPD|ICHG;
307 osi_Assert(newip->i_afs == NULL);
308 newip->i_afs = kmem_alloc(sizeof(struct afsparms), KM_SLEEP);
309 if (param2 == INODESPECIAL)
310 newip->i_version = EFS_IVER_AFSSPEC;
312 newip->i_version = EFS_IVER_AFSINO;
313 ap = (struct afsparms *)newip->i_afs;
314 ap->vicep1 = param1; /* VOLid */
315 ap->vicep2 = param2; /* Vnode # */
316 ap->vicep3 = param3; /* SPEC:type INO:vnode uniq */
317 ap->vicep4 = param4; /* SPEC:parentId INO:data version */
318 rvp->r_val1 = newip->i_number;
323 #ifdef AFS_SGI_XFS_IOPS_ENV
324 /* inode creation routines for icreatename64 entry point. Use for EFS/XFS
325 * fileserver suite. For XFS, create a name in the namespace as well as the
326 * inode. For EFS, just call the original routine.
329 #include <afs/xfsattrs.h>
330 #include <sys/attributes.h>
332 extern char *int_to_base64(char *, int);
334 /* Lock against races creating/removing directory - vos zap RO, vos create RW*/
335 kmutex_t afs_vol_create_lock;
336 int afs_vol_create_lock_inited = 0;
337 #define AFS_LOCK_VOL_CREATE() { \
338 if (!afs_vol_create_lock_inited) { \
339 mutex_init(&afs_vol_create_lock, MUTEX_DEFAULT, \
340 "afs_vol_create_lock"); \
341 afs_vol_create_lock_inited = 1; \
343 mutex_enter(&afs_vol_create_lock); \
345 #define AFS_UNLOCK_VOL_CREATE() mutex_exit(&afs_vol_create_lock)
349 * Create an AFS inode in the XFS name space. If required create the proper
350 * containing directory. See sys/xfsattrs.h for the details on the naming
351 * conventions and the usage of file and directory attributes.
353 * The inode parameters are stored in an XFS attribute called "AFS". In
354 * addition gid is set to XFS_VICEMAGIC and uid is set to the low 31 bits
355 * of the RW volume id. This is so inode verification in iinc and idec
356 * don't need to get the attribute. Note that only the low 31 bits are set.
357 * This is because chmod only accepts up to MAX_UID and chmod is used
358 * to correct these values in xfs_ListViceInodes.
361 xfs_icreatename64(struct vfs *vfsp, int datap, int datalen,
362 afs_inode_params_t params, ino_t *inop)
364 #define AFS_PNAME_SIZE 16
367 b64_string_t stmp1, stmp2;
368 afs_xfs_attr_t attrs;
370 int name_version = AFS_XFS_NAME_VERS;
371 int code = 0, unused;
374 int rw_vno; /* volume ID of parent volume */
381 /* Get vnode for directory which will contain new inode. */
382 if (datalen >= AFS_PNAME_SIZE)
385 AFS_COPYINSTR((char*)datap, path, AFS_PNAME_SIZE-1, &junk, unused);
390 rw_vno = (params[1] == INODESPECIAL) ? params[3] : params[0];
394 strcat(path, AFS_INODE_DIR_NAME);
395 strcat(path, int_to_base64(stmp1, rw_vno));
397 if (params[1] == INODESPECIAL)
398 AFS_LOCK_VOL_CREATE();
400 code = gop_lookupname(path, AFS_UIOSYS, FOLLOW, (struct vnode **) 0, &dvp);
401 if (code == ENOENT) {
402 /* Maybe it's an old directory name format. */
403 AFS_COPYINSTR((char*)datap, name, AFS_PNAME_SIZE-1, &junk, unused);
405 strcat(name, int_to_base64(stmp1, rw_vno));
406 code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, (struct vnode **) 0,
409 /* Use old name format. */
411 name_version = AFS_XFS_NAME_VERS1;
415 if (code == ENOENT) {
416 afs_xfs_dattr_t dattr;
417 /* make directory. */
419 code = AFS_VN_OPEN(path, UIO_SYSSPACE, FCREAT|FEXCL, 0700, &dvp,
422 if (code == EEXIST) {
423 /* someone beat us to it? */
424 code = gop_lookupname(path, AFS_UIOSYS, 0, (struct vnode **) 0,
428 AFS_UNLOCK_VOL_CREATE();
434 bzero((char*)&dattr, sizeof(dattr));
435 dattr.atd_version = AFS_XFS_ATD_VERS;
436 dattr.atd_volume = rw_vno;
437 AFS_VOP_ATTR_SET(dvp, AFS_XFS_DATTR, (char*)&dattr,
439 ATTR_ROOT|ATTR_CREATE, OSI_GET_CURRENT_CRED(), code);
443 (void) vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
444 AFS_UNLOCK_VOL_CREATE();
449 vattr.va_mask = AT_FSID|AT_NODEID; /* gets a guick return using FSID*/
450 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
456 bzero((char*)&attrs, sizeof(attrs));
457 attrs.at_pino = vattr.va_nodeid;
460 /* Create the desired file. Use up to ten tries to create a unique name. */
461 (void) strcpy(name, path);
462 (void) strcat(name, "/.");
463 (void) strcat(name, int_to_base64(stmp2, params[2]));
464 s = &name[strlen(name)];
466 attrs.at_tag = 0; /* Initial guess at a unique tag. */
467 for (i=0; i<10; i++) {
470 strcat(s, int_to_base64(stmp1, attrs.at_tag));
471 code = AFS_VN_OPEN(name, UIO_SYSSPACE, FCREAT|FEXCL, 0600, &vp,
473 if (!code || code != EEXIST)
478 /* Unlock the creation process since the directory now has a file in it.*/
479 if (params[1] == INODESPECIAL)
480 AFS_UNLOCK_VOL_CREATE();
483 /* Set attributes. */
484 bcopy((char*)params, (char*)attrs.at_param,
485 sizeof(afs_inode_params_t));
486 attrs.at_attr_version = AFS_XFS_ATTR_VERS;
487 attrs.at_name_version = name_version;
488 AFS_VOP_ATTR_SET(vp, AFS_XFS_ATTR, (char*)&attrs,
490 ATTR_ROOT|ATTR_CREATE, OSI_GET_CURRENT_CRED(),
494 vattr.va_uid = AFS_XFS_VNO_CLIP(params[0]);
495 vattr.va_gid = XFS_VICEMAGIC;
496 vattr.va_mask = AT_MODE | AT_UID | AT_GID;
497 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
500 vattr.va_mask = AT_NODEID;
501 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
504 *inop = vattr.va_nodeid;
509 /* remove partially created file. */
510 (void) vn_remove(name, UIO_SYSSPACE, RMFILE);
512 /* and directory if volume special file. */
514 AFS_LOCK_VOL_CREATE();
515 (void) vn_remove(path, UIO_SYSSPACE, RMDIRECTORY);
516 AFS_UNLOCK_VOL_CREATE();
522 /* afs_syscall_icreatename64
523 * This is the icreatename64 entry point used by the combined EFS/XFS
524 * fileserver suite. The datap and datalen do not need to be set for EFS.
527 afs_syscall_icreatename64(int dev, int datap, int datalen, int paramp,
531 afs_inode_params_t param;
541 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
543 vfsp = vfs_devsearch(dev);
549 AFS_COPYIN((char*)paramp, (char*)param, sizeof(afs_inode_params_t), code);
550 if (vfsp->vfs_fstype == xfs_fstype) {
551 code = xfs_icreatename64(vfsp, datap, datalen, param, &ino);
555 AFS_COPYOUT((char*)&ino, (char*)inop, sizeof(ino_t), code);
559 else if (vfsp->vfs_fstype == efs_fstype) {
560 code = afs_syscall_icreate(dev, 0, param[0], param[1], param[2],
565 ino = (ino_t)rval.r_val1;
566 AFS_COPYOUT((char*)&ino, (char*)inop, sizeof(ino_t), code);
572 #endif /* AFS_SGI_XFS_IOPS_ENV */
575 * iopen system calls -- open an inode for reading/writing
576 * Restricted to super user.
578 * The original EFS only system calls are still present in the kernel for
579 * in case a kernel upgrade is done for a fix, but the EFS fileserver is
588 #ifdef AFS_SGI_XFS_IOPS_ENV
598 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t *rvp)
606 AFS_STATCNT(afs_syscall_iopen);
609 vfsp = vfs_devsearch(dev, xfs_fstype);
611 vfsp = vfs_devsearch(dev, efs_fstype);
615 if (vfsp->vfs_fstype == efs_fstype) {
617 if (error = igetinode(vfsp, (dev_t)dev, inode, &ip))
620 if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
626 else if (vfsp->vfs_fstype == xfs_fstype) {
627 struct xfs_inode *xip;
628 if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
631 if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
637 osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
646 * EFS/XFS version vectors to correct code based vfs_fstype. Expects a
647 * 64 bit inode number.
650 afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t *rvp)
657 AFS_STATCNT(afs_syscall_iopen);
660 vfsp = vfs_devsearch(dev);
665 if (vfsp->vfs_fstype == xfs_fstype) {
666 struct xfs_inode *xip;
668 if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
671 if (error = falloc(vp, (usrmod+1) & (FMASK), &fp, &fd)) {
676 else if (vfsp->vfs_fstype == efs_fstype) {
678 if (error = igetinode(vfsp, (dev_t)dev, inode, &ip))
680 if (error = falloc(EFS_ITOV(ip), (usrmod+1) & (FMASK), &fp, &fd)) {
687 osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
694 #endif /* AFS_SGI65_ENV */
697 iopen(struct iopenargs *uap, rval_t *rvp)
700 return (afs_syscall_iopen(uap->dev, (ino_t)uap->inode, uap->usrmod,
705 iopen64(struct iopenargs64 *uap, rval_t *rvp)
708 return (afs_syscall_iopen(uap->dev,
709 (ino_t)((uap->inode_hi<<32) | uap->inode_lo),
713 #else /* AFS_SGI_XFS_IOPS_ENV */
714 /* iopen/afs_syscall_iopen
716 * Original EFS only 32 bit iopen call.
719 iopen(struct iopenargs *uap, rval_t *rvp)
722 return (afs_syscall_iopen(uap->dev, uap->inode, uap->usrmod, rvp));
726 afs_syscall_iopen(dev, inode, usrmod, rvp)
727 int dev, inode, usrmod;
735 AFS_STATCNT(afs_syscall_iopen);
738 if (error = igetinode(0, (dev_t)dev, inode, &ip))
740 if (error = falloc(EFS_ITOV(ip), (usrmod+1) & (FMASK), &fp, &fd)) {
751 #endif /* AFS_SGI_XFS_IOPS_ENV */
754 * Support for iinc() and idec() system calls--increment or decrement
756 * Restricted to super user.
757 * Only VICEMAGIC type inodes.
759 #ifdef AFS_SGI_XFS_IOPS_ENV
762 * XFS/EFS iinc/idec code for EFS. Uses 32 bit inode numbers.
764 static int efs_iincdec(vfsp, inode, inode_p1, amount)
766 int inode, inode_p1, amount;
771 if (error = igetinode(vfsp, NULL, inode, &ip))
774 if (!IS_VICEMAGIC(ip))
776 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
779 ip->i_nlink += amount;
780 osi_Assert(ip->i_nlink >= 0);
781 if (ip->i_nlink == 0) {
787 /* XXX sync write?? */
794 * XFS/EFS iinc/idec code for EFS. Uses 64 bit inode numbers.
796 static int xfs_iincdec64(struct vfs *vfsp, ino_t inode, int inode_p1,
802 afs_xfs_attr_t attrs;
803 int length = SIZEOF_XFS_ATTR_T;
804 afs_xfs_dattr_t dattr;
809 code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED,
815 xfs_iunlock(ip, XFS_ILOCK_SHARED);
817 vattr.va_mask = AT_GID | AT_UID | AT_MODE;
818 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
822 if (!code && (vattr.va_gid != XFS_VICEMAGIC))
825 if (!code && (AFS_XFS_VNO_CLIP(inode_p1) != vattr.va_uid))
833 nlink = vattr.va_mode & AFS_XFS_MODE_LINK_MASK;
839 vattr.va_mode &= ~AFS_XFS_MODE_LINK_MASK;
840 vattr.va_mode |= nlink;
841 vattr.va_mask = AT_MODE;
842 AFS_VOP_SETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
848 b64_string_t stmp1, stmp2;
852 length = SIZEOF_XFS_ATTR_T;
853 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char*)&attrs, &length,
854 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
857 if (length != SIZEOF_XFS_ATTR_T
858 || attrs.at_attr_version != AFS_XFS_ATTR_VERS)
861 /* Get the vnode for the directory this file is in. */
865 code = xfs_getinode(vp->v_vfsp, NULL, attrs.at_pino, &ip);
870 xfs_iunlock(ip, XFS_ILOCK_SHARED);
872 /* Verify directory attributes. */
873 length = SIZEOF_XFS_DATTR_T;
874 AFS_VOP_ATTR_GET(dvp, AFS_XFS_DATTR , (char*)&dattr, &length,
875 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
877 if (length != SIZEOF_XFS_DATTR_T
878 || dattr.atd_version != AFS_XFS_ATD_VERS)
887 strcat(path, int_to_base64(stmp1, attrs.at_param[2]));
889 strcat(path, int_to_base64(stmp1, attrs.at_tag));
891 AFS_VOP_REMOVE(dvp, path, OSI_GET_CURRENT_CRED(), code);
895 vattr.va_mask = AT_NLINK;
896 AFS_VOP_GETATTR(dvp, &vattr, 0, OSI_GET_CURRENT_CRED(),
899 if (vattr.va_nlink == 2) {
900 vnode_t *ddvp; /* parent of volume directory. */
901 /* Try to remove the directory if this is a volume
902 * special file. It's ok to fail.
904 AFS_VOP_LOOKUP(dvp, "..", &ddvp,
905 (struct pathname *)NULL,
906 0, OSI_GET_CURRENT_RDIR(),
907 OSI_GET_CURRENT_CRED(), code2);
912 if (attrs.at_name_version == AFS_XFS_NAME_VERS2)
913 strcpy(path, AFS_INODE_DIR_NAME);
917 (attrs.at_param[1] == INODESPECIAL) ?
918 attrs.at_param[3] : attrs.at_param[0]);
920 AFS_LOCK_VOL_CREATE();
921 AFS_VOP_RMDIR(ddvp, path, OSI_GET_CURRENT_CDIR(),
922 OSI_GET_CURRENT_CRED(), code2);
923 AFS_UNLOCK_VOL_CREATE();
936 iincdec64(int dev, int inode_hi, int inode_lo, int inode_p1, int amount)
943 vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
945 vfsp = vfs_devsearch(dev);
951 if (vfsp->vfs_fstype == xfs_fstype) {
956 return xfs_iincdec64(vfsp, inode, inode_p1, amount);
958 else if (vfsp->vfs_fstype == efs_fstype) {
959 return efs_iincdec(vfsp, inode_lo, inode_p1, amount);
965 afs_syscall_idec64(int dev, int inode_hi, int inode_lo, int inode_p1)
967 return iincdec64(dev, inode_hi, inode_lo, inode_p1, -1);
971 afs_syscall_iinc64(int dev, int inode_hi, int inode_lo, int inode_p1)
973 return iincdec64(dev, inode_hi, inode_lo, inode_p1, 1);
986 int iinc(struct iincargs *uap, rval_t *rvp) {
990 int idec(struct iincargs *uap, rval_t *rvp) {
997 * XFS/EFS iinc/idec entry points for EFS only fileservers.
1001 iincdec(dev, inode, inode_p1, amount)
1002 int dev, inode, inode_p1, amount;
1008 vfsp = vfs_devsearch(dev);
1012 if (vfsp->vfs_fstype != efs_fstype)
1015 return efs_iincdec(vfsp, inode, inode_p1, amount);
1018 iinc(struct iincargs *uap, rval_t *rvp) {
1020 return (iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1024 idec(struct iincargs *uap, rval_t *rvp) {
1026 return (iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1028 #endif /* AFS_SGI65_ENV */
1030 #else /* AFS_SGI_XFS_IOPS_ENV */
1031 /* afs_syscall_iincdec iinc idec
1033 * These are the original EFS only entry points.
1036 afs_syscall_iincdec(dev, inode, inode_p1, amount)
1037 int dev, inode, inode_p1, amount;
1044 if (error = igetinode(0, (dev_t)dev, inode, &ip))
1047 if (!IS_VICEMAGIC(ip))
1049 else if (((struct afsparms *)ip->i_afs)->vicep1 != inode_p1)
1052 ip->i_nlink += amount;
1053 osi_Assert(ip->i_nlink >= 0);
1054 if (ip->i_nlink == 0) {
1055 CLEAR_VICEMAGIC(ip);
1058 ip->i_flags |= ICHG;
1060 /* XXX sync write?? */
1072 iinc(struct iincargs *uap, rval_t *rvp) {
1074 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, 1));
1078 idec(struct iincargs *uap, rval_t *rvp) {
1080 return (afs_syscall_iincdec(uap->dev, uap->inode, uap->inode_p1, -1));
1082 #endif /* AFS_SGI_XFS_IOPS_ENV */
1084 #ifdef AFS_SGI_XFS_IOPS_ENV
1085 /* afs_syscall_ilistinode64
1086 * Gathers up all required info for ListViceInodes in one system call.
1089 afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo,
1090 int datap, int datalenp)
1098 afs_xfs_attr_t attrs;
1100 i_list_inode_t data;
1105 #ifdef AFS_SGI65_ENV
1106 vfsp = vfs_devsearch(dev, xfs_fstype);
1108 vfsp = vfs_devsearch(dev);
1113 #ifndef AFS_SGI65_ENV
1114 if (vfsp->vfs_fstype != xfs_fstype)
1118 AFS_COPYIN((char*)datalenp, &idatalen, sizeof(int), code);
1119 if (idatalen < sizeof(i_list_inode_t)) {
1120 idatalen = sizeof(i_list_inode_t);
1121 AFS_COPYOUT((char*)datalenp, (char*)&idatalen, sizeof(int), code);
1124 idatalen = sizeof(i_list_inode_t);
1125 AFS_COPYOUT((char*)datalenp, (char*)&idatalen, sizeof(int), code);
1127 AFS_COPYIN((char*)datap, (char*)&data, sizeof(i_list_inode_t), code);
1128 if (data.ili_version != AFS_XFS_ILI_VERSION) {
1129 data.ili_version = AFS_XFS_ILI_VERSION;
1130 AFS_COPYOUT((char*)&data, (char*)datap, sizeof(i_list_inode_t), code);
1138 code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode,
1139 XFS_ILOCK_SHARED, &ip, (daddr_t)0);
1144 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1146 length = SIZEOF_XFS_ATTR_T;
1148 AFS_VOP_ATTR_GET(vp, AFS_XFS_ATTR, (char*)&attrs, &length,
1149 ATTR_ROOT, OSI_GET_CURRENT_CRED(), code);
1155 if (attrs.at_attr_version != AFS_XFS_ATTR_VERS)
1160 vattr.va_mask = AT_STAT;
1161 AFS_VOP_GETATTR(vp, &vattr, 0, OSI_GET_CURRENT_CRED(), code);
1165 bzero((char*)&data, sizeof(data));
1166 data.ili_info.inodeNumber = inode;
1167 data.ili_info.byteCount = vattr.va_size;
1168 data.ili_info.linkCount = (vattr.va_mode & AFS_XFS_MODE_LINK_MASK);
1169 bcopy((char*)attrs.at_param, (char*)data.ili_info.param,
1170 sizeof(data.ili_info.param));
1171 data.ili_attr_version = attrs.at_attr_version;
1172 data.ili_name_version = attrs.at_name_version;
1173 data.ili_tag = attrs.at_tag;
1174 data.ili_pino = attrs.at_pino;
1175 data.ili_vno = vattr.va_uid;
1176 data.ili_magic = vattr.va_gid;
1177 AFS_COPYOUT((char*)&data, (char*)datap, sizeof(data), code);
1182 #endif /* AFS_SGI_XFS_IOPS_ENV */