SCCS-vsn: sys/kern/vfs_lookup.c 4.8
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 4.8
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 4.8
-/* vfs_lookup.c 4.7 81/05/18 */
+/* vfs_lookup.c 4.8 81/11/08 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
*/
struct inode *
namei(func, flag)
*/
struct inode *
namei(func, flag)
{
register struct inode *dp;
register c;
{
register struct inode *dp;
register c;
- if((c=(*func)()) == '/')
+ if ((c=(*func)()) == '/')
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
- if(c == '\0' && flag != 0)
+ if (c == '\0' && flag != 0)
u.u_error = ENOENT;
cloop:
u.u_error = ENOENT;
cloop:
* to last component matched.
*/
* to last component matched.
*/
-#ifdef CHAOS
- /*
- * If the current node is a character
- * special file with the SUID bit set, return anyway.
- * This lets the Chaos open decode the rest of the name in its own
- * peculiar way. jrl 3/81
- */
- if((dp->i_mode&(IFMT|ISUID)) == (IFCHR|ISUID)) {
- u.u_dirp--; /* back up to the slash or null */
- return(dp);
- }
-#endif
-
/*
* If there is another component,
* Gather up name into
/*
* If there is another component,
* Gather up name into
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
- if (mpxip!=NULL && c=='!')
- break;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
*cp++ = c;
c = (*func)();
}
*cp++ = c;
c = (*func)();
}
- while(cp < &u.u_dbuf[DIRSIZ])
+ while (cp < &u.u_dbuf[DIRSIZ])
- if (c == '!' && mpxip != NULL) {
- iput(dp);
- plock(mpxip);
- mpxip->i_count++;
- return(mpxip);
- }
* must have X permission.
*/
* must have X permission.
*/
- if((dp->i_mode&IFMT) != IFDIR)
+ if ((dp->i_mode&IFMT) != IFDIR)
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
* is appropriate as per flag.
*/
* is appropriate as per flag.
*/
- if(u.u_offset >= dp->i_size) {
- if(bp != NULL)
+ if (u.u_offset >= dp->i_size) {
+ if (bp != NULL)
- if(flag==1 && c=='\0' && dp->i_nlink) {
- if(access(dp, IWRITE))
+ if (flag==1 && c=='\0' && dp->i_nlink) {
+ if (access(dp, IWRITE))
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
* Release previous if it exists.
*/
* Release previous if it exists.
*/
- if((u.u_offset&BMASK) == 0) {
- if(bp != NULL)
+ if ((u.u_offset&BMASK) == 0) {
+ if (bp != NULL)
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
*/
u.u_offset += sizeof(struct direct);
*/
u.u_offset += sizeof(struct direct);
- if(ep->d_ino == 0) {
- if(eo == 0)
+ if (ep->d_ino == 0) {
+ if (eo == 0)
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
- if(u.u_dbuf[i] != ep->d_name[i])
+ if (u.u_dbuf[i] != ep->d_name[i])
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
- if(flag==2 && c=='\0') {
- if(access(dp, IWRITE))
+ if (flag==2 && c=='\0') {
+ if (access(dp, IWRITE))
goto out;
return(dp);
}
d = dp->i_dev;
goto out;
return(dp);
}
d = dp->i_dev;
- if(u.u_dent.d_ino == ROOTINO)
- if(dp->i_number == ROOTINO)
- if(u.u_dent.d_name[1] == '.')
+ if (u.u_dent.d_ino == ROOTINO)
+ if (dp->i_number == ROOTINO)
+ if (u.u_dent.d_name[1] == '.')
- if(mount[i].m_bufp != NULL)
- if(mount[i].m_dev == d) {
+ if (mount[i].m_bufp != NULL)
+ if (mount[i].m_dev == d) {
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
return(NULL);
goto cloop;
return(NULL);
goto cloop;
register c;
c = fubyte(u.u_dirp++);
register c;
c = fubyte(u.u_dirp++);
u.u_error = EFAULT;
return(c);
}
u.u_error = EFAULT;
return(c);
}
-/* ufs_lookup.c 4.7 81/05/18 */
+/* ufs_lookup.c 4.8 81/11/08 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
*/
struct inode *
namei(func, flag)
*/
struct inode *
namei(func, flag)
{
register struct inode *dp;
register c;
{
register struct inode *dp;
register c;
- if((c=(*func)()) == '/')
+ if ((c=(*func)()) == '/')
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
- if(c == '\0' && flag != 0)
+ if (c == '\0' && flag != 0)
u.u_error = ENOENT;
cloop:
u.u_error = ENOENT;
cloop:
* to last component matched.
*/
* to last component matched.
*/
-#ifdef CHAOS
- /*
- * If the current node is a character
- * special file with the SUID bit set, return anyway.
- * This lets the Chaos open decode the rest of the name in its own
- * peculiar way. jrl 3/81
- */
- if((dp->i_mode&(IFMT|ISUID)) == (IFCHR|ISUID)) {
- u.u_dirp--; /* back up to the slash or null */
- return(dp);
- }
-#endif
-
/*
* If there is another component,
* Gather up name into
/*
* If there is another component,
* Gather up name into
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
- if (mpxip!=NULL && c=='!')
- break;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
*cp++ = c;
c = (*func)();
}
*cp++ = c;
c = (*func)();
}
- while(cp < &u.u_dbuf[DIRSIZ])
+ while (cp < &u.u_dbuf[DIRSIZ])
- if (c == '!' && mpxip != NULL) {
- iput(dp);
- plock(mpxip);
- mpxip->i_count++;
- return(mpxip);
- }
* must have X permission.
*/
* must have X permission.
*/
- if((dp->i_mode&IFMT) != IFDIR)
+ if ((dp->i_mode&IFMT) != IFDIR)
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
* is appropriate as per flag.
*/
* is appropriate as per flag.
*/
- if(u.u_offset >= dp->i_size) {
- if(bp != NULL)
+ if (u.u_offset >= dp->i_size) {
+ if (bp != NULL)
- if(flag==1 && c=='\0' && dp->i_nlink) {
- if(access(dp, IWRITE))
+ if (flag==1 && c=='\0' && dp->i_nlink) {
+ if (access(dp, IWRITE))
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
* Release previous if it exists.
*/
* Release previous if it exists.
*/
- if((u.u_offset&BMASK) == 0) {
- if(bp != NULL)
+ if ((u.u_offset&BMASK) == 0) {
+ if (bp != NULL)
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
*/
u.u_offset += sizeof(struct direct);
*/
u.u_offset += sizeof(struct direct);
- if(ep->d_ino == 0) {
- if(eo == 0)
+ if (ep->d_ino == 0) {
+ if (eo == 0)
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
- if(u.u_dbuf[i] != ep->d_name[i])
+ if (u.u_dbuf[i] != ep->d_name[i])
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
- if(flag==2 && c=='\0') {
- if(access(dp, IWRITE))
+ if (flag==2 && c=='\0') {
+ if (access(dp, IWRITE))
goto out;
return(dp);
}
d = dp->i_dev;
goto out;
return(dp);
}
d = dp->i_dev;
- if(u.u_dent.d_ino == ROOTINO)
- if(dp->i_number == ROOTINO)
- if(u.u_dent.d_name[1] == '.')
+ if (u.u_dent.d_ino == ROOTINO)
+ if (dp->i_number == ROOTINO)
+ if (u.u_dent.d_name[1] == '.')
- if(mount[i].m_bufp != NULL)
- if(mount[i].m_dev == d) {
+ if (mount[i].m_bufp != NULL)
+ if (mount[i].m_dev == d) {
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
return(NULL);
goto cloop;
return(NULL);
goto cloop;
register c;
c = fubyte(u.u_dirp++);
register c;
c = fubyte(u.u_dirp++);
u.u_error = EFAULT;
return(c);
}
u.u_error = EFAULT;
return(c);
}
-/* ufs_lookup.c 4.7 81/05/18 */
+/* ufs_lookup.c 4.8 81/11/08 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
*/
struct inode *
namei(func, flag)
*/
struct inode *
namei(func, flag)
{
register struct inode *dp;
register c;
{
register struct inode *dp;
register c;
- if((c=(*func)()) == '/')
+ if ((c=(*func)()) == '/')
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
if ((dp = u.u_rdir) == NULL)
dp = rootdir;
(void) iget(dp->i_dev, dp->i_number);
- if(c == '\0' && flag != 0)
+ if (c == '\0' && flag != 0)
u.u_error = ENOENT;
cloop:
u.u_error = ENOENT;
cloop:
* to last component matched.
*/
* to last component matched.
*/
-#ifdef CHAOS
- /*
- * If the current node is a character
- * special file with the SUID bit set, return anyway.
- * This lets the Chaos open decode the rest of the name in its own
- * peculiar way. jrl 3/81
- */
- if((dp->i_mode&(IFMT|ISUID)) == (IFCHR|ISUID)) {
- u.u_dirp--; /* back up to the slash or null */
- return(dp);
- }
-#endif
-
/*
* If there is another component,
* Gather up name into
/*
* If there is another component,
* Gather up name into
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
cp = &u.u_dbuf[0];
while (c != '/' && c != '\0' && u.u_error == 0 ) {
- if (mpxip!=NULL && c=='!')
- break;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
if (flag==1 && c == ('/'|0200)) {
u.u_error = ENOENT;
goto out;
*cp++ = c;
c = (*func)();
}
*cp++ = c;
c = (*func)();
}
- while(cp < &u.u_dbuf[DIRSIZ])
+ while (cp < &u.u_dbuf[DIRSIZ])
- if (c == '!' && mpxip != NULL) {
- iput(dp);
- plock(mpxip);
- mpxip->i_count++;
- return(mpxip);
- }
* must have X permission.
*/
* must have X permission.
*/
- if((dp->i_mode&IFMT) != IFDIR)
+ if ((dp->i_mode&IFMT) != IFDIR)
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
u.u_error = ENOTDIR;
(void) access(dp, IEXEC);
* is appropriate as per flag.
*/
* is appropriate as per flag.
*/
- if(u.u_offset >= dp->i_size) {
- if(bp != NULL)
+ if (u.u_offset >= dp->i_size) {
+ if (bp != NULL)
- if(flag==1 && c=='\0' && dp->i_nlink) {
- if(access(dp, IWRITE))
+ if (flag==1 && c=='\0' && dp->i_nlink) {
+ if (access(dp, IWRITE))
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
u.u_offset = eo-sizeof(struct direct);
else
dp->i_flag |= IUPD|ICHG;
* Release previous if it exists.
*/
* Release previous if it exists.
*/
- if((u.u_offset&BMASK) == 0) {
- if(bp != NULL)
+ if ((u.u_offset&BMASK) == 0) {
+ if (bp != NULL)
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
brelse(bp);
bp = bread(dp->i_dev,
bmap(dp, (daddr_t)(u.u_offset>>BSHIFT), B_READ));
*/
u.u_offset += sizeof(struct direct);
*/
u.u_offset += sizeof(struct direct);
- if(ep->d_ino == 0) {
- if(eo == 0)
+ if (ep->d_ino == 0) {
+ if (eo == 0)
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
eo = u.u_offset;
goto eloop;
}
for(i=0; i<DIRSIZ; i++) {
- if(u.u_dbuf[i] != ep->d_name[i])
+ if (u.u_dbuf[i] != ep->d_name[i])
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
* cloop, otherwise return.
*/
bcopy((caddr_t)ep, (caddr_t)&u.u_dent, sizeof(struct direct));
- if(flag==2 && c=='\0') {
- if(access(dp, IWRITE))
+ if (flag==2 && c=='\0') {
+ if (access(dp, IWRITE))
goto out;
return(dp);
}
d = dp->i_dev;
goto out;
return(dp);
}
d = dp->i_dev;
- if(u.u_dent.d_ino == ROOTINO)
- if(dp->i_number == ROOTINO)
- if(u.u_dent.d_name[1] == '.')
+ if (u.u_dent.d_ino == ROOTINO)
+ if (dp->i_number == ROOTINO)
+ if (u.u_dent.d_name[1] == '.')
- if(mount[i].m_bufp != NULL)
- if(mount[i].m_dev == d) {
+ if (mount[i].m_bufp != NULL)
+ if (mount[i].m_dev == d) {
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
iput(dp);
dp = mount[i].m_inodp;
dp->i_count++;
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
goto seloop;
}
iput(dp);
dp = iget(d, u.u_dent.d_ino);
return(NULL);
goto cloop;
return(NULL);
goto cloop;
register c;
c = fubyte(u.u_dirp++);
register c;
c = fubyte(u.u_dirp++);
u.u_error = EFAULT;
return(c);
}
u.u_error = EFAULT;
return(c);
}